Merge "apex: emit file_contexts for flattened apex" am: 51ce6b0acc am: 605b7a6bde am: 0d7b03fc88 am: 2c4999b7f7

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1435292

Change-Id: Ic61a5e6645c34c63f5b67cc15811ed2164dd6717
This commit is contained in:
Jooyung Han
2020-10-06 04:37:48 +00:00
committed by Automerger Merge Worker
3 changed files with 33 additions and 42 deletions

View File

@@ -19,7 +19,6 @@ import (
"path/filepath"
"sort"
"strings"
"sync"
"github.com/google/blueprint"
"github.com/google/blueprint/bootstrap"
@@ -742,12 +741,6 @@ func init() {
android.PreDepsMutators(RegisterPreDepsMutators)
android.PostDepsMutators(RegisterPostDepsMutators)
android.RegisterMakeVarsProvider(pctx, func(ctx android.MakeVarsContext) {
apexFileContextsInfos := apexFileContextsInfos(ctx.Config())
sort.Strings(*apexFileContextsInfos)
ctx.Strict("APEX_FILE_CONTEXTS_INFOS", strings.Join(*apexFileContextsInfos, " "))
})
android.AddNeverAllowRules(createApexPermittedPackagesRules(qModulesPackages())...)
android.AddNeverAllowRules(createApexPermittedPackagesRules(rModulesPackages())...)
}
@@ -915,24 +908,6 @@ func apexMutator(mctx android.BottomUpMutatorContext) {
}
var (
apexFileContextsInfosKey = android.NewOnceKey("apexFileContextsInfosKey")
apexFileContextsInfosMutex sync.Mutex
)
func apexFileContextsInfos(config android.Config) *[]string {
return config.Once(apexFileContextsInfosKey, func() interface{} {
return &[]string{}
}).(*[]string)
}
func addFlattenedFileContextsInfos(ctx android.BaseModuleContext, fileContextsInfo string) {
apexFileContextsInfosMutex.Lock()
defer apexFileContextsInfosMutex.Unlock()
apexFileContextsInfos := apexFileContextsInfos(ctx.Config())
*apexFileContextsInfos = append(*apexFileContextsInfos, fileContextsInfo)
}
func apexFlattenedMutator(mctx android.BottomUpMutatorContext) {
if !mctx.Module().Enabled() {
return