Update grgit and minotaur, fixed modrinth dependency support
This commit is contained in:
parent
7e8ea49b2a
commit
c54dcfd238
35
jfmod.gradle
35
jfmod.gradle
|
@ -14,8 +14,8 @@ buildscript {
|
|||
|
||||
dependencies {
|
||||
classpath "net.fabricmc:fabric-loom:0.11-SNAPSHOT"
|
||||
classpath "org.ajoberstar.grgit:grgit-gradle:4.1.1"
|
||||
classpath "gradle.plugin.com.modrinth.minotaur:Minotaur:1.2.1"
|
||||
classpath "org.ajoberstar.grgit:grgit-gradle:5.0.0"
|
||||
classpath "com.modrinth.minotaur:Minotaur:2.0.0"
|
||||
classpath "io.gitlab.jfronny:CurseGradle:1.4.0-1642087331626"
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ apply plugin: 'idea'
|
|||
apply plugin: 'java-library'
|
||||
apply plugin: 'maven-publish'
|
||||
if (ext.curseforgeAvailable) apply plugin: com.matthewprenger.cursegradle.CurseGradlePlugin
|
||||
apply plugin: com.modrinth.minotaur.Minotaur
|
||||
if (ext.modrinthAvailable) apply plugin: com.modrinth.minotaur.Minotaur
|
||||
apply plugin: org.ajoberstar.grgit.gradle.GrgitPlugin
|
||||
|
||||
import com.modrinth.minotaur.request.VersionType
|
||||
enum VersionType { release, beta, alpha }
|
||||
|
||||
static Node getOrCreateNode(Node node, String name) {
|
||||
Node dependencies = null
|
||||
|
@ -74,7 +74,7 @@ ext.moduleDependencies = { Project project, List<String> depNames ->
|
|||
// Fetch changelog
|
||||
def changelogStr = ""
|
||||
ext.currentVer = "0.0.0+nogit"
|
||||
ext.currentType = VersionType.ALPHA
|
||||
ext.currentType = VersionType.alpha
|
||||
if (grgit != null) {
|
||||
ext.currentVer = "0.0.0+notag"
|
||||
grgit.open(dir: project.projectDir.toString())
|
||||
|
@ -84,7 +84,7 @@ if (grgit != null) {
|
|||
if (tagList.get(0).fullMessage != null) {
|
||||
changelogStr += tagList.get(0).fullMessage + "\n"
|
||||
}
|
||||
ext.currentType = VersionType.RELEASE
|
||||
ext.currentType = VersionType.release
|
||||
ext.currentVer = tagList.get(0).getName()
|
||||
switch (ext.currentVer[0]) {
|
||||
case 'v':
|
||||
|
@ -92,18 +92,18 @@ if (grgit != null) {
|
|||
break
|
||||
case 'b':
|
||||
ext.currentVer = ext.currentVer.substring(1)
|
||||
ext.currentType = VersionType.BETA
|
||||
ext.currentType = VersionType.beta
|
||||
break
|
||||
case 'a':
|
||||
ext.currentVer = ext.currentVer.substring(1)
|
||||
ext.currentType = VersionType.ALPHA
|
||||
ext.currentType = VersionType.alpha
|
||||
break
|
||||
}
|
||||
def commits = new ArrayList<>(tagList.size() >= 2
|
||||
? grgit.log{range(tagList.get(1).fullName, tagList.get(0).fullName)}
|
||||
: grgit.log(includes: [grgit.tag.list().get(0).fullName]))
|
||||
Collections.reverse(commits)
|
||||
changelogStr += "Commits in " + ext.currentType.toString().toLowerCase() + " " + ext.currentVer + ":\n"
|
||||
changelogStr += "Commits in " + ext.currentType.toString() + " " + ext.currentVer + ":\n"
|
||||
for (def commit : commits) {
|
||||
changelogStr += "- " + commit.shortMessage + "\n"
|
||||
}
|
||||
|
@ -310,24 +310,23 @@ dependencies {
|
|||
}
|
||||
|
||||
if (ext.modrinthAvailable) {
|
||||
task modrinth(type: com.modrinth.minotaur.TaskModrinthUpload, dependsOn: build) {
|
||||
modrinth {
|
||||
token = System.getenv().MODRINTH_API_TOKEN
|
||||
projectId = project.modrinth_id
|
||||
versionNumber = version
|
||||
versionName = "[${project.minecraft_version}] ${version}"
|
||||
versionType = project.ext.currentType
|
||||
versionType = project.ext.currentType.toString()
|
||||
changelog = changelogStr
|
||||
uploadFile = file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")
|
||||
addGameVersion("${project.minecraft_version}")
|
||||
addLoader('fabric')
|
||||
uploadFile = remapJar
|
||||
gameVersions = ["${project.minecraft_version}"]
|
||||
loaders = ['fabric']
|
||||
if (!project.ext.modrinth_required_dependencies.isEmpty()) {
|
||||
project.ext.modrinth_required_dependencies.split(", ").each {
|
||||
String dep -> addDependency(dep, com.modrinth.minotaur.request.Dependency.DependencyType.REQUIRED)
|
||||
String dep -> dependencies.add(new com.modrinth.minotaur.dependencies.ModDependency(dep, "required"))
|
||||
}
|
||||
}
|
||||
if (!project.ext.modrinth_optional_dependencies.isEmpty()) {
|
||||
project.ext.modrinth_optional_dependencies.split(", ").each {
|
||||
String dep -> addDependency(dep, com.modrinth.minotaur.request.Dependency.DependencyType.OPTIONAL)
|
||||
String dep -> dependencies.add(new com.modrinth.minotaur.dependencies.ModDependency(dep, "optional"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +365,7 @@ if (ext.curseforgeAvailable) {
|
|||
}
|
||||
}
|
||||
}
|
||||
releaseType = project.ext.currentType.toString().toLowerCase()
|
||||
releaseType = project.ext.currentType.toString()
|
||||
afterEvaluate {
|
||||
uploadTask.dependsOn(build)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue