Better CurseForge task configuration: display name, game versions and a fix for changelog backup not being replaced

This commit is contained in:
Toshayo 2023-06-12 11:58:11 +02:00
parent d3e6e22600
commit e94548ed0c
No known key found for this signature in database
GPG Key ID: 7DC46644B561B1B4

View File

@ -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"))
}
}