-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
sbt-version-policy/sbt-version-policy/src/main/scala/sbtversionpolicy/Compatibility.scala
Lines 63 to 85 in 323d010
| /** | |
| * Validates that the given new `version` matches the claimed `compatibility` level. | |
| * @return Some validation error, or None if the version is valid. | |
| */ | |
| def isValidVersion(compatibility: Compatibility, version: String): Boolean = { | |
| val versionNumber = VersionNumber(version) | |
| val major = versionNumber._1 | |
| val minor = versionNumber._2 | |
| val patch = versionNumber._3 | |
| compatibility match { | |
| case Compatibility.None => | |
| // No compatibility is guaranteed: the major version must be incremented (or the minor version, if major is 0) | |
| if (major.contains(0)) patch.contains(0) // minor version bump | |
| else minor.contains(0) && patch.contains(0) // major version bump | |
| case Compatibility.BinaryCompatible => | |
| // No source compatibility is guaranteed, the minor version must be incremented (or the patch version, if major is 0) | |
| if (major.contains(0)) true // always OK | |
| else patch.contains(0) // minor version bump | |
| case Compatibility.BinaryAndSourceCompatible => | |
| // OK, the version can be set to whatever | |
| true | |
| } | |
| } |
It should either support other versionSchemes or fail if it's not early-semver.
Metadata
Metadata
Assignees
Labels
No labels