aboutsummaryrefslogtreecommitdiffstats
path: root/cc/vndk.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/vndk.go')
-rw-r--r--cc/vndk.go61
1 files changed, 55 insertions, 6 deletions
diff --git a/cc/vndk.go b/cc/vndk.go
index a61b74c9..d417bea6 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -42,6 +42,9 @@ type VndkProperties struct {
// the module is VNDK-core and can link to other VNDK-core,
// VNDK-SP or LL-NDK modules only.
Support_system_process *bool
+
+ // Extending another module
+ Extends *string
}
}
@@ -67,17 +70,31 @@ func (vndk *vndkdep) isVndkSp() bool {
return Bool(vndk.Properties.Vndk.Support_system_process)
}
+func (vndk *vndkdep) isVndkExt() bool {
+ return vndk.Properties.Vndk.Extends != nil
+}
+
+func (vndk *vndkdep) getVndkExtendsModuleName() string {
+ return String(vndk.Properties.Vndk.Extends)
+}
+
func (vndk *vndkdep) typeName() string {
if !vndk.isVndk() {
return "native:vendor"
}
+ if !vndk.isVndkExt() {
+ if !vndk.isVndkSp() {
+ return "native:vendor:vndk"
+ }
+ return "native:vendor:vndksp"
+ }
if !vndk.isVndkSp() {
- return "native:vendor:vndk"
+ return "native:vendor:vndkext"
}
- return "native:vendor:vndksp"
+ return "native:vendor:vndkspext"
}
-func (vndk *vndkdep) vndkCheckLinkType(ctx android.ModuleContext, to *Module) {
+func (vndk *vndkdep) vndkCheckLinkType(ctx android.ModuleContext, to *Module, tag dependencyTag) {
if to.linker == nil {
return
}
@@ -109,11 +126,43 @@ func (vndk *vndkdep) vndkCheckLinkType(ctx android.ModuleContext, to *Module) {
vndk.typeName(), to.Name())
return
}
+ if tag == vndkExtDepTag {
+ // Ensure `extends: "name"` property refers a vndk module that has vendor_available
+ // and has identical vndk properties.
+ if to.vndkdep == nil || !to.vndkdep.isVndk() {
+ ctx.ModuleErrorf("`extends` refers a non-vndk module %q", to.Name())
+ return
+ }
+ if vndk.isVndkSp() != to.vndkdep.isVndkSp() {
+ ctx.ModuleErrorf(
+ "`extends` refers a module %q with mismatched support_system_process",
+ to.Name())
+ return
+ }
+ if !Bool(to.VendorProperties.Vendor_available) {
+ ctx.ModuleErrorf(
+ "`extends` refers module %q which does not have `vendor_available: true`",
+ to.Name())
+ return
+ }
+ }
if to.vndkdep == nil {
return
}
- if (vndk.isVndk() && !to.vndkdep.isVndk()) || (vndk.isVndkSp() && !to.vndkdep.isVndkSp()) {
- ctx.ModuleErrorf("(%s) should not link to %q(%s)",
+
+ // VNDK-core and VNDK-SP must not depend on VNDK extensions.
+ if (vndk.isVndk() || vndk.isVndkSp()) && !vndk.isVndkExt() && to.vndkdep.isVndkExt() {
+ ctx.ModuleErrorf("(%s) should not link to %q (%s)",
+ vndk.typeName(), to.Name(), to.vndkdep.typeName())
+ return
+ }
+
+ // VNDK-core must be only depend on VNDK-SP or LL-NDK. VNDK-SP must only depend on
+ // LL-NDK, regardless the extension status. VNDK-Ext may depend on vendor libraries, but
+ // VNDK-SP-Ext must remain self-contained.
+ if (vndk.isVndk() && !to.vndkdep.isVndk() && !vndk.isVndkExt()) ||
+ (vndk.isVndkSp() && !to.vndkdep.isVndkSp()) {
+ ctx.ModuleErrorf("(%s) should not link to %q (%s)",
vndk.typeName(), to.Name(), to.vndkdep.typeName())
return
}
@@ -149,7 +198,7 @@ func vndkMutator(mctx android.BottomUpMutatorContext) {
prebuilt_lib, is_prebuilt_lib := m.linker.(*prebuiltLibraryLinker)
if (is_lib && lib.shared()) || (is_prebuilt_lib && prebuilt_lib.shared()) {
name := strings.TrimPrefix(m.Name(), "prebuilt_")
- if m.vndkdep.isVndk() {
+ if m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
vndkLibrariesLock.Lock()
defer vndkLibrariesLock.Unlock()
if m.vndkdep.isVndkSp() {