Define product_available property
To make a module available to product variants, it must define
`product_available: true`. `vendor_available: true` will not create
product variants any more.
However, in this CL, we don't change the behavior of
`vendor_available` property. It still creates both variants. After we
update all Android.bp files that need to provide product variants
with `product_available: true`, we may upload the remaining patches.
Bug: 150902910
Test: lunch aosp_arm64-userdebug && m
Change-Id: I0fd5be7bbae2c45d5cab3c3c2ca49f53a9b6f975
diff --git a/cc/vndk.go b/cc/vndk.go
index b2614c5..2cac03c 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -62,8 +62,8 @@
// declared as a VNDK or VNDK-SP module. The vendor variant
// will be installed in /system instead of /vendor partition.
//
- // `vendor_available` must be explicitly set to either true or
- // false together with `vndk: {enabled: true}`.
+ // `vendor_available` and `product_available` must be explicitly
+ // set to either true or false together with `vndk: {enabled: true}`.
Enabled *bool
// declared as a VNDK-SP module, which is a subset of VNDK.
@@ -129,13 +129,16 @@
return "native:vendor:vndkspext"
}
+// VNDK link type check from a module with UseVndk() == true.
func (vndk *vndkdep) vndkCheckLinkType(ctx android.BaseModuleContext, to *Module, tag blueprint.DependencyTag) {
if to.linker == nil {
return
}
if !vndk.isVndk() {
- // Non-VNDK modules (those installed to /vendor, /product, or /system/product) can't depend
- // on modules marked with vendor_available: false.
+ // Non-VNDK modules those installed to /vendor or /system/vendor
+ // can't depend on modules marked with vendor_available: false;
+ // or those installed to /product or /system/product can't depend
+ // on modules marked with product_available: false.
violation := false
if lib, ok := to.linker.(*llndkStubDecorator); ok && !Bool(lib.Properties.Vendor_available) {
violation = true
@@ -174,6 +177,7 @@
to.Name())
return
}
+ // TODO(b/150902910): vndk-ext for product must check product_available.
if !Bool(to.VendorProperties.Vendor_available) {
ctx.ModuleErrorf(
"`extends` refers module %q which does not have `vendor_available: true`",
@@ -338,6 +342,8 @@
} else {
vndkCoreLibraries(mctx.Config())[name] = filename
}
+ // As `vendor_available` and `product_available` has the same value for VNDK modules,
+ // we don't need to check both values.
if !Bool(m.VendorProperties.Vendor_available) {
vndkPrivateLibraries(mctx.Config())[name] = filename
}