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
This commit is contained in:
Mark White
2023-08-22 21:28:11 +00:00
parent f5ee8e3ffc
commit a15790ac1e
6 changed files with 90 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ func init() {
AddNeverAllowRules(createBp2BuildRule())
AddNeverAllowRules(createCcStubsRule())
AddNeverAllowRules(createJavaExcludeStaticLibsRule())
AddNeverAllowRules(createProhibitHeaderOnlyRule())
}
// Add a NeverAllow rule to the set of rules to apply.
@@ -264,6 +265,13 @@ func createJavaExcludeStaticLibsRule() Rule {
Because("exclude_static_libs property is only allowed for java modules defined in build/soong, libcore, and frameworks/base/api")
}
func createProhibitHeaderOnlyRule() Rule {
return NeverAllow().
Without("name", "framework-minus-apex-headers").
With("headers_only", "true").
Because("headers_only can only be used for generating framework-minus-apex headers for non-updatable modules")
}
func neverallowMutator(ctx BottomUpMutatorContext) {
m, ok := ctx.Module().(Module)
if !ok {