From a15790ac1e0703cd910c21cfd2322b8a61a3b559 Mon Sep 17 00:00:00 2001 From: Mark White Date: Tue, 22 Aug 2023 21:28:11 +0000 Subject: 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 --- java/java_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'java/java_test.go') 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) +} -- cgit v1.2.3-59-g8ed1b