Prohibit dependencies outside of uses_sdks
When an APEX is built with uses_sdks, any depedndency from the APEX to
the outside of the APEX should be from the SDKs that the APEX is built
against.
Bug: 138182343
Test: m
Change-Id: I1c2ffe8d28ccf648d928ea59652c2d0070bf10eb
diff --git a/cc/cc.go b/cc/cc.go
index f6f8abb..ef8906a 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2182,6 +2182,16 @@
}
}
+func (c *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
+ if depTag, ok := ctx.OtherModuleDependencyTag(dep).(dependencyTag); ok {
+ if cc, ok := dep.(*Module); ok && cc.IsStubs() && depTag.shared {
+ // dynamic dep to a stubs lib crosses APEX boundary
+ return false
+ }
+ }
+ return true
+}
+
//
// Defaults
//