Skip to content

Commit 45dca0c

Browse files
committed
Update
1 parent c91901b commit 45dca0c

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

build.gradle

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,29 @@ def getCommitNumber = {
5252
}
5353

5454
group = 'org.mangorage'
55-
version = '4.0.' + getGitVersion()
55+
version = getLatestGitTag() + "." + getLatestGitVersion()
5656

57-
def getGitVersion() {
58-
def result = "git rev-list HEAD --count".execute().text.trim()
57+
def getLatestGitTag() {
58+
def result = "git describe --long --tags".execute().text.trim()
5959
if (result.empty) {
6060
throw new RuntimeException("Failed to retrieve commit count")
6161
} else {
62-
def commitCount = result.toInteger()
63-
// Use the commitCount variable further in your script
62+
return result.split("-")[0]
63+
}
64+
}
65+
66+
67+
def getLatestGitVersion() {
68+
def result = "git describe --long --tags".execute().text.trim()
69+
if (result.empty) {
70+
throw new RuntimeException("Failed to retrieve commit count")
71+
} else {
72+
def commitCount = result.split("-")[1].toInteger()
6473
return commitCount;
6574
}
6675
}
6776

77+
6878
configurations {
6979
shadow
7080
}

0 commit comments

Comments
 (0)