From c1b3644e91c65444f6f7eaa6d8927c3e13212d22 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 6 May 2021 13:42:48 -0700 Subject: [PATCH] Remove versioned LLNDK stubs Nothing links against the versioned LLNDK stubs, only current and the implementation are used. Remove the numbered LLNDK variants. Also remove llndkStubDepTag, it is never used to add a dependency. Test: TestLlndkLibrary Change-Id: Idde62007d77b8e6ceee31144c05756faf9b41f23 --- cc/cc.go | 5 ++--- cc/cc_test.go | 7 ------- cc/library.go | 17 ++++++----------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/cc/cc.go b/cc/cc.go index 16a49d343..8c20152aa 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -726,7 +726,6 @@ var ( runtimeDepTag = installDependencyTag{name: "runtime lib"} testPerSrcDepTag = dependencyTag{name: "test_per_src"} stubImplDepTag = dependencyTag{name: "stub_impl"} - llndkStubDepTag = dependencyTag{name: "llndk stub"} ) type copyDirectlyInAnyApexDependencyTag dependencyTag @@ -3224,8 +3223,8 @@ func (c *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Modu return false } } - if depTag == stubImplDepTag || depTag == llndkStubDepTag { - // We don't track beyond LLNDK or from an implementation library to its stubs. + if depTag == stubImplDepTag { + // We don't track from an implementation library to its stubs. return false } if depTag == staticVariantTag { diff --git a/cc/cc_test.go b/cc/cc_test.go index e9daf33fc..22d4810ab 100644 --- a/cc/cc_test.go +++ b/cc/cc_test.go @@ -2792,12 +2792,8 @@ func TestLlndkLibrary(t *testing.T) { } } expected := []string{ - "android_vendor.29_arm64_armv8-a_shared_1", - "android_vendor.29_arm64_armv8-a_shared_2", "android_vendor.29_arm64_armv8-a_shared_current", "android_vendor.29_arm64_armv8-a_shared", - "android_vendor.29_arm_armv7-a-neon_shared_1", - "android_vendor.29_arm_armv7-a-neon_shared_2", "android_vendor.29_arm_armv7-a-neon_shared_current", "android_vendor.29_arm_armv7-a-neon_shared", } @@ -2806,9 +2802,6 @@ func TestLlndkLibrary(t *testing.T) { params := result.ModuleForTests("libllndk", "android_vendor.29_arm_armv7-a-neon_shared").Description("generate stub") android.AssertSame(t, "use VNDK version for default stubs", "current", params.Args["apiLevel"]) - params = result.ModuleForTests("libllndk", "android_vendor.29_arm_armv7-a-neon_shared_1").Description("generate stub") - android.AssertSame(t, "override apiLevel for versioned stubs", "1", params.Args["apiLevel"]) - checkExportedIncludeDirs := func(module, variant string, expectedDirs ...string) { t.Helper() m := result.ModuleForTests(module, variant).Module() diff --git a/cc/library.go b/cc/library.go index 7b631fa16..7c8ea53a8 100644 --- a/cc/library.go +++ b/cc/library.go @@ -1769,6 +1769,11 @@ func (library *libraryDecorator) stubsVersions(ctx android.BaseMutatorContext) [ return nil } + if library.hasLLNDKStubs() && ctx.Module().(*Module).UseVndk() { + // LLNDK libraries only need a single stubs variant. + return []string{android.FutureApiLevel.String()} + } + // Future API level is implicitly added if there isn't vers := library.Properties.Stubs.Versions if inList(android.FutureApiLevel.String(), vers) { @@ -2110,8 +2115,7 @@ func moduleLibraryInterface(module blueprint.Module) libraryInterface { return nil } -// versionSelector normalizes the versions in the Stubs.Versions property into MutatedProperties.AllStubsVersions, -// and propagates the value from implementation libraries to llndk libraries with the same name. +// versionSelector normalizes the versions in the Stubs.Versions property into MutatedProperties.AllStubsVersions. func versionSelectorMutator(mctx android.BottomUpMutatorContext) { if library := moduleLibraryInterface(mctx.Module()); library != nil && CanBeVersionVariant(mctx.Module().(*Module)) { if library.buildShared() { @@ -2125,15 +2129,6 @@ func versionSelectorMutator(mctx android.BottomUpMutatorContext) { // depend on the implementation library and haven't been mutated yet. library.setAllStubsVersions(versions) } - - if mctx.Module().(*Module).UseVndk() && library.hasLLNDKStubs() { - // Propagate the version to the llndk stubs module. - mctx.VisitDirectDepsWithTag(llndkStubDepTag, func(stubs android.Module) { - if stubsLib := moduleLibraryInterface(stubs); stubsLib != nil { - stubsLib.setAllStubsVersions(library.allStubsVersions()) - } - }) - } } } }