aboutsummaryrefslogtreecommitdiff
path: root/publish
diff options
context:
space:
mode:
Diffstat (limited to 'publish')
-rw-r--r--publish/README.txt7
-rw-r--r--publish/build.gradle22
-rw-r--r--publish/build_and_release.sh5
-rw-r--r--publish/curseforge_all.sh2
-rwxr-xr-x[-rw-r--r--]publish/gradlew0
-rw-r--r--publish/modrinth_all.sh2
-rw-r--r--publish/prepare_publish.py2
-rw-r--r--publish/update_updatejson.py2
8 files changed, 28 insertions, 14 deletions
diff --git a/publish/README.txt b/publish/README.txt
index b429284..1b777f6 100644
--- a/publish/README.txt
+++ b/publish/README.txt
@@ -1,2 +1,7 @@
# How to publish
-sh ./build_and_release.sh $GITHUB_TOKEN [$CURSEFORGE_TOKEN] [$MODRINTH_TOKEN] \ No newline at end of file
+
+Push the release's tag before running this.
+
+```
+sh ./build_and_release.sh $GITHUB_TOKEN [$CURSEFORGE_TOKEN] [$MODRINTH_TOKEN]
+```
diff --git a/publish/build.gradle b/publish/build.gradle
index 9cf7c6e..1a05d54 100644
--- a/publish/build.gradle
+++ b/publish/build.gradle
@@ -28,8 +28,9 @@ def getCommitVersion(){
}
def buildVersion = getCommitVersion()
-def changeLog = new File("${projectDir}/changelog.md").getText('UTF-8')
-def gameVersionsMap = new JsonSlurper().parseText(file("gameVersions.json").getText('UTF-8'))
+def changeLogFile = new File("${projectDir}/changelog.md")
+def changeLog = changeLogFile.exists() ? changeLogFile.getText('UTF-8') : ""
+ext.gameVersionsMap = new JsonSlurper().parseText(file("gameVersions.json").getText('UTF-8'))
ext.gameVersions = gameVersionsMap.keySet()
def githubOK = project.hasProperty("githubToken")
@@ -165,14 +166,21 @@ task listFiles {
}
}
-project.gameVersions.collect({toBaseVersion(it)}).each { ver ->
- def dir = getVersionProjectPath(ver)
- task ("cleanBuild-$ver", type: Exec) {
+def getBuildArgumentSets(ver) {
+ def projectConfig = new Properties()
+ projectConfig.load(file("../gradle.properties").newReader())
+ return projectConfig.enable_mixin ? ["", "-Pnomixin"] : [""]
+}
+
+project.gameVersions.each { ver ->
+ def baseVer = toBaseVersion(ver)
+ def dir = getVersionProjectPath(baseVer)
+ task ("cleanBuild-$baseVer", type: Exec) {
workingDir dir
- commandLine 'sh', '-c', "rm -f build/libs/* && ./gradlew build"
+ commandLine 'sh', '-c', "rm -f build/libs/* && " + String.join(" && ", getBuildArgumentSets(ver).collect({"./gradlew build ${it}"}))
}
}
task cleanBuildAll(dependsOn: project.gameVersions.collect({"cleanBuild-${toBaseVersion(it)}"})) {
-} \ No newline at end of file
+}
diff --git a/publish/build_and_release.sh b/publish/build_and_release.sh
index 5ab7fe0..7766411 100644
--- a/publish/build_and_release.sh
+++ b/publish/build_and_release.sh
@@ -28,7 +28,6 @@ MODRINTH_TOKEN=$3
# release
py prepare_publish.py
./gradlew githubRelease -PgithubToken=$GITHUB_TOKEN
-py update_updatejson.py
if [ -n "$CURSEFORGE_TOKEN" ]
then
@@ -40,4 +39,6 @@ fi
if [ -n "$MODRINTH_TOKEN" ]
then
./modrinth_all.sh -PmodrinthToken=$MODRINTH_TOKEN
-fi \ No newline at end of file
+fi
+
+py update_updatejson.py
diff --git a/publish/curseforge_all.sh b/publish/curseforge_all.sh
index 280911d..3d10aa7 100644
--- a/publish/curseforge_all.sh
+++ b/publish/curseforge_all.sh
@@ -1,3 +1,3 @@
for proj in `cat gameVersions.txt`; do
./gradlew curseforge -PgameVersion=$proj $*
-done \ No newline at end of file
+done
diff --git a/publish/gradlew b/publish/gradlew
index 91a7e26..91a7e26 100644..100755
--- a/publish/gradlew
+++ b/publish/gradlew
diff --git a/publish/modrinth_all.sh b/publish/modrinth_all.sh
index 80d68db..e3a6538 100644
--- a/publish/modrinth_all.sh
+++ b/publish/modrinth_all.sh
@@ -1,3 +1,3 @@
for proj in `cat gameVersions.txt`; do
./gradlew publishModrinth -PgameVersion=$proj $*
-done \ No newline at end of file
+done
diff --git a/publish/prepare_publish.py b/publish/prepare_publish.py
index 50e799c..731ec41 100644
--- a/publish/prepare_publish.py
+++ b/publish/prepare_publish.py
@@ -1,3 +1,3 @@
import json
-open("gameVersions.txt", "w").write(" ".join(json.load(open("gameVersions.json", "r")).keys())) \ No newline at end of file
+open("gameVersions.txt", "w").write(" ".join(json.load(open("gameVersions.json", "r")).keys()))
diff --git a/publish/update_updatejson.py b/publish/update_updatejson.py
index d9af683..02a1fe7 100644
--- a/publish/update_updatejson.py
+++ b/publish/update_updatejson.py
@@ -22,4 +22,4 @@ json.dump(data, open(jsonPath, "w", encoding="utf8"), indent=2)
subprocess.run(["git", "add", jsonPath])
subprocess.run(["git", "commit", "-m", "[skip ci] Update update json"])
-subprocess.run(["git", "push"]) \ No newline at end of file
+subprocess.run(["git", "push"])