mirror of https://github.com/sbt/sbt.git
Merge pull request #437 from eed3si9n/wip/binary_sbt_version
Use 2 for binarySbtVersion in 2.x
This commit is contained in:
commit
671748362e
|
|
@ -55,11 +55,12 @@ def commonSettings: Seq[Setting[_]] = Def.settings(
|
|||
scalacOptions := {
|
||||
val old = scalacOptions.value
|
||||
scalaVersion.value match {
|
||||
case sv if sv.startsWith("2.10") =>
|
||||
old diff List("-Xfuture", "-Ywarn-unused", "-Ywarn-unused-import")
|
||||
case sv if sv.startsWith("2.11") => old ++ List("-Ywarn-unused", "-Ywarn-unused-import")
|
||||
case sv if sv.startsWith("2.12") =>
|
||||
old ++ List("-Ywarn-unused", "-Ywarn-unused-import", "-YdisableFlatCpCaching")
|
||||
old ++ List(
|
||||
"-Ywarn-unused",
|
||||
"-Ywarn-unused-import",
|
||||
"-Ywarn-unused:-nowarn",
|
||||
)
|
||||
case _ => old
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -117,7 +117,13 @@ object CrossVersionUtil {
|
|||
}
|
||||
|
||||
def binarySbtVersion(full: String): String =
|
||||
binaryVersionWithApi(full, TransitionSbtVersion)(sbtApiVersion)
|
||||
sbtApiVersion(full) match {
|
||||
case Some((0, minor)) if minor < 12 => full
|
||||
case Some((0, minor)) => s"0.$minor"
|
||||
case Some((1, minor)) => s"1.$minor"
|
||||
case Some((major, _)) => major.toString
|
||||
case _ => full
|
||||
}
|
||||
|
||||
private[this] def isNewer(major: Long, minor: Long, minMajor: Long, minMinor: Long): Boolean =
|
||||
major > minMajor || (major == minMajor && minor >= minMinor)
|
||||
|
|
|
|||
|
|
@ -96,23 +96,23 @@ class CrossVersionTest extends UnitSpec {
|
|||
"binarySbtVersion" should "for 0.11.3 return 0.11.3" in {
|
||||
binarySbtVersion("0.11.3") shouldBe "0.11.3"
|
||||
}
|
||||
it should "for 0.12.0-M1 return 0.12.0-M1" in {
|
||||
binarySbtVersion("0.12.0-M1") shouldBe "0.12.0-M1"
|
||||
it should "for 2.0.0 return 2" in {
|
||||
binarySbtVersion("2.0.0") shouldBe "2"
|
||||
}
|
||||
it should "for 0.12.0-RC1 return 0.12" in {
|
||||
binarySbtVersion("0.12.0-RC1") shouldBe "0.12"
|
||||
it should "for 2.0.0-M1 return 2.0.0-M1" in {
|
||||
binarySbtVersion("2.0.0-M1") shouldBe "2.0.0-M1"
|
||||
}
|
||||
it should "for 0.12.0 return 0.12" in {
|
||||
binarySbtVersion("0.12.0") shouldBe "0.12"
|
||||
it should "for 2.0.0-RC1 return 2" in {
|
||||
binarySbtVersion("2.0.0-RC1") shouldBe "2"
|
||||
}
|
||||
it should "for 0.12.1-SNAPSHOT return 0.12" in {
|
||||
binarySbtVersion("0.12.1-SNAPSHOT") shouldBe "0.12"
|
||||
it should "for 2.1.0-M1 return 2" in {
|
||||
binarySbtVersion("2.1.0-M1") shouldBe "2"
|
||||
}
|
||||
it should "for 0.12.1-RC1 return 0.12" in {
|
||||
binarySbtVersion("0.12.1-RC1") shouldBe "0.12"
|
||||
it should "for 2.1.0 return 2" in {
|
||||
binarySbtVersion("2.1.0") shouldBe "2"
|
||||
}
|
||||
it should "for 0.12.1 return 0.12" in {
|
||||
binarySbtVersion("0.12.1") shouldBe "0.12"
|
||||
it should "for 0.13.1 return 0.13" in {
|
||||
binarySbtVersion("0.13.1") shouldBe "0.13"
|
||||
}
|
||||
it should "for 1.0.0-M6 return 1.0.0-M6" in {
|
||||
binarySbtVersion("1.0.0-M6") shouldBe "1.0.0-M6"
|
||||
|
|
@ -144,9 +144,6 @@ class CrossVersionTest extends UnitSpec {
|
|||
it should "for 1.10.0 return 1.0" in {
|
||||
binarySbtVersion("1.10.0") shouldBe "1.0"
|
||||
}
|
||||
it should "for 2.0.0 return 2.0" in {
|
||||
binarySbtVersion("2.0.0") shouldBe "2.0"
|
||||
}
|
||||
|
||||
"scalaApiVersion" should "for xyz return None" in {
|
||||
scalaApiVersion("xyz") shouldBe None
|
||||
|
|
|
|||
Loading…
Reference in New Issue