Support Turbine in Soong.
If sdk jars(android_stubs_current, etc) are compiled using soong java
modules, we have to filter them when running Java build with Turbine.
TODO: provide more unit-tests.
Test: m clean && m -j32; go test java_test
Change-Id: Iad7c241b0e8b0ca760950733f513124b56c84564
diff --git a/java/java_test.go b/java/java_test.go
index 6dde938..bf83983 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -141,8 +141,11 @@
return name
case strings.HasSuffix(name, ".jar"):
return name
- default:
+ case name == "android_stubs_current" || name == "android_system_stubs_current" ||
+ name == "android_test_stubs_current":
return filepath.Join(buildDir, ".intermediates", name, "android_common", "javac", name+".jar")
+ default:
+ return filepath.Join(buildDir, ".intermediates", name, "android_common", "turbine-combined", name+".jar")
}
}
@@ -167,21 +170,22 @@
`)
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
- combineJar := ctx.ModuleForTests("foo", "android_common").Rule("combineJar")
+ combineJar := ctx.ModuleForTests("foo", "android_common").Description("for javac")
if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "a.java" {
t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
}
- bar := ctx.ModuleForTests("bar", "android_common").Rule("javac").Output.String()
baz := ctx.ModuleForTests("baz", "android_common").Rule("javac").Output.String()
+ barTurbine := filepath.Join(buildDir, ".intermediates", "bar", "android_common", "turbine-combined", "bar.jar")
+ bazTurbine := filepath.Join(buildDir, ".intermediates", "baz", "android_common", "turbine-combined", "baz.jar")
- if !strings.Contains(javac.Args["classpath"], bar) {
- t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], bar)
+ if !strings.Contains(javac.Args["classpath"], barTurbine) {
+ t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], barTurbine)
}
- if !strings.Contains(javac.Args["classpath"], baz) {
- t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], baz)
+ if !strings.Contains(javac.Args["classpath"], bazTurbine) {
+ t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], bazTurbine)
}
if len(combineJar.Inputs) != 2 || combineJar.Inputs[1].String() != baz {
@@ -421,7 +425,7 @@
`)
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
- combineJar := ctx.ModuleForTests("foo", "android_common").Rule("combineJar")
+ combineJar := ctx.ModuleForTests("foo", "android_common").Description("for javac")
bar := "a.jar"
if !strings.Contains(javac.Args["classpath"], bar) {
@@ -459,15 +463,15 @@
`)
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
- combineJar := ctx.ModuleForTests("foo", "android_common").Rule("combineJar")
+ combineJar := ctx.ModuleForTests("foo", "android_common").Description("for javac")
if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "a.java" {
t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
}
- bar := ctx.ModuleForTests("bar", "android_common").Rule("javac").Output.String()
- if !strings.Contains(javac.Args["classpath"], bar) {
- t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], bar)
+ barTurbine := filepath.Join(buildDir, ".intermediates", "bar", "android_common", "turbine-combined", "bar.jar")
+ if !strings.Contains(javac.Args["classpath"], barTurbine) {
+ t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], barTurbine)
}
baz := ctx.ModuleForTests("baz", "android_common").Rule("javac").Output.String()