mirror of https://github.com/sbt/sbt.git
Merge pull request #140 from eed3si9n/wip/apifix
Fixes sbtApiVersion logic
This commit is contained in:
commit
87f7fcbe51
|
|
@ -36,10 +36,13 @@ object CrossVersionUtil {
|
|||
* Compatible versions include 0.12.0-1 and 0.12.0-RC1 for Some(0, 12).
|
||||
*/
|
||||
private[sbt] def sbtApiVersion(v: String): Option[(Long, Long)] = v match {
|
||||
case ReleaseV(x, y, _, _) => Some(sbtApiVersion(x.toLong, y.toLong))
|
||||
case CandidateV(x, y, _, _) => Some(sbtApiVersion(x.toLong, y.toLong))
|
||||
case NonReleaseV_n(x, y, z, _) if z.toInt > 0 => Some(sbtApiVersion(x.toLong, y.toLong))
|
||||
case _ => None
|
||||
case ReleaseV(x, y, _, _) => Some(sbtApiVersion(x.toLong, y.toLong))
|
||||
case CandidateV(x, y, _, _) => Some(sbtApiVersion(x.toLong, y.toLong))
|
||||
case NonReleaseV_n(x, y, z, _) if x.toLong == 0 && z.toLong > 0 =>
|
||||
Some(sbtApiVersion(x.toLong, y.toLong))
|
||||
case NonReleaseV_n(x, y, z, _) if x.toLong > 0 && (y.toLong > 0 || z.toLong > 0) =>
|
||||
Some(sbtApiVersion(x.toLong, y.toLong))
|
||||
case _ => None
|
||||
}
|
||||
|
||||
private def sbtApiVersion(x: Long, y: Long) = {
|
||||
|
|
|
|||
|
|
@ -135,6 +135,9 @@ class CrossVersionTest extends UnitSpec {
|
|||
it should "for 1.3.0 return 1.0" in {
|
||||
binarySbtVersion("1.3.0") shouldBe "1.0"
|
||||
}
|
||||
it should "for 1.3.0-SNAPSHOT return 1.0" in {
|
||||
binarySbtVersion("1.3.0-SNAPSHOT") shouldBe "1.0"
|
||||
}
|
||||
it should "for 1.10.0 return 1.0" in {
|
||||
binarySbtVersion("1.10.0") shouldBe "1.0"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue