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> =
9696 isIgnoreExitValue = true
9797 }.standardOutput.asText.map { it.trim() }
9898
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]*) """ )
100100
101101val gitVersion: Provider <String > =
102102 gitDescribe.zip(currentBranchName) { described, branch ->
@@ -108,9 +108,9 @@ val gitVersion: Provider<String> =
108108 val descriptions = described.split(" -" )
109109 val head = descriptions.singleOrNull() ? : " "
110110 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
112112 }
113- }.orElse(currentCommitHash) // fall back to using the git commit hash
113+ }
114114
115115gradle.allprojects {
116116 extensions.add<Provider <String >>(" gitVersion" , gitVersion)
You can’t perform that action at this time.
0 commit comments