From 296c1ded7c05b5334390495c09f6b714abd0aedc Mon Sep 17 00:00:00 2001 From: Thiakil Date: Tue, 14 Nov 2023 21:09:48 +0800 Subject: [PATCH] [no-cl] make gradle output the CF file urls after upload --- build.gradle | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 0efbe81dcd7..ba7ff458ab4 100644 --- a/build.gradle +++ b/build.gradle @@ -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 -> @@ -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) @@ -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}") + } }) } @@ -813,8 +822,8 @@ void setGenericCurseArtifactData(UploadArtifact artifact, String changelog) { artifact.addModLoader("Forge") } -void uploadSecondaryCurseProject(TaskPublishCurseForge task, long projectId, String changelog, TaskProvider sourceSetJar) { - task.upload(projectId, sourceSetJar) { artifact -> +UploadArtifact uploadSecondaryCurseProject(TaskPublishCurseForge task, long projectId, String changelog, TaskProvider sourceSetJar) { + return task.upload(projectId, sourceSetJar) { artifact -> setGenericCurseArtifactData(artifact, changelog) addRequirement('mekanism') } @@ -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 sourceSetJar) {