Introduce "Exclude_static_libs" property for Java modules

Exclude_static_libs property can be used to specify static libs that
should not be used to build the module. The list acts as filter for
static_libs.

Bug: 285410821
Test: go test ./java
Change-Id: Iee7f160ba88b5f64bdd265c30d47c9f51feb0f5e
This commit is contained in:
Jihoon Kang
2023-06-01 22:17:32 +00:00
parent f508c252bb
commit 381c2fa27c
4 changed files with 66 additions and 3 deletions

View File

@@ -344,6 +344,23 @@ var neverallowTests = []struct {
`module "outside_allowed_list": violates neverallow`,
},
},
// Test for the rule restricting use of exclude_static_libs
{
name: `"exclude_static_libs" outside allowed directory`,
fs: map[string][]byte{
"a/b/Android.bp": []byte(`
java_library {
name: "baz",
exclude_static_libs: [
"bar",
],
}
`),
},
expectedErrors: []string{
`exclude_static_libs property is only allowed for java modules defined in build/soong`,
},
},
}
var prepareForNeverAllowTest = GroupFixturePreparers(
@@ -430,9 +447,10 @@ func (p *mockCcLibraryModule) GenerateAndroidBuildActions(ModuleContext) {
}
type mockJavaLibraryProperties struct {
Libs []string
Sdk_version *string
Uncompress_dex *bool
Libs []string
Sdk_version *string
Uncompress_dex *bool
Exclude_static_libs []string
}
type mockJavaLibraryModule struct {