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
This commit is contained in:
Jiyong Park
2019-08-12 10:37:49 +09:00
committed by Sundong Ahn
parent 3440835748
commit 4f7dd9b4db
3 changed files with 113 additions and 0 deletions

View File

@@ -126,6 +126,16 @@ var (
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 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
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 {