Merge "Drop module sdk MakeUninstallable special case" into main
This commit is contained in:
@@ -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,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@@ -205,17 +205,6 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
|||||||
TableOfContents: p.tocFile,
|
TableOfContents: p.tocFile,
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO(b/220898484): Mainline module sdk prebuilts of stub libraries use a stub
|
|
||||||
// library as their source and must not be installed, but other prebuilts like
|
|
||||||
// libclang_rt.* libraries set `stubs` property because they are LLNDK libraries,
|
|
||||||
// but use an implementation library as their source and need to be installed.
|
|
||||||
// This discrepancy should be resolved without the prefix hack below.
|
|
||||||
isModuleSdkPrebuilts := android.HasAnyPrefix(ctx.ModuleDir(), []string{
|
|
||||||
"prebuilts/runtime/mainline/", "prebuilts/module_sdk/"})
|
|
||||||
if p.hasStubsVariants() && !p.buildStubs() && !ctx.Host() && isModuleSdkPrebuilts {
|
|
||||||
ctx.Module().MakeUninstallable()
|
|
||||||
}
|
|
||||||
|
|
||||||
return outputFile
|
return outputFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -385,112 +385,6 @@ func TestPrebuiltLibrarySanitized(t *testing.T) {
|
|||||||
assertString(t, static2.OutputFile().Path().Base(), "libf.hwasan.a")
|
assertString(t, static2.OutputFile().Path().Base(), "libf.hwasan.a")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrebuiltStubNoinstall(t *testing.T) {
|
|
||||||
testFunc := func(t *testing.T, expectLibfooOnSystemLib bool, fs android.MockFS) {
|
|
||||||
result := android.GroupFixturePreparers(
|
|
||||||
prepareForPrebuiltTest,
|
|
||||||
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"],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
|
|
||||||
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,
|
|
||||||
"Android.bp": installedlibBp,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
disabledSourceLibfooBp := []byte(`
|
|
||||||
cc_library {
|
|
||||||
name: "libfoo",
|
|
||||||
enabled: false,
|
|
||||||
stubs: {
|
|
||||||
versions: ["1"],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestPrebuiltBinaryNoSrcsNoError(t *testing.T) {
|
func TestPrebuiltBinaryNoSrcsNoError(t *testing.T) {
|
||||||
const bp = `
|
const bp = `
|
||||||
cc_prebuilt_binary {
|
cc_prebuilt_binary {
|
||||||
|
Reference in New Issue
Block a user