Revert^2 "Add sdk mutator for native modules"

f8e80229fe

Change-Id: Ic30ab6b844684bfc3e8ece5a1913980d5fbf8de2
This commit is contained in:
Colin Cross
2020-04-07 16:50:32 +00:00
parent f8e80229fe
commit c511bc50dc
21 changed files with 401 additions and 18 deletions

View File

@@ -249,6 +249,50 @@ var neverallowTests = []struct {
}`),
},
},
// CC sdk rule tests
{
name: `"sdk_variant_only" outside whitelist`,
fs: map[string][]byte{
"Android.bp": []byte(`
cc_library {
name: "outside_whitelist",
sdk_version: "current",
sdk_variant_only: true,
}`),
},
expectedErrors: []string{
`module "outside_whitelist": violates neverallow`,
},
},
{
name: `"sdk_variant_only: false" outside whitelist`,
fs: map[string][]byte{
"Android.bp": []byte(`
cc_library {
name: "outside_whitelist",
sdk_version: "current",
sdk_variant_only: false,
}`),
},
expectedErrors: []string{
`module "outside_whitelist": violates neverallow`,
},
},
{
name: `"platform" outside whitelist`,
fs: map[string][]byte{
"Android.bp": []byte(`
cc_library {
name: "outside_whitelist",
platform: {
shared_libs: ["libfoo"],
},
}`),
},
expectedErrors: []string{
`module "outside_whitelist": violates neverallow`,
},
},
}
func TestNeverallow(t *testing.T) {
@@ -289,6 +333,8 @@ type mockCcLibraryProperties struct {
Include_dirs []string
Vendor_available *bool
Static_libs []string
Sdk_version *string
Sdk_variant_only *bool
Vndk struct {
Enabled *bool
@@ -305,6 +351,10 @@ type mockCcLibraryProperties struct {
Cflags []string
}
}
Platform struct {
Shared_libs []string
}
}
type mockCcLibraryModule struct {