From e94548ed0c1b30aa53ca3539149c0c9d289f81c3 Mon Sep 17 00:00:00 2001 From: Toshayo Date: Mon, 12 Jun 2023 11:58:11 +0200 Subject: [PATCH] Better CurseForge task configuration: display name, game versions and a fix for changelog backup not being replaced --- build.gradle | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 9a1ea516d..8cd9a478d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,8 @@ +import org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory + import java.nio.file.Files import java.nio.file.Paths +import java.nio.file.StandardCopyOption buildscript { repositories { @@ -53,7 +56,7 @@ eclipse.classpath.file.whenMerged { cp -> } // Create file reference factory - def fileref = new org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory() + def fileref = new FileReferenceFactory() // Find all codechicken development jars cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-dev.jar") }.forEach { entry -> @@ -132,12 +135,20 @@ if(Files.exists(Paths.get("curseforge.properties"))) { projectId = cfprops.project_id releaseType = "release" + displayName = "Hbm's Nuclear Tech Mod " + version_name.replace("_", "") + " for Minecraft 1.7.10" + + gameVersions.addAll([ + "Forge", + "Java 8", + "Client", "Server" + ]) + if (Files.exists(Paths.get("changelog"))) { changelog = String.join("\r\n", Files.readAllLines(Paths.get("changelog"))) // Perform a backup of the changelog and create a new file for next changes doLast { - Files.move(Paths.get("changelog"), Paths.get("changelog.bak")) + Files.move(Paths.get("changelog"), Paths.get("changelog.bak"), StandardCopyOption.REPLACE_EXISTING) Files.createFile(Paths.get("changelog")) } }