move Curseforge changelog generation into a closure, to hopefully only generate it when necessary
@@ -722,6 +722,13 @@ if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKe
curseforge {
apiKey = System.getenv("CURSEFORGE_KEY") ?: project.findProperty("curseforgeKey")
+ def resolvedChangelog = null
+
+ //closure to generate the changelog once, and only when needed by CurseGradle
+ def changeLogResolver = { ->
+ if (resolvedChangelog != null) {
+ return resolvedChangelog
+ }
def generatedChangelog = "Unable to generate changelog :("
def currentCommit = System.getenv("GIT_COMMIT")
def prevCommit = System.getenv("GIT_PREVIOUS_SUCCESSFUL_COMMIT") ?: System.getenv("GIT_PREVIOUS_COMMIT")
@@ -760,12 +767,15 @@ if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKe
"it to a minimum make sure to make backups. You can read more about the alpha state of this project <a href=\"https://github.com/mekanism/Mekanism#alpha-status\">here</a>." +
"<br> $generatedChangelog"
}
+ resolvedChangelog = generatedChangelog
+ return generatedChangelog
+ }
//Main
project {
id = '268560'
changelogType = "html"
- changelog = generatedChangelog
+ changelog = changeLogResolver
// A file can also be set using: changelog = file('changelog.txt')
releaseType = "${curse_release_type}"
mainArtifact(jar) {
@@ -788,7 +798,7 @@ if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKe
project {
id = '345425'
changelogType = "html"
- changelog = generatedChangelog
+ changelog = changeLogResolver
releaseType = "${curse_release_type}"
mainArtifact(additionsJar) {
relations {
@@ -802,7 +812,7 @@ if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKe
/*project {
id = '376939'
changelogType = "html"
- changelog = generatedChangelog
+ changelog = changeLogResolver
releaseType = "${curse_release_type}"
mainArtifact(defenseJar) {
relations {
@@ -816,7 +826,7 @@ if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKe
project {
id = '268566'
changelogType = "html"
- changelog = generatedChangelog
+ changelog = changeLogResolver
releaseType = "${curse_release_type}"
mainArtifact(generatorsJar) {
relations {
@@ -830,7 +840,7 @@ if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKe
project {
id = '268567'
changelogType = "html"
- changelog = generatedChangelog
+ changelog = changeLogResolver
releaseType = "${curse_release_type}"
mainArtifact(toolsJar) {
relations {
