Skip to content

Commit 2881356

Browse files
committed
More nightly build number shenanigans
1 parent fd8e1b5 commit 2881356

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

build.gradle

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,22 @@ apply plugin: "net.minecraftforge.gradle"
2121
def semver = 'git describe --tags --match v*'.execute().text.trim().split('-')[0]
2222
def gitCommitHash = 'git rev-parse --verify --short HEAD'.execute().text.trim()
2323

24-
def nightlyVersion = "${semver}-nightly.${"git describe --tags --match ${semver}*".execute().text.trim().split('-')[1]}+${gitCommitHash}"
24+
def buildNumber = { ->
25+
try {
26+
def code = new ByteArrayOutputStream()
27+
exec {
28+
commandLine 'git', 'describe', '--tags', '--match', 'v*'
29+
standardOutput = code
30+
}
31+
32+
return Integer.parseInt(code.toString().trim().split('-')[1])
33+
}
34+
catch (ignored) {
35+
return 0;
36+
}
37+
}
38+
39+
def nightlyVersion = "${semver}-nightly.${buildNumber}-${gitCommitHash}"
2540
def isRelease = (System.getenv("CM_RELEASE") ?: "false").equalsIgnoreCase("true")
2641

2742
task getBuildInfo() {

0 commit comments

Comments
 (0)