mirror of https://github.com/sbt/sbt.git
Add shadow tests for CompositeProjects
This commit is contained in:
parent
cbb953279c
commit
25bbc5f488
|
|
@ -1,8 +1,10 @@
|
|||
import sbt.internal.AddSettings
|
||||
import sbt.CompositeProject
|
||||
|
||||
lazy val check = taskKey[Unit]("check")
|
||||
|
||||
// Based on sbt-file-projects test
|
||||
val cross = new CompositeProject
|
||||
lazy val cross = new CompositeProject
|
||||
{
|
||||
val p1 = Project.apply("a", new File("a"))
|
||||
val p2 = Project.apply("b", new File("b"))
|
||||
|
|
@ -11,3 +13,12 @@ val cross = new CompositeProject
|
|||
|
||||
val g = taskKey[Unit]("A task in the root project")
|
||||
g := println("Hello.")
|
||||
|
||||
|
||||
check := {
|
||||
val verP1 = (version in cross.p1).?.value
|
||||
assert (verP1 == Some("0.1.0-SNAPSHOT"))
|
||||
|
||||
val verP2 = (version in cross.p2).?.value
|
||||
assert (verP2 == Some("0.1.0-SNAPSHOT"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
import sbt.internal.AddSettings
|
||||
import sbt.CompositeProject
|
||||
|
||||
lazy val check = taskKey[Unit]("check")
|
||||
|
||||
lazy val a = (project in file("a"))
|
||||
.settings(
|
||||
version := "0.2.0"
|
||||
)
|
||||
|
||||
// Based on sbt-file-projects test
|
||||
lazy val cross = new CompositeProject
|
||||
{
|
||||
val p1 = Project.apply("a", new File("a"))
|
||||
val p2 = Project.apply("b", new File("b"))
|
||||
def componentProjects: Seq[Project] = Seq(p1, p2)
|
||||
}
|
||||
|
||||
lazy val b = (project in file("b"))
|
||||
.settings(
|
||||
version := "0.2.0"
|
||||
)
|
||||
|
||||
val g = taskKey[Unit]("A task in the root project")
|
||||
g := println("Hello.")
|
||||
|
||||
|
||||
check := {
|
||||
val verP1 = (version in cross.p1).?.value
|
||||
assert (verP1 == Some("0.2.0"))//Some("0.1.0-SNAPSHOT"))
|
||||
|
||||
val verP2 = (version in cross.p2).?.value
|
||||
assert (verP2 == Some("0.1.0-SNAPSHOT"))
|
||||
|
||||
val verA = (version in a).?.value
|
||||
assert (verA == Some("0.2.0"))
|
||||
|
||||
val verB = (version in b).?.value
|
||||
assert (verA == Some("0.2.0"))
|
||||
}
|
||||
|
|
@ -15,3 +15,8 @@ $ copy-file changes/basic.sbt basic.sbt
|
|||
> b/compile
|
||||
> b/h
|
||||
> c/compile
|
||||
> check
|
||||
|
||||
$ copy-file changes/shadow.sbt build.sbt
|
||||
> reload
|
||||
> check
|
||||
|
|
|
|||
Loading…
Reference in New Issue