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

@@ -361,6 +361,21 @@ var neverallowTests = []struct {
`exclude_static_libs property is only allowed for java modules defined in build/soong, libcore, and frameworks/base/api`,
},
},
// Test for only allowing headers_only for framework-minus-apex-headers
{
name: `"headers_only" outside framework-minus-apex-headers modules`,
fs: map[string][]byte{
"a/b/Android.bp": []byte(`
java_library {
name: "baz",
headers_only: true,
}
`),
},
expectedErrors: []string{
`headers_only can only be used for generating framework-minus-apex headers for non-updatable modules`,
},
},
}
var prepareForNeverAllowTest = GroupFixturePreparers(
@@ -451,6 +466,7 @@ type mockJavaLibraryProperties struct {
Sdk_version *string
Uncompress_dex *bool
Exclude_static_libs []string
Headers_only *bool
}
type mockJavaLibraryModule struct {