Przeglądaj źródła

Fix buildscript

shedaniel 4 lat temu
rodzic
commit
83a8fb1302
3 zmienionych plików z 38 dodań i 36 usunięć
  1. 30 32
      build.gradle
  2. 4 2
      fabric/build.gradle
  3. 4 2
      forge/build.gradle

+ 30 - 32
build.gradle

@@ -37,6 +37,35 @@ allprojects {
 
         ignoreFailures = true
     }
+    
+    ext {
+        releaseChangelog = {
+            def dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm")
+            dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"))
+            def branch
+            if (System.env.BRANCH_NAME) {
+                branch = System.env.BRANCH_NAME
+                branch = branch.substring(branch.lastIndexOf("/") + 1)
+            } else {
+                branch = "git rev-parse --abbrev-ref HEAD".execute().in.text.trim()
+            }
+            if (branch == "HEAD") {
+                branch = "git rev-parse --short HEAD".execute().in.text.trim()
+            }
+            def time = dateFormat.format(new Date())
+            def changes = new StringBuilder()
+            changes << "<h2>Architectury v$project.version for $project.supported_version</h2>Updated at <b>$time</b>.<br><a href=\"https://www.github.com/architectury/architectury/commits/$branch\">Click here for changelog</a>"
+            def proc = "git log --max-count=200 --pretty=format:%s".execute()
+            proc.in.eachLine { line ->
+                def processedLine = line.toString()
+                if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
+                    changes << "<br>- ${processedLine.capitalize()}"
+                }
+            }
+            proc.waitFor()
+            return changes.toString()
+        }
+    }
 }
 
 task licenseFormatAll
@@ -58,35 +87,4 @@ bintray {
     }
 }
 
-def releaseChangelog = "No changelog"
-task curseforgePublish {
-    def dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm")
-    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"))
-    def branch
-    if (System.env.BRANCH_NAME) {
-        branch = System.env.BRANCH_NAME
-        branch = branch.substring(branch.lastIndexOf("/") + 1)
-    } else {
-        branch = "git rev-parse --abbrev-ref HEAD".execute().in.text.trim()
-    }
-    if (branch == "HEAD") {
-        branch = "git rev-parse --short HEAD".execute().in.text.trim()
-    }
-    def time = dateFormat.format(new Date())
-    def changes = new StringBuilder()
-    changes << "<h2>Architectury v$project.version for $project.supported_version</h2>Updated at <b>$time</b>.<br><a href=\"https://www.github.com/architectury/architectury/commits/$branch\">Click here for changelog</a>"
-    def proc = "git log --max-count=200 --pretty=format:%s".execute()
-    proc.in.eachLine { line ->
-        def processedLine = line.toString()
-        if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
-            changes << "<br>- ${processedLine.capitalize()}"
-        }
-    }
-    proc.waitFor()
-    releaseChangelog = changes.toString()
-}
-
-afterEvaluate {
-//    curseforgePublish.dependsOn project("fabric").tasks.getByName("curseforge")
-//    curseforgePublish.dependsOn project("forge").tasks.getByName("curseforge")
-}
+task curseforgePublish

+ 4 - 2
fabric/build.gradle

@@ -69,7 +69,7 @@ curseforge {
             id = "419697"
             releaseType = "release"
             changelogType = "html"
-            changelog = rootProject.releaseChangelog
+            changelog = releaseChangelog()
             addGameVersion "1.16-Snapshot"
             addGameVersion "1.16.4"
             addGameVersion "Java 8"
@@ -89,4 +89,6 @@ curseforge {
         forgeGradleIntegration = false
         javaVersionAutoDetect = false
     }
-}
+}
+
+rootProject.tasks.getByName("curseforgePublish").dependsOn curseforge

+ 4 - 2
forge/build.gradle

@@ -89,7 +89,7 @@ curseforge {
             id = "419699"
             releaseType = "release"
             changelogType = "html"
-            changelog = rootProject.releaseChangelog
+            changelog = releaseChangelog()
             addGameVersion "1.16.4"
             addGameVersion "Java 8"
             addGameVersion "Forge"
@@ -108,4 +108,6 @@ curseforge {
         forgeGradleIntegration = false
         javaVersionAutoDetect = false
     }
-}
+}
+
+rootProject.tasks.getByName("curseforgePublish").dependsOn curseforge