apex: remove use_vendor

Should manually cut dependencies instead. Previously, this was used to
take advantage of the limited dependencies of variant libs in some APEXes.

Fixes: 175318864
Test: m nothing
Change-Id: Id559fd1bea5c8b8696cf7ab8acc711a7c3844d14
This commit is contained in:
Steven Moreland
2021-04-27 02:08:49 +00:00
parent 47b2cba405
commit 2c4000c7a6
3 changed files with 7 additions and 216 deletions

View File

@@ -1326,7 +1326,6 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
apex {
name: "myapex",
key: "myapex.key",
use_vendor: true,
native_shared_libs: ["mylib"],
updatable: false,
`+tc.minSdkVersion+`
@@ -1363,7 +1362,6 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
symbol_file: "",
}
`,
setUseVendorAllowListForTest([]string{"myapex"}),
withUnbundledBuild,
)
@@ -1377,13 +1375,13 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
ensureListEmpty(t, names(apexManifestRule.Args["provideNativeLibs"]))
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libbar.so")
mylibLdFlags := ctx.ModuleForTests("mylib", "android_vendor.29_arm64_armv8-a_shared_"+tc.apexVariant).Rule("ld").Args["libFlags"]
ensureContains(t, mylibLdFlags, "libbar/android_vendor.29_arm64_armv8-a_shared_"+tc.shouldLink+"/libbar.so")
mylibLdFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_shared_"+tc.apexVariant).Rule("ld").Args["libFlags"]
ensureContains(t, mylibLdFlags, "libbar/android_arm64_armv8-a_shared_"+tc.shouldLink+"/libbar.so")
for _, ver := range tc.shouldNotLink {
ensureNotContains(t, mylibLdFlags, "libbar/android_vendor.29_arm64_armv8-a_shared_"+ver+"/libbar.so")
ensureNotContains(t, mylibLdFlags, "libbar/android_arm64_armv8-a_shared_"+ver+"/libbar.so")
}
mylibCFlags := ctx.ModuleForTests("mylib", "android_vendor.29_arm64_armv8-a_static_"+tc.apexVariant).Rule("cc").Args["cFlags"]
mylibCFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static_"+tc.apexVariant).Rule("cc").Args["cFlags"]
ver := tc.shouldLink
if tc.shouldLink == "current" {
ver = strconv.Itoa(android.FutureApiLevelInt)
@@ -2375,119 +2373,6 @@ func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {
})
}
func TestUseVendor(t *testing.T) {
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
native_shared_libs: ["mylib"],
use_vendor: true,
updatable: false,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "mylib",
srcs: ["mylib.cpp"],
shared_libs: ["mylib2"],
system_shared_libs: [],
vendor_available: true,
stl: "none",
apex_available: [ "myapex" ],
}
cc_library {
name: "mylib2",
srcs: ["mylib.cpp"],
system_shared_libs: [],
vendor_available: true,
stl: "none",
apex_available: [ "myapex" ],
}
`,
setUseVendorAllowListForTest([]string{"myapex"}),
)
inputsList := []string{}
for _, i := range ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().BuildParamsForTests() {
for _, implicit := range i.Implicits {
inputsList = append(inputsList, implicit.String())
}
}
inputsString := strings.Join(inputsList, " ")
// ensure that the apex includes vendor variants of the direct and indirect deps
ensureContains(t, inputsString, "android_vendor.29_arm64_armv8-a_shared_apex10000/mylib.so")
ensureContains(t, inputsString, "android_vendor.29_arm64_armv8-a_shared_apex10000/mylib2.so")
// ensure that the apex does not include core variants
ensureNotContains(t, inputsString, "android_arm64_armv8-a_shared_apex10000/mylib.so")
ensureNotContains(t, inputsString, "android_arm64_armv8-a_shared_apex10000/mylib2.so")
}
func TestUseVendorNotAllowedForSystemApexes(t *testing.T) {
testApexError(t, `module "myapex" .*: use_vendor: not allowed`, `
apex {
name: "myapex",
key: "myapex.key",
use_vendor: true,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
`,
setUseVendorAllowListForTest([]string{""}),
)
// no error with allow list
testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
use_vendor: true,
updatable: false,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
`,
setUseVendorAllowListForTest([]string{"myapex"}),
)
}
func TestUseVendorFailsIfNotVendorAvailable(t *testing.T) {
testApexError(t, `dependency "mylib" of "myapex" missing variant:\n.*image:vendor`, `
apex {
name: "myapex",
key: "myapex.key",
native_shared_libs: ["mylib"],
use_vendor: true,
updatable: false,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "mylib",
srcs: ["mylib.cpp"],
system_shared_libs: [],
stl: "none",
}
`)
}
func TestVendorApex(t *testing.T) {
ctx := testApex(t, `
apex {
@@ -2662,41 +2547,6 @@ func TestApex_withPrebuiltFirmware(t *testing.T) {
}
}
func TestAndroidMk_UseVendorRequired(t *testing.T) {
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
use_vendor: true,
native_shared_libs: ["mylib"],
updatable: false,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "mylib",
vendor_available: true,
apex_available: ["myapex"],
}
`,
setUseVendorAllowListForTest([]string{"myapex"}),
)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
var builder strings.Builder
data.Custom(&builder, name, prefix, "", data)
androidMk := builder.String()
ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += libc libm libdl\n")
}
func TestAndroidMk_VendorApexRequired(t *testing.T) {
ctx := testApex(t, `
apex {