Remove no_apex in favor or apex_available
This change reverts following three changes to remove the no_apex property. no_apex: true is equivalent to apex_available: ["//apex_available:platform"]. Revert "fix: "no_apex" can be put in defaults" This reverts commitcc372c5b1d
. Revert "Add no_apex check for static library" This reverts commit2db7f46d0c
. Revert "Add no_apex property" This reverts commit4f7dd9b4db
. Bug: 139870423 Bug: 128708192 Test: m Change-Id: Ia4b094e371e9f8adff94ae6dc3ebb8e081381d4e
This commit is contained in:
23
apex/apex.go
23
apex/apex.go
@@ -149,15 +149,6 @@ var (
|
||||
androidAppTag = dependencyTag{name: "androidApp"}
|
||||
)
|
||||
|
||||
var (
|
||||
whitelistNoApex = map[string][]string{
|
||||
"apex_test_build_features": []string{"libbinder"},
|
||||
"com.android.media.swcodec": []string{"libbinder"},
|
||||
"test_com.android.media.swcodec": []string{"libbinder"},
|
||||
"com.android.vndk": []string{"libbinder"},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
pctx.Import("android/soong/android")
|
||||
pctx.Import("android/soong/java")
|
||||
@@ -1170,10 +1161,6 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
}
|
||||
} else if am.CanHaveApexVariants() && am.IsInstallableToApex() {
|
||||
ctx.ModuleErrorf("unexpected tag %q for indirect dependency %q", depTag, depName)
|
||||
} else if depTag == android.DefaultsDepTag {
|
||||
return false
|
||||
} else if am.NoApex() && !android.InList(depName, whitelistNoApex[ctx.ModuleName()]) {
|
||||
ctx.ModuleErrorf("tries to include no_apex module %s", depName)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1205,16 +1192,6 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
return filesInfo[i].builtFile.String() < filesInfo[j].builtFile.String()
|
||||
})
|
||||
|
||||
// check no_apex modules
|
||||
whitelist := whitelistNoApex[ctx.ModuleName()]
|
||||
for i := range filesInfo {
|
||||
if am, ok := filesInfo[i].module.(android.ApexModule); ok {
|
||||
if am.NoApex() && !android.InList(filesInfo[i].moduleName, whitelist) {
|
||||
ctx.ModuleErrorf("tries to include no_apex module %s", filesInfo[i].moduleName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check apex_available requirements
|
||||
for _, fi := range filesInfo {
|
||||
if am, ok := fi.module.(android.ApexModule); ok {
|
||||
|
@@ -102,9 +102,6 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
||||
ctx.RegisterModuleType("apex_defaults", android.ModuleFactoryAdaptor(defaultsFactory))
|
||||
ctx.RegisterModuleType("prebuilt_apex", android.ModuleFactoryAdaptor(PrebuiltFactory))
|
||||
|
||||
ctx.RegisterModuleType("cc_defaults", android.ModuleFactoryAdaptor(func() android.Module {
|
||||
return cc.DefaultsFactory()
|
||||
}))
|
||||
ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory))
|
||||
ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(cc.LibrarySharedFactory))
|
||||
ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(cc.LibraryHeaderFactory))
|
||||
@@ -2151,200 +2148,6 @@ func TestApexUsesFailsIfUseVenderMismatch(t *testing.T) {
|
||||
`)
|
||||
}
|
||||
|
||||
func TestApexUsesFailsIfUseNoApex(t *testing.T) {
|
||||
// 'no_apex' prevents a module to be included in an apex
|
||||
testApexError(t, `tries to include no_apex module mylib2`, `
|
||||
apex {
|
||||
name: "commonapex",
|
||||
key: "myapex.key",
|
||||
native_shared_libs: ["mylib"],
|
||||
}
|
||||
|
||||
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: [],
|
||||
stl: "none",
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "mylib2",
|
||||
srcs: ["mylib.cpp"],
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
no_apex: true,
|
||||
}
|
||||
`)
|
||||
|
||||
// respect 'no_apex' even with static link
|
||||
testApexError(t, `tries to include no_apex module mylib2`, `
|
||||
apex {
|
||||
name: "commonapex",
|
||||
key: "myapex.key",
|
||||
native_shared_libs: ["mylib"],
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
public_key: "testkey.avbpubkey",
|
||||
private_key: "testkey.pem",
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "mylib",
|
||||
srcs: ["mylib.cpp"],
|
||||
static_libs: ["mylib2"],
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "mylib2",
|
||||
srcs: ["mylib.cpp"],
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
no_apex: true,
|
||||
}
|
||||
`)
|
||||
|
||||
// 'no_apex' can be applied via defaults
|
||||
testApexError(t, `tries to include no_apex module mylib2`, `
|
||||
apex {
|
||||
name: "commonapex",
|
||||
key: "myapex.key",
|
||||
native_shared_libs: ["mylib"],
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
public_key: "testkey.avbpubkey",
|
||||
private_key: "testkey.pem",
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "mylib",
|
||||
srcs: ["mylib.cpp"],
|
||||
static_libs: ["mylib2"],
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "mylib2_defaults",
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
no_apex: true,
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "mylib2",
|
||||
srcs: ["mylib.cpp"],
|
||||
defaults: ["mylib2_defaults"],
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestNoApexWorksWithWhitelist(t *testing.T) {
|
||||
|
||||
testApex(t, `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
native_shared_libs: ["mylib"],
|
||||
}
|
||||
|
||||
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: [],
|
||||
stl: "none",
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "mylib2_defaults",
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
no_apex: true,
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "mylib2",
|
||||
srcs: ["mylib.cpp"],
|
||||
defaults: ["mylib2_defaults"],
|
||||
}
|
||||
`, func(fs map[string][]byte, config android.Config) {
|
||||
whitelistNoApex = map[string][]string{
|
||||
"myapex": []string{"mylib2"},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestNoApexCanBeDependedOnViaStubs(t *testing.T) {
|
||||
ctx, _ := testApex(t, `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
native_shared_libs: ["mylib"],
|
||||
}
|
||||
|
||||
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: [],
|
||||
stl: "none",
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "mylib2",
|
||||
srcs: ["mylib.cpp"],
|
||||
shared_libs: ["mylib3"],
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
stubs: {
|
||||
versions: ["1", "2", "3"],
|
||||
},
|
||||
}
|
||||
|
||||
// this won't be included in "myapex", so 'no_apex' is still valid in this case.
|
||||
cc_library {
|
||||
name: "mylib3",
|
||||
srcs: ["mylib.cpp"],
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
no_apex: true,
|
||||
}
|
||||
`)
|
||||
|
||||
module := ctx.ModuleForTests("myapex", "android_common_myapex")
|
||||
apexRule := module.Rule("apexRule")
|
||||
copyCmds := apexRule.Args["copy_commands"]
|
||||
|
||||
ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
|
||||
ensureNotContains(t, copyCmds, "image.apex/lib64/mylib2.so")
|
||||
ensureNotContains(t, copyCmds, "image.apex/lib64/mylib3.so")
|
||||
}
|
||||
|
||||
func TestErrorsIfDepsAreNotEnabled(t *testing.T) {
|
||||
testApexError(t, `module "myapex" .* depends on disabled module "libfoo"`, `
|
||||
apex {
|
||||
|
Reference in New Issue
Block a user