Delete multitree api imports code
The mutltiree workflow has not been in use for a while. This CL cleans up the code that was added to support multitree. Details - Delete cc_api_library, cc_api_headers, cc_api_variant module types. These module types contain build rules for prebuilt stub .so and .h files - Update the DepsMutator of cc.Module to not create a dependency on a sibling cc_api_* module if it exists. e.g. do not create a dependency on libfoo.apiimports if libfoo is listed in `shared_libs`. - Remove cc_api_library from the stub/impl selection logic for cc modules Test: m nothing --no-skip-soong-tests Test: presbumits Change-Id: Ie194157fb3bbc630f384cdd9b694b0fba6786ded
This commit is contained in:
@@ -15,7 +15,6 @@ bootstrap_go_package {
|
||||
"soong-cc",
|
||||
"soong-filesystem",
|
||||
"soong-java",
|
||||
"soong-multitree",
|
||||
"soong-provenance",
|
||||
"soong-python",
|
||||
"soong-rust",
|
||||
|
@@ -32,7 +32,6 @@ import (
|
||||
prebuilt_etc "android/soong/etc"
|
||||
"android/soong/filesystem"
|
||||
"android/soong/java"
|
||||
"android/soong/multitree"
|
||||
"android/soong/rust"
|
||||
"android/soong/sh"
|
||||
)
|
||||
@@ -438,7 +437,6 @@ type apexBundle struct {
|
||||
android.ModuleBase
|
||||
android.DefaultableModuleBase
|
||||
android.OverridableModuleBase
|
||||
multitree.ExportableModuleBase
|
||||
|
||||
// Properties
|
||||
properties apexBundleProperties
|
||||
@@ -1406,8 +1404,6 @@ func (a *apexBundle) DepIsInSameApex(_ android.BaseModuleContext, _ android.Modu
|
||||
return true
|
||||
}
|
||||
|
||||
var _ multitree.Exportable = (*apexBundle)(nil)
|
||||
|
||||
func (a *apexBundle) Exportable() bool {
|
||||
return true
|
||||
}
|
||||
@@ -2540,7 +2536,6 @@ func newApexBundle() *apexBundle {
|
||||
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
android.InitDefaultableModule(module)
|
||||
android.InitOverridableModule(module, &module.overridableProperties.Overrides)
|
||||
multitree.InitExportableModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
|
@@ -10274,208 +10274,6 @@ func TestUpdatableApexEnforcesAppUpdatability(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestApexBuildsAgainstApiSurfaceStubLibraries(t *testing.T) {
|
||||
bp := `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
native_shared_libs: ["libbaz"],
|
||||
binaries: ["binfoo"],
|
||||
min_sdk_version: "29",
|
||||
}
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
}
|
||||
cc_binary {
|
||||
name: "binfoo",
|
||||
shared_libs: ["libbar", "libbaz", "libqux",],
|
||||
apex_available: ["myapex"],
|
||||
min_sdk_version: "29",
|
||||
recovery_available: false,
|
||||
}
|
||||
cc_library {
|
||||
name: "libbar",
|
||||
srcs: ["libbar.cc"],
|
||||
stubs: {
|
||||
symbol_file: "libbar.map.txt",
|
||||
versions: [
|
||||
"29",
|
||||
],
|
||||
},
|
||||
}
|
||||
cc_library {
|
||||
name: "libbaz",
|
||||
srcs: ["libbaz.cc"],
|
||||
apex_available: ["myapex"],
|
||||
min_sdk_version: "29",
|
||||
stubs: {
|
||||
symbol_file: "libbaz.map.txt",
|
||||
versions: [
|
||||
"29",
|
||||
],
|
||||
},
|
||||
}
|
||||
cc_api_library {
|
||||
name: "libbar",
|
||||
src: "libbar_stub.so",
|
||||
min_sdk_version: "29",
|
||||
variants: ["apex.29"],
|
||||
}
|
||||
cc_api_variant {
|
||||
name: "libbar",
|
||||
variant: "apex",
|
||||
version: "29",
|
||||
src: "libbar_apex_29.so",
|
||||
}
|
||||
cc_api_library {
|
||||
name: "libbaz",
|
||||
src: "libbaz_stub.so",
|
||||
min_sdk_version: "29",
|
||||
variants: ["apex.29"],
|
||||
}
|
||||
cc_api_variant {
|
||||
name: "libbaz",
|
||||
variant: "apex",
|
||||
version: "29",
|
||||
src: "libbaz_apex_29.so",
|
||||
}
|
||||
cc_api_library {
|
||||
name: "libqux",
|
||||
src: "libqux_stub.so",
|
||||
min_sdk_version: "29",
|
||||
variants: ["apex.29"],
|
||||
}
|
||||
cc_api_variant {
|
||||
name: "libqux",
|
||||
variant: "apex",
|
||||
version: "29",
|
||||
src: "libqux_apex_29.so",
|
||||
}
|
||||
api_imports {
|
||||
name: "api_imports",
|
||||
apex_shared_libs: [
|
||||
"libbar",
|
||||
"libbaz",
|
||||
"libqux",
|
||||
],
|
||||
}
|
||||
`
|
||||
result := testApex(t, bp)
|
||||
|
||||
hasDep := func(m android.Module, wantDep android.Module) bool {
|
||||
t.Helper()
|
||||
var found bool
|
||||
result.VisitDirectDeps(m, func(dep blueprint.Module) {
|
||||
if dep == wantDep {
|
||||
found = true
|
||||
}
|
||||
})
|
||||
return found
|
||||
}
|
||||
|
||||
// Library defines stubs and cc_api_library should be used with cc_api_library
|
||||
binfooApexVariant := result.ModuleForTests("binfoo", "android_arm64_armv8-a_apex29").Module()
|
||||
libbarCoreVariant := result.ModuleForTests("libbar", "android_arm64_armv8-a_shared").Module()
|
||||
libbarApiImportCoreVariant := result.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_shared").Module()
|
||||
|
||||
android.AssertBoolEquals(t, "apex variant should link against API surface stub libraries", true, hasDep(binfooApexVariant, libbarApiImportCoreVariant))
|
||||
android.AssertBoolEquals(t, "apex variant should link against original library if exists", true, hasDep(binfooApexVariant, libbarCoreVariant))
|
||||
|
||||
binFooCFlags := result.ModuleForTests("binfoo", "android_arm64_armv8-a_apex29").Rule("ld").Args["libFlags"]
|
||||
android.AssertStringDoesContain(t, "binfoo should link against APEX variant", binFooCFlags, "libbar.apex.29.apiimport.so")
|
||||
android.AssertStringDoesNotContain(t, "binfoo should not link against cc_api_library itself", binFooCFlags, "libbar.apiimport.so")
|
||||
android.AssertStringDoesNotContain(t, "binfoo should not link against original definition", binFooCFlags, "libbar.so")
|
||||
|
||||
// Library defined in the same APEX should be linked with original definition instead of cc_api_library
|
||||
libbazApexVariant := result.ModuleForTests("libbaz", "android_arm64_armv8-a_shared_apex29").Module()
|
||||
libbazApiImportCoreVariant := result.ModuleForTests("libbaz.apiimport", "android_arm64_armv8-a_shared").Module()
|
||||
android.AssertBoolEquals(t, "apex variant should link against API surface stub libraries even from same APEX", true, hasDep(binfooApexVariant, libbazApiImportCoreVariant))
|
||||
android.AssertBoolEquals(t, "apex variant should link against original library if exists", true, hasDep(binfooApexVariant, libbazApexVariant))
|
||||
|
||||
android.AssertStringDoesContain(t, "binfoo should link against APEX variant", binFooCFlags, "libbaz.so")
|
||||
android.AssertStringDoesNotContain(t, "binfoo should not link against cc_api_library itself", binFooCFlags, "libbaz.apiimport.so")
|
||||
android.AssertStringDoesNotContain(t, "binfoo should not link against original definition", binFooCFlags, "libbaz.apex.29.apiimport.so")
|
||||
|
||||
// cc_api_library defined without original library should be linked with cc_api_library
|
||||
libquxApiImportApexVariant := result.ModuleForTests("libqux.apiimport", "android_arm64_armv8-a_shared").Module()
|
||||
android.AssertBoolEquals(t, "apex variant should link against API surface stub libraries even original library definition does not exist", true, hasDep(binfooApexVariant, libquxApiImportApexVariant))
|
||||
android.AssertStringDoesContain(t, "binfoo should link against APEX variant", binFooCFlags, "libqux.apex.29.apiimport.so")
|
||||
}
|
||||
|
||||
func TestPlatformBinaryBuildsAgainstApiSurfaceStubLibraries(t *testing.T) {
|
||||
bp := `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
native_shared_libs: ["libbar"],
|
||||
min_sdk_version: "29",
|
||||
}
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
}
|
||||
cc_binary {
|
||||
name: "binfoo",
|
||||
shared_libs: ["libbar"],
|
||||
recovery_available: false,
|
||||
}
|
||||
cc_library {
|
||||
name: "libbar",
|
||||
srcs: ["libbar.cc"],
|
||||
apex_available: ["myapex"],
|
||||
min_sdk_version: "29",
|
||||
stubs: {
|
||||
symbol_file: "libbar.map.txt",
|
||||
versions: [
|
||||
"29",
|
||||
],
|
||||
},
|
||||
}
|
||||
cc_api_library {
|
||||
name: "libbar",
|
||||
src: "libbar_stub.so",
|
||||
variants: ["apex.29"],
|
||||
}
|
||||
cc_api_variant {
|
||||
name: "libbar",
|
||||
variant: "apex",
|
||||
version: "29",
|
||||
src: "libbar_apex_29.so",
|
||||
}
|
||||
api_imports {
|
||||
name: "api_imports",
|
||||
apex_shared_libs: [
|
||||
"libbar",
|
||||
],
|
||||
}
|
||||
`
|
||||
|
||||
result := testApex(t, bp)
|
||||
|
||||
hasDep := func(m android.Module, wantDep android.Module) bool {
|
||||
t.Helper()
|
||||
var found bool
|
||||
result.VisitDirectDeps(m, func(dep blueprint.Module) {
|
||||
if dep == wantDep {
|
||||
found = true
|
||||
}
|
||||
})
|
||||
return found
|
||||
}
|
||||
|
||||
// Library defines stubs and cc_api_library should be used with cc_api_library
|
||||
binfooApexVariant := result.ModuleForTests("binfoo", "android_arm64_armv8-a").Module()
|
||||
libbarCoreVariant := result.ModuleForTests("libbar", "android_arm64_armv8-a_shared").Module()
|
||||
libbarApiImportCoreVariant := result.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_shared").Module()
|
||||
|
||||
android.AssertBoolEquals(t, "apex variant should link against API surface stub libraries", true, hasDep(binfooApexVariant, libbarApiImportCoreVariant))
|
||||
android.AssertBoolEquals(t, "apex variant should link against original library if exists", true, hasDep(binfooApexVariant, libbarCoreVariant))
|
||||
|
||||
binFooCFlags := result.ModuleForTests("binfoo", "android_arm64_armv8-a").Rule("ld").Args["libFlags"]
|
||||
android.AssertStringDoesContain(t, "binfoo should link against APEX variant", binFooCFlags, "libbar.apex.29.apiimport.so")
|
||||
android.AssertStringDoesNotContain(t, "binfoo should not link against cc_api_library itself", binFooCFlags, "libbar.apiimport.so")
|
||||
android.AssertStringDoesNotContain(t, "binfoo should not link against original definition", binFooCFlags, "libbar.so")
|
||||
}
|
||||
|
||||
func TestTrimmedApex(t *testing.T) {
|
||||
bp := `
|
||||
apex {
|
||||
@@ -10514,21 +10312,6 @@ func TestTrimmedApex(t *testing.T) {
|
||||
apex_available: ["myapex","mydcla"],
|
||||
min_sdk_version: "29",
|
||||
}
|
||||
cc_api_library {
|
||||
name: "libc",
|
||||
src: "libc.so",
|
||||
min_sdk_version: "29",
|
||||
recovery_available: true,
|
||||
vendor_available: true,
|
||||
product_available: true,
|
||||
}
|
||||
api_imports {
|
||||
name: "api_imports",
|
||||
shared_libs: [
|
||||
"libc",
|
||||
],
|
||||
header_libs: [],
|
||||
}
|
||||
`
|
||||
ctx := testApex(t, bp)
|
||||
module := ctx.ModuleForTests("myapex", "android_common_myapex")
|
||||
|
Reference in New Issue
Block a user