Skip to content

Commit

Permalink
[no-cl] make gradle output the CF file urls after upload
Browse files Browse the repository at this point in the history
  • Loading branch information
thiakil committed Nov 14, 2023
1 parent a03e410 commit 296c1de
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ tasks.register('outputChangelog') {
}
}

def mainCfUpload, additionsCfUpload, generatorsCfUpload, toolsCfUpload;

if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKey')) {
println "Enabling Curseforge config"
tasks.register("curseforge", TaskPublishCurseForge, { task ->
Expand All @@ -775,7 +777,7 @@ if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKe
def changelog = changeLogResolver.call()

//Main Mekanism Project
task.upload(268560, jar) { main ->
mainCfUpload = task.upload(268560, jar) { main ->
setGenericCurseArtifactData(main, changelog)
//Include the API jar as a secondary file to the main file
withAdditionalFile(apiJar)
Expand All @@ -798,10 +800,17 @@ if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKe
}

//Secondary modules/projects
uploadSecondaryCurseProject(task, 345425, changelog, additionsJar)
additionsCfUpload = uploadSecondaryCurseProject(task, 345425, changelog, additionsJar)
//uploadSecondaryCurseProject(task, 376939, changelog, defenseJar)
uploadSecondaryCurseProject(task, 268566, changelog, generatorsJar)
uploadSecondaryCurseProject(task, 268567, changelog, toolsJar)
generatorsCfUpload = uploadSecondaryCurseProject(task, 268566, changelog, generatorsJar)
toolsCfUpload = uploadSecondaryCurseProject(task, 268567, changelog, toolsJar)

doLast {
println("https://www.curseforge.com/minecraft/mc-mods/mekanism/files/${mainCfUpload.curseFileId}")
println("https://www.curseforge.com/minecraft/mc-mods/mekanism-additions/files/${additionsCfUpload.curseFileId}")
println("https://www.curseforge.com/minecraft/mc-mods/mekanism-generators/files/${generatorsCfUpload.curseFileId}")
println("https://www.curseforge.com/minecraft/mc-mods/mekanism-tools/files/${toolsCfUpload.curseFileId}")
}
})
}

Expand All @@ -813,8 +822,8 @@ void setGenericCurseArtifactData(UploadArtifact artifact, String changelog) {
artifact.addModLoader("Forge")
}

void uploadSecondaryCurseProject(TaskPublishCurseForge task, long projectId, String changelog, TaskProvider<Jar> sourceSetJar) {
task.upload(projectId, sourceSetJar) { artifact ->
UploadArtifact uploadSecondaryCurseProject(TaskPublishCurseForge task, long projectId, String changelog, TaskProvider<Jar> sourceSetJar) {
return task.upload(projectId, sourceSetJar) { artifact ->
setGenericCurseArtifactData(artifact, changelog)
addRequirement('mekanism')
}
Expand Down Expand Up @@ -868,6 +877,7 @@ if (System.getenv("MODRINTH_TOKEN") != null || project.hasProperty('modrinthToke
new ModDependency("6AQIaxuO", "optional"),//WTHIT
])
}

}

def createSecondaryModrinthUpload(String output, String targetProjectId, TaskProvider<Jar> sourceSetJar) {
Expand Down

0 comments on commit 296c1de

Please sign in to comment.