APEX can use any Prebuilt libraries

Vendor snapshot libraries generated from prebuilt libraries set
"apex_inherit" to their min_sdk_version property to allow them to be
used by vendor APEXes.

Bug: 277403349
Test: m vendor-snapshot
Change-Id: Idd9e5f8e94b3fa2adf47a04507bf0c50c59edfb7
This commit is contained in:
Justin Yun 2023-05-08 21:06:59 +09:00
parent 7ef8d46640
commit 3cc7846b58
2 changed files with 20 additions and 1 deletions

View file

@ -250,7 +250,11 @@ var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotS
for _, path := range m.VintfFragments() {
prop.VintfFragments = append(prop.VintfFragments, filepath.Join("configs", path.Base()))
}
prop.MinSdkVersion = m.MinSdkVersion()
if m.IsPrebuilt() {
prop.MinSdkVersion = "apex_inherit"
} else {
prop.MinSdkVersion = m.MinSdkVersion()
}
// install config files. ignores any duplicates.
for _, path := range append(m.InitRc(), m.VintfFragments()...) {

View file

@ -23,6 +23,17 @@ import (
"testing"
)
func checkJsonContents(t *testing.T, ctx android.TestingSingleton, jsonPath string, key string, value string) {
jsonOut := ctx.MaybeOutput(jsonPath)
if jsonOut.Rule == nil {
t.Errorf("%q expected but not found", jsonPath)
return
}
if !strings.Contains(jsonOut.Args["content"], fmt.Sprintf("%q:%q", key, value)) {
t.Errorf("%q must include %q:%q but it only has %v", jsonPath, key, value, jsonOut.Args["content"])
}
}
func TestVendorSnapshotCapture(t *testing.T) {
bp := `
cc_library {
@ -52,6 +63,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
name: "libvendor_available",
vendor_available: true,
nocrt: true,
min_sdk_version: "29",
}
cc_library_headers {
@ -155,6 +167,9 @@ func TestVendorSnapshotCapture(t *testing.T) {
filepath.Join(staticDir, "libvendor_available.a.json"),
filepath.Join(staticDir, "libvendor_available.cfi.a.json"))
checkJsonContents(t, snapshotSingleton, filepath.Join(staticDir, "libb.a.json"), "MinSdkVersion", "apex_inherit")
checkJsonContents(t, snapshotSingleton, filepath.Join(staticDir, "libvendor_available.a.json"), "MinSdkVersion", "29")
// For binary executables, all vendor:true and vendor_available modules are captured.
if archType == "arm64" {
binaryVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant)