Drop module sdk MakeUninstallable special case

Platform variants of module sdk libraries were marked as uninstallable
originally in https://r.android.com/1974259. This special case is no
longer necesssary - android.MutateApexTransition will call
MakeUninstallable on the platform variant on both the source and
prebuilt soong modules when the following conditions are met
- //apex_available:platform is not listed in apex_available (explicitly
  or via the default implicit)
- the soong module is included in an apex that exists in the tree
  (listed in native_shared_libs)

Since MakeUninstallable is set by apex specific mutators, the relevant
unit test has been moved to the apex package. The Android.bp of the test
has also been extended with an apex that includes the shared library.

Test: m nothing --no-skip-soong-tests
Test: no diff in out/soong/Android-$product.mk
Test: added prebuilt_libdexfile to art's apex_contributions locally, no
diff in out/soong/Android-$product.mk

Bug: 220898484
Change-Id: I43a324882d486451bb921028853508d7ec3d76bf
This commit is contained in:
Spandan Das
2024-07-22 19:25:50 +00:00
parent dd9b0c1be8
commit 2f68f1903a
3 changed files with 118 additions and 117 deletions

View File

@@ -11738,3 +11738,121 @@ func TestUpdatableApexMinSdkVersionCurrent(t *testing.T) {
}
`)
}
func TestPrebuiltStubNoinstall(t *testing.T) {
testFunc := func(t *testing.T, expectLibfooOnSystemLib bool, fs android.MockFS) {
result := android.GroupFixturePreparers(
prepareForApexTest,
android.PrepareForTestWithAndroidMk,
android.PrepareForTestWithMakevars,
android.FixtureMergeMockFs(fs),
).RunTest(t)
ldRule := result.ModuleForTests("installedlib", "android_arm64_armv8-a_shared").Rule("ld")
android.AssertStringDoesContain(t, "", ldRule.Args["libFlags"], "android_arm64_armv8-a_shared/libfoo.so")
installRules := result.InstallMakeRulesForTesting(t)
var installedlibRule *android.InstallMakeRule
for i, rule := range installRules {
if rule.Target == "out/target/product/test_device/system/lib/installedlib.so" {
if installedlibRule != nil {
t.Errorf("Duplicate install rules for %s", rule.Target)
}
installedlibRule = &installRules[i]
}
}
if installedlibRule == nil {
t.Errorf("No install rule found for installedlib")
return
}
if expectLibfooOnSystemLib {
android.AssertStringListContains(t,
"installedlib doesn't have install dependency on libfoo impl",
installedlibRule.OrderOnlyDeps,
"out/target/product/test_device/system/lib/libfoo.so")
} else {
android.AssertStringListDoesNotContain(t,
"installedlib has install dependency on libfoo stub",
installedlibRule.Deps,
"out/target/product/test_device/system/lib/libfoo.so")
android.AssertStringListDoesNotContain(t,
"installedlib has order-only install dependency on libfoo stub",
installedlibRule.OrderOnlyDeps,
"out/target/product/test_device/system/lib/libfoo.so")
}
}
prebuiltLibfooBp := []byte(`
cc_prebuilt_library {
name: "libfoo",
prefer: true,
srcs: ["libfoo.so"],
stubs: {
versions: ["1"],
},
apex_available: ["apexfoo"],
}
`)
apexfooBp := []byte(`
apex {
name: "apexfoo",
key: "apexfoo.key",
native_shared_libs: ["libfoo"],
updatable: false,
compile_multilib: "both",
}
apex_key {
name: "apexfoo.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
`)
installedlibBp := []byte(`
cc_library {
name: "installedlib",
shared_libs: ["libfoo"],
}
`)
t.Run("prebuilt stub (without source): no install", func(t *testing.T) {
testFunc(
t,
/*expectLibfooOnSystemLib=*/ false,
android.MockFS{
"prebuilts/module_sdk/art/current/Android.bp": prebuiltLibfooBp,
"apexfoo/Android.bp": apexfooBp,
"system/sepolicy/apex/apexfoo-file_contexts": nil,
"Android.bp": installedlibBp,
},
)
})
disabledSourceLibfooBp := []byte(`
cc_library {
name: "libfoo",
enabled: false,
stubs: {
versions: ["1"],
},
apex_available: ["apexfoo"],
}
`)
t.Run("prebuilt stub (with disabled source): no install", func(t *testing.T) {
testFunc(
t,
/*expectLibfooOnSystemLib=*/ false,
android.MockFS{
"prebuilts/module_sdk/art/current/Android.bp": prebuiltLibfooBp,
"impl/Android.bp": disabledSourceLibfooBp,
"apexfoo/Android.bp": apexfooBp,
"system/sepolicy/apex/apexfoo-file_contexts": nil,
"Android.bp": installedlibBp,
},
)
})
}