Remove "apex_uses" mutator
which was added to support built-time common apex. But the common apex
was abandoned and it is used nowhere.
This is a manual revert of 5c998b9ff8a2571fb929e1e8764d4f10583660b1.
Bug: 173329465
Test: m
Change-Id: I684e6b8bfe2ef5b53943329f4aaa5a5ccba27738
diff --git a/apex/apex.go b/apex/apex.go
index 8268966..91770f4 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -63,7 +63,6 @@
testTag = dependencyTag{name: "test", payload: true}
keyTag = dependencyTag{name: "key"}
certificateTag = dependencyTag{name: "certificate"}
- usesTag = dependencyTag{name: "uses"}
androidAppTag = dependencyTag{name: "androidApp", payload: true}
rroTag = dependencyTag{name: "rro", payload: true}
bpfTag = dependencyTag{name: "bpf", payload: true}
@@ -764,7 +763,6 @@
ctx.BottomUp("apex", apexMutator).Parallel()
ctx.BottomUp("apex_directly_in_any", apexDirectlyInAnyMutator).Parallel()
ctx.BottomUp("apex_flattened", apexFlattenedMutator).Parallel()
- ctx.BottomUp("apex_uses", apexUsesMutator).Parallel()
ctx.BottomUp("mark_platform_availability", markPlatformAvailability).Parallel()
}
@@ -1007,12 +1005,6 @@
}
}
-func apexUsesMutator(mctx android.BottomUpMutatorContext) {
- if ab, ok := mctx.Module().(*apexBundle); ok {
- mctx.AddFarVariationDependencies(nil, usesTag, ab.properties.Uses...)
- }
-}
-
var (
useVendorAllowListKey = android.NewOnceKey("useVendorAllowList")
)
@@ -1132,12 +1124,6 @@
HideFromMake bool `blueprint:"mutated"`
- // Indicates this APEX provides C++ shared libaries to other APEXes. Default: false.
- Provide_cpp_shared_libs *bool
-
- // List of providing APEXes' names so that this APEX can depend on provided shared libraries.
- Uses []string
-
// package format of this apex variant; could be non-flattened, flattened, or zip.
// imageApex, zipApex or flattened
ApexType apexPackaging `blueprint:"mutated"`
@@ -2181,30 +2167,6 @@
var provideNativeLibs []string
var requireNativeLibs []string
- // Check if "uses" requirements are met with dependent apexBundles
- var providedNativeSharedLibs []string
- useVendor := proptools.Bool(a.properties.Use_vendor)
- ctx.VisitDirectDepsBlueprint(func(m blueprint.Module) {
- if ctx.OtherModuleDependencyTag(m) != usesTag {
- return
- }
- otherName := ctx.OtherModuleName(m)
- other, ok := m.(*apexBundle)
- if !ok {
- ctx.PropertyErrorf("uses", "%q is not a provider", otherName)
- return
- }
- if proptools.Bool(other.properties.Use_vendor) != useVendor {
- ctx.PropertyErrorf("use_vendor", "%q has different value of use_vendor", otherName)
- return
- }
- if !proptools.Bool(other.properties.Provide_cpp_shared_libs) {
- ctx.PropertyErrorf("uses", "%q does not provide native_shared_libs", otherName)
- return
- }
- providedNativeSharedLibs = append(providedNativeSharedLibs, other.properties.Native_shared_libs...)
- })
-
var filesInfo []apexFile
// TODO(jiyong) do this using WalkPayloadDeps
ctx.WalkDepsBlueprint(func(child, parent blueprint.Module) bool {
@@ -2352,11 +2314,6 @@
// tags used below are private (e.g. `cc.sharedDepTag`).
if cc.IsSharedDepTag(depTag) || cc.IsRuntimeDepTag(depTag) {
if cc, ok := child.(*cc.Module); ok {
- if android.InList(cc.Name(), providedNativeSharedLibs) {
- // If we're using a shared library which is provided from other APEX,
- // don't include it in this APEX
- return false
- }
if cc.UseVndk() && proptools.Bool(a.properties.Use_vndk_as_stable) && cc.IsVndk() {
requireNativeLibs = append(requireNativeLibs, ":vndk")
return false
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 532a7aa..524549a 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -149,10 +149,8 @@
"system/sepolicy/apex/myapex.updatable-file_contexts": nil,
"system/sepolicy/apex/myapex2-file_contexts": nil,
"system/sepolicy/apex/otherapex-file_contexts": nil,
- "system/sepolicy/apex/commonapex-file_contexts": nil,
"system/sepolicy/apex/com.android.vndk-file_contexts": nil,
"mylib.cpp": nil,
- "mylib_common.cpp": nil,
"mytest.cpp": nil,
"mytest1.cpp": nil,
"mytest2.cpp": nil,
@@ -4202,131 +4200,6 @@
ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += myapex.flattened")
}
-func TestApexUsesOtherApex(t *testing.T) {
- ctx, _ := testApex(t, `
- apex {
- name: "myapex",
- key: "myapex.key",
- native_shared_libs: ["mylib"],
- uses: ["commonapex"],
- }
-
- apex {
- name: "commonapex",
- key: "myapex.key",
- native_shared_libs: ["libcommon"],
- provide_cpp_shared_libs: true,
- }
-
- apex_key {
- name: "myapex.key",
- public_key: "testkey.avbpubkey",
- private_key: "testkey.pem",
- }
-
- cc_library {
- name: "mylib",
- srcs: ["mylib.cpp"],
- shared_libs: ["libcommon"],
- system_shared_libs: [],
- stl: "none",
- apex_available: [ "myapex" ],
- }
-
- cc_library {
- name: "libcommon",
- srcs: ["mylib_common.cpp"],
- system_shared_libs: [],
- stl: "none",
- // TODO: remove //apex_available:platform
- apex_available: [
- "//apex_available:platform",
- "commonapex",
- "myapex",
- ],
- }
- `)
-
- module1 := ctx.ModuleForTests("myapex", "android_common_myapex_image")
- apexRule1 := module1.Rule("apexRule")
- copyCmds1 := apexRule1.Args["copy_commands"]
-
- module2 := ctx.ModuleForTests("commonapex", "android_common_commonapex_image")
- apexRule2 := module2.Rule("apexRule")
- copyCmds2 := apexRule2.Args["copy_commands"]
-
- ensureListContains(t, ctx.ModuleVariantsForTests("mylib"), "android_arm64_armv8-a_shared_apex10000")
- ensureListContains(t, ctx.ModuleVariantsForTests("libcommon"), "android_arm64_armv8-a_shared_apex10000")
- ensureContains(t, copyCmds1, "image.apex/lib64/mylib.so")
- ensureContains(t, copyCmds2, "image.apex/lib64/libcommon.so")
- ensureNotContains(t, copyCmds1, "image.apex/lib64/libcommon.so")
-}
-
-func TestApexUsesFailsIfNotProvided(t *testing.T) {
- testApexError(t, `uses: "commonapex" does not provide native_shared_libs`, `
- apex {
- name: "myapex",
- key: "myapex.key",
- uses: ["commonapex"],
- }
-
- apex {
- name: "commonapex",
- key: "myapex.key",
- }
-
- apex_key {
- name: "myapex.key",
- public_key: "testkey.avbpubkey",
- private_key: "testkey.pem",
- }
- `)
- testApexError(t, `uses: "commonapex" is not a provider`, `
- apex {
- name: "myapex",
- key: "myapex.key",
- uses: ["commonapex"],
- }
-
- cc_library {
- name: "commonapex",
- system_shared_libs: [],
- stl: "none",
- }
-
- apex_key {
- name: "myapex.key",
- public_key: "testkey.avbpubkey",
- private_key: "testkey.pem",
- }
- `)
-}
-
-func TestApexUsesFailsIfUseVenderMismatch(t *testing.T) {
- testApexError(t, `use_vendor: "commonapex" has different value of use_vendor`, `
- apex {
- name: "myapex",
- key: "myapex.key",
- use_vendor: true,
- uses: ["commonapex"],
- }
-
- apex {
- name: "commonapex",
- key: "myapex.key",
- provide_cpp_shared_libs: true,
- }
-
- apex_key {
- name: "myapex.key",
- public_key: "testkey.avbpubkey",
- private_key: "testkey.pem",
- }
- `, func(fs map[string][]byte, config android.Config) {
- setUseVendorAllowListForTest(config, []string{"myapex"})
- })
-}
-
func TestErrorsIfDepsAreNotEnabled(t *testing.T) {
testApexError(t, `module "myapex" .* depends on disabled module "libfoo"`, `
apex {