aboutsummaryrefslogtreecommitdiff
path: root/sbt-bridge/src/sbt-test/source-dependencies/inherited-deps-java/build.sbt
blob: c25b54921b2b6a359e2c0c039e3ab9bb22297afe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// this test is specific to the old incremental compilation algorithm
incOptions := incOptions.value.withNameHashing(false)

lazy val verifyDeps = taskKey[Unit]("verify inherited dependencies are properly extracted")

verifyDeps := {
	val a = compile.in(Compile).value
	same(a.relations.publicInherited.internal.forwardMap, expectedDeps.forwardMap)
}

lazy val expected = Seq(
	"A" -> Seq("C", "D", "E", "G", "J"),
	"B" -> Seq("C", "D", "G", "J"),
	"C" -> Seq("D", "G", "J"),
	"D" -> Seq("G", "J"),
	"E" -> Seq(),
	"F" -> Seq(),
	"G" -> Seq("J"),
	"J" -> Seq()
)
lazy val pairs =
	expected.map { case (from,tos) =>
		(toFile(from), tos.map(toFile))
	}
lazy val expectedDeps = (Relation.empty[File,File] /: pairs) { case (r, (x,ys)) => r + (x,ys) }
def toFile(s: String) = file(s + ".java").getAbsoluteFile

def same[T](x: T, y: T): Unit = {
	assert(x == y, s"\nActual: $x, \nExpected: $y")
}