Merge pull request #3370 from eed3si9n/wip/crossfix

[sbt 0.13] Fix ^^ and don't inject scalaVersion by default
This commit is contained in:
Dale Wijnand 2017-07-26 08:48:33 +01:00 committed by GitHub
commit 2952a2b9b6
5 changed files with 25 additions and 6 deletions

View File

@ -2,7 +2,8 @@ package sbt
import scala.annotation.Annotation
/** An annotation to designate that the annotated entity
/**
* An annotation to designate that the annotated entity
* should not be considered for additional sbt compiler checks.
* These checks ensure that the DSL is predictable and prevents
* users from doing dangerous things at the cost of a stricter

View File

@ -244,7 +244,6 @@ object Defaults extends BuildCommon {
sbt.inc.ClassfileManager.transactional(crossTarget.value / "classes.bak", sbt.Logger.Null)),
scalaInstance := scalaInstanceTask.value,
crossVersion := (if (crossPaths.value) CrossVersion.binary else CrossVersion.Disabled),
scalaVersion := PluginCross.scalaVersionSetting.value,
sbtBinaryVersion in pluginCrossBuild := binarySbtVersion((sbtVersion in pluginCrossBuild).value),
crossSbtVersions := Vector((sbtVersion in pluginCrossBuild).value),
crossTarget := makeCrossTarget(target.value,

View File

@ -41,9 +41,10 @@ private[sbt] object PluginCross {
import x._
state.log.info(s"Setting `sbtVersion in pluginCrossBuild` to $version")
val add = List(sbtVersion in GlobalScope in pluginCrossBuild :== version) ++
inConfig(Compile)(List(scalaVersion := scalaVersionSetting.value)) ++
inConfig(Test)(List(scalaVersion := scalaVersionSetting.value))
List(scalaVersion := scalaVersionSetting.value) ++
inScope(GlobalScope.copy(project = Select(currentRef)))(Seq(
scalaVersion := scalaVersionSetting.value
))
val cleared = session.mergeSettings.filterNot(crossExclude)
val newStructure = Load.reapply(cleared ++ add, structure)
Project.setProject(session, newStructure, command :: state)

View File

@ -1,5 +1,9 @@
val baseSbt = "0.13"
val buildCrossList = List("2.10.6", "2.11.11", "2.12.2")
scalaVersion in ThisBuild := "2.10.6"
crossScalaVersions in ThisBuild := buildCrossList
lazy val root = (project in file("."))
.settings(
sbtPlugin := true,
@ -11,6 +15,12 @@ lazy val root = (project in file("."))
assert(sv == "2.10", s"Wrong e:scalaVersion: $sv")
assert(scalaBinaryVersion.value == "2.10", s"Wrong Scala binary version: ${scalaBinaryVersion.value}")
assert(crossV startsWith "0.13", s"Wrong `sbtVersion in pluginCrossBuild`: $crossV")
// crossScalaVersions in app should not be affected
val appCrossScalaVersions = (crossScalaVersions in app).value.toList
val appScalaVersion = (scalaVersion in app).value
assert(appCrossScalaVersions == buildCrossList, s"Wrong `crossScalaVersions in app`: $appCrossScalaVersions")
assert(appScalaVersion startsWith "2.10", s"Wrong `scalaVersion in app`: $appScalaVersion")
},
TaskKey[Unit]("check2") := {
@ -20,5 +30,13 @@ lazy val root = (project in file("."))
assert(sv == "2.12", s"Wrong e:scalaVersion: $sv")
assert(scalaBinaryVersion.value == "2.12", s"Wrong Scala binary version: ${scalaBinaryVersion.value}")
assert(crossV startsWith "1.0.", s"Wrong `sbtVersion in pluginCrossBuild`: $crossV")
// ^^ should not affect app's crossScalaVersions
val appCrossScalaVersions = (crossScalaVersions in app).value.toList
val appScalaVersion = (scalaVersion in app).value
assert(appCrossScalaVersions == buildCrossList, s"Wrong `crossScalaVersions in app`: $appCrossScalaVersions")
assert(appScalaVersion startsWith "2.10", s"Wrong `scalaVersion in app`: $appScalaVersion")
}
)
lazy val app = (project in file("app"))

View File

@ -1,5 +1,5 @@
> check
> ^^ 1.0.0-M5
> ^^ 1.0.0-RC2
> check2