Do not install prebuilt stubs from module_sdk
This is a rework of commit 5bdf2d589c
which made implementation variant of prebuilts with stubs as not
installable except libclangrt. This change narrows the affected modules
to prebuilts/module_sdk because cc_prebuilt_library_shared with stub
implementation is a special case only used there. It's typical for
cc_prebuilt_library_shared to have implementation, not stub.
Bug: 220898484
Test: ART_MODULE_BUILD_FROM_SOURCE=false m nothing
Change-Id: I99e5213da8cc473901e23942b50f06c023d91f60
This commit is contained in:
@@ -670,11 +670,15 @@ cc_prebuilt_library_shared {
|
||||
}
|
||||
|
||||
func TestPrebuiltStubNoinstall(t *testing.T) {
|
||||
testFunc := func(t *testing.T, bp string) {
|
||||
testFunc := func(t *testing.T, expectLibfooOnSystemLib bool, fs android.MockFS) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForPrebuiltTest,
|
||||
android.PrepareForTestWithMakevars,
|
||||
).RunTestWithBp(t, bp)
|
||||
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
|
||||
@@ -691,50 +695,83 @@ func TestPrebuiltStubNoinstall(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
android.AssertStringListDoesNotContain(t,
|
||||
"installedlib has install dependency on stub",
|
||||
installedlibRule.Deps,
|
||||
"out/target/product/test_device/system/lib/stublib.so")
|
||||
android.AssertStringListDoesNotContain(t,
|
||||
"installedlib has order-only install dependency on stub",
|
||||
installedlibRule.OrderOnlyDeps,
|
||||
"out/target/product/test_device/system/lib/stublib.so")
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
const prebuiltStublibBp = `
|
||||
prebuiltLibfooBp := []byte(`
|
||||
cc_prebuilt_library {
|
||||
name: "stublib",
|
||||
name: "libfoo",
|
||||
prefer: true,
|
||||
srcs: ["foo.so"],
|
||||
srcs: ["libfoo.so"],
|
||||
stubs: {
|
||||
versions: ["1"],
|
||||
},
|
||||
}
|
||||
`
|
||||
`)
|
||||
|
||||
const installedlibBp = `
|
||||
installedlibBp := []byte(`
|
||||
cc_library {
|
||||
name: "installedlib",
|
||||
shared_libs: ["stublib"],
|
||||
shared_libs: ["libfoo"],
|
||||
}
|
||||
`
|
||||
`)
|
||||
|
||||
t.Run("prebuilt without source", func(t *testing.T) {
|
||||
testFunc(t, prebuiltStublibBp+installedlibBp)
|
||||
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,
|
||||
"Android.bp": installedlibBp,
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
const disabledSourceStublibBp = `
|
||||
disabledSourceLibfooBp := []byte(`
|
||||
cc_library {
|
||||
name: "stublib",
|
||||
name: "libfoo",
|
||||
enabled: false,
|
||||
stubs: {
|
||||
versions: ["1"],
|
||||
},
|
||||
}
|
||||
`
|
||||
`)
|
||||
|
||||
t.Run("prebuilt with disabled source", func(t *testing.T) {
|
||||
testFunc(t, disabledSourceStublibBp+prebuiltStublibBp+installedlibBp)
|
||||
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,
|
||||
"Android.bp": installedlibBp,
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("prebuilt impl (with `stubs` property set): install", func(t *testing.T) {
|
||||
testFunc(
|
||||
t,
|
||||
/*expectLibfooOnSystemLib=*/ true,
|
||||
android.MockFS{
|
||||
"impl/Android.bp": prebuiltLibfooBp,
|
||||
"Android.bp": installedlibBp,
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user