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
diff --git a/cc/vendor_snapshot_test.go b/cc/vendor_snapshot_test.go
index 5b69a10..c5431b3 100644
--- a/cc/vendor_snapshot_test.go
+++ b/cc/vendor_snapshot_test.go
@@ -23,6 +23,17 @@
"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 @@
name: "libvendor_available",
vendor_available: true,
nocrt: true,
+ min_sdk_version: "29",
}
cc_library_headers {
@@ -155,6 +167,9 @@
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)