summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Mark White <anothermark@google.com> 2023-08-22 21:28:11 +0000
committer Mark White <anothermark@google.com> 2023-08-22 21:29:05 +0000
commita15790ac1e0703cd910c21cfd2322b8a61a3b559 (patch)
tree407311e9249de482419f7721a912dfc7c53edae0 /java/java_test.go
parentf5ee8e3ffc406482ec4e82203541573ddc01e483 (diff)
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
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 6110e21cb..27933c3bf 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2370,3 +2370,21 @@ func TestJavaLibraryWithResourcesStem(t *testing.T) {
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)
+}