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: m framework-minus-apex-headers
Bug: 289776578
Ignore-AOSP-First: Change stacked with changes in internal repos

Change-Id: If8b4033462d39c689cba0ed38cc343e4786ea280
This commit is contained in:
Mark White
2023-08-10 00:07:40 +00:00
parent e80bcaeeb3
commit c9b16799b5
6 changed files with 90 additions and 0 deletions

View File

@@ -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)
}