Remove "apex_uses" mutator am: 74f576de58
am: 1ff456f5de
am: 7126f7958d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498491 Change-Id: Ie3ee836923bb65fb7172a7ca5a0102a0e16965e1
This commit is contained in:
commit
920ce56b99
2 changed files with 0 additions and 170 deletions
43
apex/apex.go
43
apex/apex.go
|
@ -63,7 +63,6 @@ var (
|
|||
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 @@ func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
|
|||
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 apexFlattenedMutator(mctx android.BottomUpMutatorContext) {
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ type apexBundleProperties struct {
|
|||
|
||||
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 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
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 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
// 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
|
||||
|
|
|
@ -149,10 +149,8 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr
|
|||
"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 @@ func TestInstallExtraFlattenedApexes(t *testing.T) {
|
|||
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 {
|
||||
|
|
Loading…
Reference in a new issue