I've noticed that at some point, as I've been upgrading this awesome release plugin, that it stopped appending -SNAPSHOT when there were local uncommitted changes.
I've scanned the docs, but couldn't find how to reinstate this functionality. Could you point me in the right direction please? The only thing I've got to work so far is this, which is pretty ugly:
scmVersion {
versionCreator { version, _ ->
val hasUncommittedChanges = providers.exec {
commandLine("git", "status", "--porcelain")
}.standardOutput.asText.get().trim().isNotEmpty()
val currentBranch = providers.exec {
commandLine("git", "rev-parse", "--abbrev-ref", "HEAD")
}.standardOutput.asText.get().trim()
if (hasUncommittedChanges) {
val parts = version.split(".")
val major = parts[0].toInt()
val minor = parts[1].toInt()
val patch = parts[2].toInt() + 1
val baseVersion = "${major}.${minor}.${patch}"
if (currentBranch != "main") {
"${baseVersion}-${currentBranch}-SNAPSHOT"
} else {
"${baseVersion}-SNAPSHOT"
}
} else {
version
}
}
}
TBH, I'm a little confused why the default has changed, given I'd assume most users would want a snapshot build when building code that doesn't exactly match the tag...
I've noticed that at some point, as I've been upgrading this awesome release plugin, that it stopped appending
-SNAPSHOTwhen there were local uncommitted changes.I've scanned the docs, but couldn't find how to reinstate this functionality. Could you point me in the right direction please? The only thing I've got to work so far is this, which is pretty ugly:
TBH, I'm a little confused why the default has changed, given I'd assume most users would want a snapshot build when building code that doesn't exactly match the tag...