Add test for command crossing using !

This commit is contained in:
Eugene Yokota 2020-04-23 22:40:58 -04:00
parent 6035bc02ef
commit 7a39841ecc
5 changed files with 49 additions and 21 deletions

View File

@ -0,0 +1,32 @@
lazy val compile2 = taskKey[Unit]("")
lazy val root = (project in file("."))
.aggregate(foo, bar, client)
.settings(
crossScalaVersions := Nil,
addCommandAlias("build", "compile2"),
)
lazy val foo = project
.settings(
crossScalaVersions := Seq("2.12.11", "2.13.1"),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0",
compile2 := {
// This tests that +build will ignore bar's crossScalaVersions and use root's like sbt 0.13
val x = (LocalProject("bar") / scalaVersion).value
assert(x == scalaVersion.value, s"$x == ${scalaVersion.value}")
(Compile / compile).value
},
)
lazy val bar = project
.settings(
crossScalaVersions := Seq("2.12.11"),
compile2 := (Compile / compile).value,
)
lazy val client = project
.settings(
crossScalaVersions := Seq("2.12.11", "2.13.1"),
compile2 := (Compile / compile).value,
)

View File

@ -0,0 +1,17 @@
> + clean
## test input task
> + foo / testOnly foo.FooSpec
> + testOnly foo.FooSpec
## test + with command or alias
> clean
## for command cross building you do need crossScalaVerions on root
> set root/crossScalaVersions := Seq("2.12.11", "2.13.1")
> + build
$ exists foo/target/scala-2.12
$ exists foo/target/scala-2.13
$ exists bar/target/scala-2.12
$ exists bar/target/scala-2.13
$ exists client/target/scala-2.12
$ exists client/target/scala-2.13

View File

@ -1,16 +0,0 @@
lazy val root = (project in file("."))
.aggregate(foo, client)
.settings(
crossScalaVersions := Nil
)
lazy val foo = project
.settings(
crossScalaVersions := Seq("2.12.11", "2.13.1"),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0",
)
lazy val client = project
.settings(
crossScalaVersions := Seq("2.12.11", "2.13.1"),
)

View File

@ -1,5 +0,0 @@
> + clean
> + foo / testOnly foo.FooSpec
> + testOnly foo.FooSpec