Add test for cross + task

Ref https://github.com/sbt/sbt/issues/5497
This commit is contained in:
Eugene Yokota 2020-04-23 22:59:55 -04:00
parent 7a39841ecc
commit 111fe3826e
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,4 @@
lazy val check = taskKey[Unit]("")
lazy val compile2 = taskKey[Unit]("")
lazy val root = (project in file("."))
@ -11,6 +12,13 @@ lazy val foo = project
.settings(
crossScalaVersions := Seq("2.12.11", "2.13.1"),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0",
check := {
// This tests that +check will respect bar's crossScalaVersions and not switch
val x = (LocalProject("bar") / scalaVersion).value
assert(x == "2.12.11", s"$x == 2.12.11")
(Compile / compile).value
},
compile2 := {
// This tests that +build will ignore bar's crossScalaVersions and use root's like sbt 0.13
val x = (LocalProject("bar") / scalaVersion).value
@ -22,11 +30,13 @@ lazy val foo = project
lazy val bar = project
.settings(
crossScalaVersions := Seq("2.12.11"),
check := (Compile / compile).value,
compile2 := (Compile / compile).value,
)
lazy val client = project
.settings(
crossScalaVersions := Seq("2.12.11", "2.13.1"),
check := (Compile / compile).value,
compile2 := (Compile / compile).value,
)

View File

@ -4,6 +4,9 @@
> + foo / testOnly foo.FooSpec
> + testOnly foo.FooSpec
## test + with task in multi-project with different Scala versions
> + check
## test + with command or alias
> clean
## for command cross building you do need crossScalaVerions on root