summaryrefslogtreecommitdiff
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rw-r--r--cc/cc.go32
-rw-r--r--cc/cc_test.go105
2 files changed, 0 insertions, 137 deletions
diff --git a/cc/cc.go b/cc/cc.go
index becff0f01..774e3e6f0 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3360,10 +3360,6 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
func ShouldUseStubForApex(ctx android.ModuleContext, dep android.Module) bool {
depName := ctx.OtherModuleName(dep)
- thisModule, ok := ctx.Module().(android.ApexModule)
- if !ok {
- panic(fmt.Errorf("Not an APEX module: %q", ctx.ModuleName()))
- }
inVendorOrProduct := false
bootstrap := false
@@ -3393,34 +3389,6 @@ func ShouldUseStubForApex(ctx android.ModuleContext, dep android.Module) bool {
isNotInPlatform := dep.(android.ApexModule).NotInPlatform()
useStubs = isNotInPlatform && !bootstrap
-
- if useStubs {
- // Another exception: if this module is a test for an APEX, then
- // it is linked with the non-stub variant of a module in the APEX
- // as if this is part of the APEX.
- testFor, _ := android.ModuleProvider(ctx, android.ApexTestForInfoProvider)
- for _, apexContents := range testFor.ApexContents {
- if apexContents.DirectlyInApex(depName) {
- useStubs = false
- break
- }
- }
- }
- if useStubs {
- // Yet another exception: If this module and the dependency are
- // available to the same APEXes then skip stubs between their
- // platform variants. This complements the test_for case above,
- // which avoids the stubs on a direct APEX library dependency, by
- // avoiding stubs for indirect test dependencies as well.
- //
- // TODO(b/183882457): This doesn't work if the two libraries have
- // only partially overlapping apex_available. For that test_for
- // modules would need to be split into APEX variants and resolved
- // separately for each APEX they have access to.
- if android.AvailableToSameApexes(thisModule, dep.(android.ApexModule)) {
- useStubs = false
- }
- }
} else {
// If building for APEX, use stubs when the parent is in any APEX that
// the child is not in.
diff --git a/cc/cc_test.go b/cc/cc_test.go
index df239cbb5..bcf0a2c5d 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -1505,111 +1505,6 @@ func TestVersionedStubs(t *testing.T) {
}
}
-func TestStubsForLibraryInMultipleApexes(t *testing.T) {
- t.Parallel()
- ctx := testCc(t, `
- cc_library_shared {
- name: "libFoo",
- srcs: ["foo.c"],
- stubs: {
- symbol_file: "foo.map.txt",
- versions: ["current"],
- },
- apex_available: ["bar", "a1"],
- }
-
- cc_library_shared {
- name: "libBar",
- srcs: ["bar.c"],
- shared_libs: ["libFoo"],
- apex_available: ["a1"],
- }
-
- cc_library_shared {
- name: "libA1",
- srcs: ["a1.c"],
- shared_libs: ["libFoo"],
- apex_available: ["a1"],
- }
-
- cc_library_shared {
- name: "libBarA1",
- srcs: ["bara1.c"],
- shared_libs: ["libFoo"],
- apex_available: ["bar", "a1"],
- }
-
- cc_library_shared {
- name: "libAnyApex",
- srcs: ["anyApex.c"],
- shared_libs: ["libFoo"],
- apex_available: ["//apex_available:anyapex"],
- }
-
- cc_library_shared {
- name: "libBaz",
- srcs: ["baz.c"],
- shared_libs: ["libFoo"],
- apex_available: ["baz"],
- }
-
- cc_library_shared {
- name: "libQux",
- srcs: ["qux.c"],
- shared_libs: ["libFoo"],
- apex_available: ["qux", "bar"],
- }`)
-
- variants := ctx.ModuleVariantsForTests("libFoo")
- expectedVariants := []string{
- "android_arm64_armv8-a_shared",
- "android_arm64_armv8-a_shared_current",
- "android_arm_armv7-a-neon_shared",
- "android_arm_armv7-a-neon_shared_current",
- }
- variantsMismatch := false
- if len(variants) != len(expectedVariants) {
- variantsMismatch = true
- } else {
- for _, v := range expectedVariants {
- if !inList(v, variants) {
- variantsMismatch = false
- }
- }
- }
- if variantsMismatch {
- t.Errorf("variants of libFoo expected:\n")
- for _, v := range expectedVariants {
- t.Errorf("%q\n", v)
- }
- t.Errorf(", but got:\n")
- for _, v := range variants {
- t.Errorf("%q\n", v)
- }
- }
-
- linkAgainstFoo := []string{"libBarA1"}
- linkAgainstFooStubs := []string{"libBar", "libA1", "libBaz", "libQux", "libAnyApex"}
-
- libFooPath := "libFoo/android_arm64_armv8-a_shared/libFoo.so"
- for _, lib := range linkAgainstFoo {
- libLinkRule := ctx.ModuleForTests(lib, "android_arm64_armv8-a_shared").Rule("ld")
- libFlags := libLinkRule.Args["libFlags"]
- if !strings.Contains(libFlags, libFooPath) {
- t.Errorf("%q: %q is not found in %q", lib, libFooPath, libFlags)
- }
- }
-
- libFooStubPath := "libFoo/android_arm64_armv8-a_shared_current/libFoo.so"
- for _, lib := range linkAgainstFooStubs {
- libLinkRule := ctx.ModuleForTests(lib, "android_arm64_armv8-a_shared").Rule("ld")
- libFlags := libLinkRule.Args["libFlags"]
- if !strings.Contains(libFlags, libFooStubPath) {
- t.Errorf("%q: %q is not found in %q", lib, libFooStubPath, libFlags)
- }
- }
-}
-
func TestVersioningMacro(t *testing.T) {
t.Parallel()
for _, tc := range []struct{ moduleName, expected string }{