sbt-version-policy
sbt-version-policy copied to clipboard
Shouldn't releaseVersion always be ReleaseVersion.fromCompatibility(BinaryAndSourceCompatible) for sbt-release?
sbt-release
has the setNextVersion
release step which is where we loosly decide what the next version should be. For example, releasing 1.0.0
will set the next version to 1.0.1-SNAPSHOT
. version
is always the next version to release (with a SNAPSHOT
qualifier) which is a requirement for MiMa.
We run versionPolicyCheck
in CI so any PR with breaking changes needs to:
a) set versionPolicyIntention
to something else such as BinaryCompatible
b) and bump the version
such as 1.1.0-SNAPSHOT
Now if we were to run release
in this state then ReleaseVersion.fromCompatibility(versionPolicyIntention.value)
is going to bump the minor again and we will end up releasing 1.2.0
instead of 1.1.0
.
So shouldn't releaseStepTask(setAndCommitNextCompatibilityIntention)
appear before setReleaseVersion
?
Hmm versionPolicyIntention
seems to have double duties. When used in versionPolicyCheck
it need to be BinaryCompatible
to pass check on 1.1.0-SNAPSHOT
. When used in ReleaseVersion.fromCompatibility
it needs to be BinaryAndSourceCompatible
to so that the release is 1.1.0
.
So I guess the issue is not where releaseStepTask(setAndCommitNextCompatibilityIntention)
occurs but rather releaseVersion
should always be ReleaseVersion.fromCompatibility(BinaryAndSourceCompatible)
.
b) and bump the
version
such as1.1.0-SNAPSHOT
Is this really required? Would it be possible to keep the version 1.0.1-SNAPSHOT
until the next release process? Thus, setReleaseVersion
would use ReleaseVersion.fromCompatibility(versionPolicyIntention.value)
and produce version 1.1.0
in your example.
Otherwise, if your workflow needs the version
to be 1.1.0-SNAPSHOT
, then I think you could even use the default releaseVersion
(without using ReleaseVersion.fromCompatibility
at all), no?