Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.
Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.
Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
name: "libfoo",
version: "27",
vendor_available: true,
vndk: {
enabled: true,
},
arch: {
arm64: {
srcs: ["arm/lib64/libfoo.so"],
},
arm: {
srcs: ["arm/lib/libfoo.so"],
},
},
}
The Android.bp for the snapshot modules will be auto-generated by a
script.
Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
copy a snapshot for v27
build with make command
Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
diff --git a/cc/cc.go b/cc/cc.go
index 891dccb..c31cf04 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1372,7 +1372,7 @@
if genrule, ok := mctx.Module().(*genrule.Module); ok {
if props, ok := genrule.Extra.(*VendorProperties); ok {
- if !mctx.DeviceConfig().CompileVndk() {
+ if mctx.DeviceConfig().VndkVersion() == "" {
mctx.CreateVariations(coreMode)
} else if Bool(props.Vendor_available) {
mctx.CreateVariations(coreMode, vendorMode)
@@ -1408,7 +1408,7 @@
}
}
- if !mctx.DeviceConfig().CompileVndk() {
+ if mctx.DeviceConfig().VndkVersion() == "" {
// If the device isn't compiling against the VNDK, we always
// use the core mode.
mctx.CreateVariations(coreMode)
@@ -1419,6 +1419,12 @@
} else if _, ok := m.linker.(*llndkHeadersDecorator); ok {
// ... and LL-NDK headers as well
mctx.CreateVariations(vendorMode)
+ } else if _, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
+ // Make vendor variants only for the versions in BOARD_VNDK_VERSION and
+ // PRODUCT_EXTRA_VNDK_VERSIONS.
+ mod := mctx.CreateVariations(vendorMode)
+ vendor := mod[0].(*Module)
+ vendor.Properties.UseVndk = true
} else if m.hasVendorVariant() {
// This will be available in both /system and /vendor
// or a /system directory that is available to vendor.