Skip to content

Commit

Permalink
fix curseforge and change maven group
Browse files Browse the repository at this point in the history
  • Loading branch information
TwilightFlower committed Jun 10, 2024
1 parent a906166 commit 5590737
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 38 deletions.
15 changes: 7 additions & 8 deletions addon.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,13 @@ afterEvaluate {

pluginManager.withPlugin("net.darkhax.curseforgegradle") {
tasks.curseforge {
doFirst {
dependsOn(forgePatchesJar)
def mainArtifact = uploadArtifacts[0]
mainArtifact.withAdditionalFile(forgePatchesJar.get().archiveFile.get().asFile)
mainArtifact.additionalArtifacts.forEach { additionalArtifact ->
additionalArtifact.changelogType = mainArtifact.changelogType
additionalArtifact.changelog = mainArtifact.changelog
}
dependsOn(forgePatchesJar)
def mainArtifact = uploadArtifacts[0]
mainArtifact.withAdditionalFile(forgePatchesJar.get().archiveFile.get().asFile)
mainArtifact.additionalArtifacts.forEach { additionalArtifact ->
additionalArtifact.changelogType = mainArtifact.changelogType
additionalArtifact.changelog = mainArtifact.changelog

}
}
}
Expand Down
67 changes: 37 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Breaking the auto updater because I need to change some curseforge stuff
//version: 1707682661
/*
* DO NOT CHANGE THIS FILE!
Expand Down Expand Up @@ -945,43 +946,49 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
debugMode = deploymentDebug.toBoolean()
apiToken = cfApiKey.getOrElse('debug_token')

def mainFile = upload(curseForgeProjectId, reobfJar)

mainFile.displayName = versionDisplayFormat.replace('$MOD_NAME', modName).replace('$VERSION', modVersion)
mainFile.releaseType = getReleaseType()
mainFile.changelogType = 'markdown'
mainFile.addModLoader 'Forge'
mainFile.addJavaVersion "Java 8"
mainFile.addGameVersion minecraftVersion

if (curseForgeRelations.size() != 0) {
String[] deps = curseForgeRelations.split(';')
deps.each { dep ->
if (dep.size() == 0) {
return
}
String[] parts = dep.split(':')
String type = parts[0], slug = parts[1]
def types = [
'req' : 'requiredDependency', 'required': 'requiredDependency',
'opt' : 'optionalDependency', 'optional': 'optionalDependency',
'embed' : 'embeddedLibrary', 'embedded': 'embeddedLibrary',
'incomp': 'incompatible', 'fail' : 'incompatible']
if (types.containsKey(type)) type = types[type]
if (!(type in ['requiredDependency', 'embeddedLibrary', 'optionalDependency', 'tool', 'incompatible'])) {
throw new Exception('Invalid Curseforge dependency type: ' + type)
}
mainFile.addRelation(slug, type)
}
}

for (artifact in getSecondaryArtifacts()) {
mainFile.withAdditionalFile(artifact)
}

doFirst {
def mainFile = upload(curseForgeProjectId, reobfJar)
def changelogFile = getChangelog()
def changelogRaw = changelogFile.exists() ? changelogFile.getText('UTF-8') : ""

mainFile.displayName = versionDisplayFormat.replace('$MOD_NAME', modName).replace('$VERSION', modVersion)
mainFile.releaseType = getReleaseType()
mainFile.changelog = changelogRaw
mainFile.changelogType = 'markdown'
mainFile.addModLoader 'Forge'
mainFile.addJavaVersion "Java 8"
mainFile.addGameVersion minecraftVersion

if (curseForgeRelations.size() != 0) {
String[] deps = curseForgeRelations.split(';')
deps.each { dep ->
if (dep.size() == 0) {
return
}
String[] parts = dep.split(':')
String type = parts[0], slug = parts[1]
def types = [
'req' : 'requiredDependency', 'required': 'requiredDependency',
'opt' : 'optionalDependency', 'optional': 'optionalDependency',
'embed' : 'embeddedLibrary', 'embedded': 'embeddedLibrary',
'incomp': 'incompatible', 'fail' : 'incompatible']
if (types.containsKey(type)) type = types[type]
if (!(type in ['requiredDependency', 'embeddedLibrary', 'optionalDependency', 'tool', 'incompatible'])) {
throw new Exception('Invalid Curseforge dependency type: ' + type)
}
mainFile.addRelation(slug, type)
}
}

for (artifact in getSecondaryArtifacts()) {
def additionalFile = mainFile.withAdditionalFile(artifact)
additionalFile.changelog = changelogRaw
for (artifact in mainFile.additionalArtifacts) {
artifact.changelog = changelogRaw
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ modId = lwjgl3ify
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = me.eigenraven.lwjgl3ify
# don't conflict with 1.7.10 versions, change maven group
mavenArtifactGroup = io.github.twilightflower

# Updates your build.gradle and settings.gradle automatically whenever an update is available.
autoUpdateBuildScript = false
Expand Down

0 comments on commit 5590737

Please sign in to comment.