java_library support for building headers-only
Flag for java_library modules to build just the Turbine headers and
skip building an impl jar.
Test: go test java
Bug: 289776578
Change-Id: Iad0babf951710476bc32df93c25d17065a14ab84
diff --git a/java/java_test.go b/java/java_test.go
index 6110e21..27933c3 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2370,3 +2370,21 @@
t.Errorf("Module output does not contain expected jar %s", "test.jar")
}
}
+
+func TestHeadersOnly(t *testing.T) {
+ ctx, _ := testJava(t, `
+ java_library {
+ name: "foo",
+ srcs: ["a.java"],
+ headers_only: true,
+ }
+ `)
+
+ turbine := ctx.ModuleForTests("foo", "android_common").Rule("turbine")
+ if len(turbine.Inputs) != 1 || turbine.Inputs[0].String() != "a.java" {
+ t.Errorf(`foo inputs %v != ["a.java"]`, turbine.Inputs)
+ }
+
+ javac := ctx.ModuleForTests("foo", "android_common").MaybeRule("javac")
+ android.AssertDeepEquals(t, "javac rule", nil, javac.Rule)
+}