Allow VNDK extensions under vendor or device

This commit allows VNDK extensions (vndk.enabled:true and vendor:true)
to reside under vendor/* or device/*.  VNDK extensions will be installed
into /vendor/lib[64]/vndk[-sp].  It is reasonable for their source being
under vendor/* or device/*.

Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests
Change-Id: I406c5bef10f5c549371dd978b8ecc16c65a7af4b
This commit is contained in:
Logan Chien
2018-03-12 16:35:58 +08:00
parent ee97c3ed75
commit af29bada75
2 changed files with 30 additions and 2 deletions

View File

@@ -46,9 +46,15 @@ func registerNeverallowMutator(ctx RegisterMutatorsContext) {
} }
var neverallows = []*rule{ var neverallows = []*rule{
neverallow().in("vendor", "device").with("vndk.enabled", "true"). neverallow().
in("vendor", "device").
with("vndk.enabled", "true").
without("vendor", "true").
because("the VNDK can never contain a library that is device dependent."), because("the VNDK can never contain a library that is device dependent."),
neverallow().with("vndk.enabled", "true").without("owner", ""). neverallow().
with("vndk.enabled", "true").
without("vendor", "true").
without("owner", "").
because("a VNDK module can never have an owner."), because("a VNDK module can never have an owner."),
neverallow().notIn("libcore", "development").with("no_standard_libs", "true"), neverallow().notIn("libcore", "development").with("no_standard_libs", "true"),

View File

@@ -53,6 +53,28 @@ var neverallowTests = []struct {
}, },
expectedError: "VNDK can never contain a library that is device dependent", expectedError: "VNDK can never contain a library that is device dependent",
}, },
{
name: "vndk-ext under vendor or device directory",
fs: map[string][]byte{
"device/Blueprints": []byte(`
cc_library {
name: "libvndk1_ext",
vendor: true,
vndk: {
enabled: true,
},
}`),
"vendor/Blueprints": []byte(`
cc_library {
name: "libvndk2_ext",
vendor: true,
vndk: {
enabled: true,
},
}`),
},
expectedError: "",
},
{ {
name: "no enforce_vintf_manifest.cflags", name: "no enforce_vintf_manifest.cflags",