Create product variant for product partition
When PRODUCT_PRODUCT_VNDK_VERSION is set to 'current', product
modules are enforced to use only VNDK libs from the system partition
as BOARD_VNDK_VERSION does to vendor partition.
Modules with 'vendor_available: true' create product variant as well
as core and vendor variants. The product variant as an image variant
is used for the modules in /product or /system/product.
It must not affect the current build behavior without
PRODUCT_PRODUCT_VNDK_VERSION set.
Bug: 134099726
Bug: 138966004
Bug: 144534640
Test: build without PRODUCT_PRODUCT_VNDK_VERSION set
Change-Id: I4d3585c110d84493e45bf76d550dc240bb26137f
diff --git a/cc/vndk.go b/cc/vndk.go
index f531af3..e4453eb 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -132,16 +132,16 @@
return
}
if !vndk.isVndk() {
- // Non-VNDK modules (those installed to /vendor) can't depend on modules marked with
- // vendor_available: false.
+ // Non-VNDK modules (those installed to /vendor, /product, or /system/product) can't depend
+ // on modules marked with vendor_available: false.
violation := false
if lib, ok := to.linker.(*llndkStubDecorator); ok && !Bool(lib.Properties.Vendor_available) {
violation = true
} else {
if _, ok := to.linker.(libraryInterface); ok && to.VendorProperties.Vendor_available != nil && !Bool(to.VendorProperties.Vendor_available) {
// Vendor_available == nil && !Bool(Vendor_available) should be okay since
- // it means a vendor-only library which is a valid dependency for non-VNDK
- // modules.
+ // it means a vendor-only, or product-only library which is a valid dependency
+ // for non-VNDK modules.
violation = true
}
}
@@ -350,7 +350,7 @@
}
if lib, ok := m.linker.(libraryInterface); ok {
- useCoreVariant := m.vndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() &&
+ useCoreVariant := m.VndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() &&
mctx.DeviceConfig().VndkUseCoreVariant() && !m.MustUseVendorVariant()
return lib.shared() && m.UseVndk() && m.IsVndk() && !m.isVndkExt() && !useCoreVariant
}
@@ -665,14 +665,14 @@
if m.Target().NativeBridge == android.NativeBridgeEnabled {
return nil, "", false
}
- if !m.UseVndk() || !m.IsForPlatform() || !m.installable() {
+ if !m.UseVndk() || !m.IsForPlatform() || !m.installable() || !m.inVendor() {
return nil, "", false
}
l, ok := m.linker.(vndkSnapshotLibraryInterface)
if !ok || !l.shared() {
return nil, "", false
}
- if m.vndkVersion() == ctx.DeviceConfig().PlatformVndkVersion() && m.IsVndk() && !m.isVndkExt() {
+ if m.VndkVersion() == ctx.DeviceConfig().PlatformVndkVersion() && m.IsVndk() && !m.isVndkExt() {
if m.isVndkSp() {
return l, "vndk-sp", true
} else {