Fix buildscript

This commit is contained in:
shedaniel
2020-11-15 21:06:30 +08:00
parent 6362fe40e3
commit 83a8fb1302
3 changed files with 38 additions and 36 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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