Define vndk.private property for VNDK-private libraries
To define VNDK-private libraries, we used `vendor_available: false`.
Because of it, `vendor_available == nil` had different meaning from
`vendor_available: false` for the VNDK libraries.
To clarify this, we change the logic for defining VNDK-private
libraries which was:
cc_library {
name: "vndk_private",
vendor_available: false,
product_available: false,
vndk: {
enabled: true,
},
}
It must be replaced with
cc_library {
name: "vndk_private",
vendor_available: true,
product_available: true,
vndk: {
enabled: true,
private: true,
},
}
Bug: 175768895
Test: m nothing
Change-Id: I81769f57c2231e54b682a28e4b82631ab9f3d390
diff --git a/cc/vndk.go b/cc/vndk.go
index 1708841..6bc7131 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -78,6 +78,13 @@
// VNDK-SP or LL-NDK modules only.
Support_system_process *bool
+ // declared as a VNDK-private module.
+ // This module still creates the vendor and product variants refering
+ // to the `vendor_available: true` and `product_available: true`
+ // properties. However, it is only available to the other VNDK modules
+ // but not to the non-VNDK vendor or product modules.
+ Private *bool
+
// Extending another module
Extends *string
}
@@ -135,31 +142,11 @@
return
}
if !vndk.isVndk() {
- // 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
- variant := "vendor"
- if lib, ok := to.linker.(*llndkStubDecorator); ok && !Bool(lib.Properties.Vendor_available) {
- violation = true
- if to.InProduct() {
- variant = "product"
- }
- } else if _, ok := to.linker.(libraryInterface); ok {
- if to.inVendor() && to.VendorProperties.Vendor_available != nil && !Bool(to.VendorProperties.Vendor_available) {
- // A vendor module with Vendor_available == nil should be okay since it means a
- // vendor-only library which is a valid dependency for non-VNDK vendor modules.
- violation = true
- } else if to.InProduct() && to.VendorProperties.Product_available != nil && !Bool(to.VendorProperties.Product_available) {
- // A product module with Product_available == nil should be okay since it means a
- // product-only library which is a valid dependency for non-VNDK product modules.
- violation = true
- variant = "product"
- }
- }
- if violation {
- ctx.ModuleErrorf("%s module that is not VNDK should not link to %q which is marked as `%s_available: false`", variant, to.Name(), variant)
+ // Non-VNDK modules those installed to /vendor, /system/vendor,
+ // /product or /system/product cannot depend on VNDK-private modules
+ // that include VNDK-core-private, VNDK-SP-private and LLNDK-private.
+ if to.IsVndkPrivate() {
+ ctx.ModuleErrorf("non-VNDK module should not link to %q which has `private: true`", to.Name())
}
}
if lib, ok := to.linker.(*libraryDecorator); !ok || !lib.shared() {
@@ -191,15 +178,9 @@
to.Name())
return
}
- if to.inVendor() && !Bool(to.VendorProperties.Vendor_available) {
+ if to.IsVndkPrivate() {
ctx.ModuleErrorf(
- "`extends` refers module %q which does not have `vendor_available: true`",
- to.Name())
- return
- }
- if to.InProduct() && !Bool(to.VendorProperties.Product_available) {
- ctx.ModuleErrorf(
- "`extends` refers module %q which does not have `product_available: true`",
+ "`extends` refers module %q which has `private: true`",
to.Name())
return
}
@@ -355,9 +336,7 @@
} 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) {
+ if m.IsVndkPrivate() {
vndkPrivateLibraries(mctx.Config())[name] = filename
}
}