File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ val currentCommitHash: Provider<String> =
96
96
isIgnoreExitValue = true
97
97
}.standardOutput.asText.map { it.trim() }
98
98
99
- val semverRegex = Regex (""" v[ 0-9]+\.[ 0-9]+\.[ 0-9]+ """ )
99
+ val semverRegex = Regex (""" v(?:0|[1-9][ 0-9]*)\.(?:0|[1-9][ 0-9]*)\.(?:0|[1-9][ 0-9]*) """ )
100
100
101
101
val gitVersion: Provider <String > =
102
102
gitDescribe.zip(currentBranchName) { described, branch ->
@@ -108,9 +108,9 @@ val gitVersion: Provider<String> =
108
108
val descriptions = described.split(" -" )
109
109
val head = descriptions.singleOrNull() ? : " "
110
110
val headIsVersioned = head.matches(semverRegex)
111
- if (headIsVersioned) head else " $branch -SNAPSHOT "
111
+ if (headIsVersioned) head else currentCommitHash.get() // fall back to using the git commit hash
112
112
}
113
- }.orElse(currentCommitHash) // fall back to using the git commit hash
113
+ }
114
114
115
115
gradle.allprojects {
116
116
extensions.add<Provider <String >>(" gitVersion" , gitVersion)
You can’t perform that action at this time.
0 commit comments