From 5e8994e5ed9deb651d0e0c8ddaeae11a9e815a77 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 12 Mar 2024 14:12:12 +0900 Subject: [PATCH] Clean up LLNDK stubs So far we created {"", "current"} stubs for LLNDK modules. But we don't need "current" because "" itself is a stub. This change only removes unused LLNDK stub modules with "current" version, which aren't used at all. Bug: 329183083 Test: m blueprint_tests Change-Id: Ib8e880b6d88952b489657ea1ac557a48afe562a4 --- apex/apex_test.go | 2 +- cc/cc_test.go | 2 -- cc/library.go | 13 ++++++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/apex/apex_test.go b/apex/apex_test.go index 54d2d08ff..19b9d169f 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -2068,7 +2068,7 @@ func TestApexMinSdkVersion_InVendorApex(t *testing.T) { // Ensure that mylib links with "current" LLNDK libFlags := names(mylib.Rule("ld").Args["libFlags"]) - ensureListContains(t, libFlags, "out/soong/.intermediates/libbar/"+vendorVariant+"_shared_current/libbar.so") + ensureListContains(t, libFlags, "out/soong/.intermediates/libbar/"+vendorVariant+"_shared/libbar.so") // Ensure that mylib is targeting 29 ccRule := ctx.ModuleForTests("mylib", vendorVariant+"_static_apex29").Output("obj/mylib.o") diff --git a/cc/cc_test.go b/cc/cc_test.go index 6cc500b5f..a0ad7f065 100644 --- a/cc/cc_test.go +++ b/cc/cc_test.go @@ -2680,9 +2680,7 @@ func TestLlndkLibrary(t *testing.T) { } } expected := []string{ - "android_vendor.29_arm64_armv8-a_shared_current", "android_vendor.29_arm64_armv8-a_shared", - "android_vendor.29_arm_armv7-a-neon_shared_current", "android_vendor.29_arm_armv7-a-neon_shared", } android.AssertArrayString(t, "variants for llndk stubs", expected, actual) diff --git a/cc/library.go b/cc/library.go index e2b4d4f4b..51295722a 100644 --- a/cc/library.go +++ b/cc/library.go @@ -1913,12 +1913,15 @@ func (library *libraryDecorator) stubsVersions(ctx android.BaseMutatorContext) [ } if library.hasLLNDKStubs() && ctx.Module().(*Module).InVendorOrProduct() { - // LLNDK libraries only need a single stubs variant. - return []string{android.FutureApiLevel.String()} + // LLNDK libraries only need a single stubs variant (""), which is + // added automatically in createVersionVariations(). + return nil } // Future API level is implicitly added if there isn't - return addCurrentVersionIfNotPresent(library.Properties.Stubs.Versions) + versions := addCurrentVersionIfNotPresent(library.Properties.Stubs.Versions) + normalizeVersions(ctx, versions) + return versions } func addCurrentVersionIfNotPresent(vers []string) []string { @@ -2290,10 +2293,6 @@ func setStubsVersions(mctx android.BottomUpMutatorContext, library libraryInterf return } versions := library.stubsVersions(mctx) - if len(versions) <= 0 { - return - } - normalizeVersions(mctx, versions) if mctx.Failed() { return }