File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,19 +52,29 @@ def getCommitNumber = {
5252}
5353
5454group = ' 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+
6878configurations {
6979 shadow
7080}
You can’t perform that action at this time.
0 commit comments