Add no_apex property
This change adds 'no_apex' property which, when set to true, prevents
the module from being installed to any APEX. If the module is included
either directly or transitively in an APEX, but build fails.
Bug: 139016109
Test: m
Change-Id: If1478aa9660a3442f7dd1ffe45e4ca5611a6acbe
diff --git a/apex/apex.go b/apex/apex.go
index 574604b..cbca890 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -126,6 +126,16 @@
usesTag = dependencyTag{name: "uses"}
)
+var (
+ whitelistNoApex = map[string][]string{
+ "apex_test_build_features": []string{"libbinder"},
+ "com.android.neuralnetworks": []string{"libbinder"},
+ "com.android.media": []string{"libbinder"},
+ "com.android.media.swcodec": []string{"libbinder"},
+ "test_com.android.media.swcodec": []string{"libbinder"},
+ }
+)
+
func init() {
pctx.Import("android/soong/android")
pctx.Import("android/soong/java")
@@ -1005,6 +1015,16 @@
return filesInfo[i].builtFile.String() < filesInfo[j].builtFile.String()
})
+ // check no_apex modules
+ whitelist := whitelistNoApex[ctx.ModuleName()]
+ for i := range filesInfo {
+ if am, ok := filesInfo[i].module.(android.ApexModule); ok {
+ if am.NoApex() && !android.InList(filesInfo[i].moduleName, whitelist) {
+ ctx.ModuleErrorf("tries to include no_apex module %s", filesInfo[i].moduleName)
+ }
+ }
+ }
+
// prepend the name of this APEX to the module names. These names will be the names of
// modules that will be defined if the APEX is flattened.
for i := range filesInfo {