Merge "Do not install prebuilt stubs from module_sdk"
This commit is contained in:
@@ -16,7 +16,6 @@ package cc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/bazel"
|
"android/soong/bazel"
|
||||||
@@ -208,12 +207,13 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
|||||||
})
|
})
|
||||||
|
|
||||||
// TODO(b/220898484): Mainline module sdk prebuilts of stub libraries use a stub
|
// TODO(b/220898484): Mainline module sdk prebuilts of stub libraries use a stub
|
||||||
// library as their source and must not be installed, but libclang_rt.* libraries
|
// library as their source and must not be installed, but other prebuilts like
|
||||||
// have stubs because they are LLNDK libraries, but use an implementation library
|
// libclang_rt.* libraries set `stubs` property because they are LLNDK libraries,
|
||||||
// as their source and need to be installed. This discrepancy should be resolved
|
// but use an implementation library as their source and need to be installed.
|
||||||
// without the prefix hack below.
|
// This discrepancy should be resolved without the prefix hack below.
|
||||||
if p.hasStubsVariants() && !p.buildStubs() && !ctx.Host() &&
|
isModuleSdkPrebuilts := android.HasAnyPrefix(ctx.ModuleDir(), []string{
|
||||||
!strings.HasPrefix(ctx.baseModuleName(), "libclang_rt.") {
|
"prebuilts/runtime/mainline/", "prebuilts/module_sdk/"})
|
||||||
|
if p.hasStubsVariants() && !p.buildStubs() && !ctx.Host() && isModuleSdkPrebuilts {
|
||||||
ctx.Module().MakeUninstallable()
|
ctx.Module().MakeUninstallable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -670,11 +670,15 @@ cc_prebuilt_library_shared {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPrebuiltStubNoinstall(t *testing.T) {
|
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(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForPrebuiltTest,
|
prepareForPrebuiltTest,
|
||||||
android.PrepareForTestWithMakevars,
|
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)
|
installRules := result.InstallMakeRulesForTesting(t)
|
||||||
var installedlibRule *android.InstallMakeRule
|
var installedlibRule *android.InstallMakeRule
|
||||||
@@ -691,50 +695,83 @@ func TestPrebuiltStubNoinstall(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
android.AssertStringListDoesNotContain(t,
|
if expectLibfooOnSystemLib {
|
||||||
"installedlib has install dependency on stub",
|
android.AssertStringListContains(t,
|
||||||
installedlibRule.Deps,
|
"installedlib doesn't have install dependency on libfoo impl",
|
||||||
"out/target/product/test_device/system/lib/stublib.so")
|
installedlibRule.OrderOnlyDeps,
|
||||||
android.AssertStringListDoesNotContain(t,
|
"out/target/product/test_device/system/lib/libfoo.so")
|
||||||
"installedlib has order-only install dependency on stub",
|
} else {
|
||||||
installedlibRule.OrderOnlyDeps,
|
android.AssertStringListDoesNotContain(t,
|
||||||
"out/target/product/test_device/system/lib/stublib.so")
|
"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 {
|
cc_prebuilt_library {
|
||||||
name: "stublib",
|
name: "libfoo",
|
||||||
prefer: true,
|
prefer: true,
|
||||||
srcs: ["foo.so"],
|
srcs: ["libfoo.so"],
|
||||||
stubs: {
|
stubs: {
|
||||||
versions: ["1"],
|
versions: ["1"],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`
|
`)
|
||||||
|
|
||||||
const installedlibBp = `
|
installedlibBp := []byte(`
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "installedlib",
|
name: "installedlib",
|
||||||
shared_libs: ["stublib"],
|
shared_libs: ["libfoo"],
|
||||||
}
|
}
|
||||||
`
|
`)
|
||||||
|
|
||||||
t.Run("prebuilt without source", func(t *testing.T) {
|
t.Run("prebuilt stub (without source): no install", func(t *testing.T) {
|
||||||
testFunc(t, prebuiltStublibBp+installedlibBp)
|
testFunc(
|
||||||
|
t,
|
||||||
|
/*expectLibfooOnSystemLib=*/ false,
|
||||||
|
android.MockFS{
|
||||||
|
"prebuilts/module_sdk/art/current/Android.bp": prebuiltLibfooBp,
|
||||||
|
"Android.bp": installedlibBp,
|
||||||
|
},
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const disabledSourceStublibBp = `
|
disabledSourceLibfooBp := []byte(`
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "stublib",
|
name: "libfoo",
|
||||||
enabled: false,
|
enabled: false,
|
||||||
stubs: {
|
stubs: {
|
||||||
versions: ["1"],
|
versions: ["1"],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`
|
`)
|
||||||
|
|
||||||
t.Run("prebuilt with disabled source", func(t *testing.T) {
|
t.Run("prebuilt stub (with disabled source): no install", func(t *testing.T) {
|
||||||
testFunc(t, disabledSourceStublibBp+prebuiltStublibBp+installedlibBp)
|
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