Add system/sepolicy/apex to bp2build allowlist
Technically, tzdata apex depends on //system/sepolicy/apex:com.android.tzdata-file_contexts. Builds suceeded regardless due to bp2build generating a filegroup for all files in a directory. This also requires an update to the check in apex/builder.go to address the fact that outputs (including filegroups) from Bazel in mixed builds will be in a Bazel out subdirectory. This change also corrects a potential bug that would not support all subdirectories under system/sepolicy as golang's path.Match does not treat ** as recursive. Test: go test apex tests Test: build/bazel/ci/mixed_droid.sh Change-Id: I1076d60cf271e4cdd1ea990156ab0a39fcfa6535
This commit is contained in:
@@ -17,7 +17,6 @@ package apex
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
@@ -256,14 +255,24 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
|
||||
// labeled as system_file.
|
||||
func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.OutputPath {
|
||||
var fileContexts android.Path
|
||||
var fileContextsDir string
|
||||
if a.properties.File_contexts == nil {
|
||||
fileContexts = android.PathForSource(ctx, "system/sepolicy/apex", ctx.ModuleName()+"-file_contexts")
|
||||
} else {
|
||||
if m, t := android.SrcIsModuleWithTag(*a.properties.File_contexts); m != "" {
|
||||
otherModule := android.GetModuleFromPathDep(ctx, m, t)
|
||||
fileContextsDir = ctx.OtherModuleDir(otherModule)
|
||||
}
|
||||
fileContexts = android.PathForModuleSrc(ctx, *a.properties.File_contexts)
|
||||
}
|
||||
if fileContextsDir == "" {
|
||||
fileContextsDir = filepath.Dir(fileContexts.String())
|
||||
}
|
||||
fileContextsDir += string(filepath.Separator)
|
||||
|
||||
if a.Platform() {
|
||||
if matched, err := path.Match("system/sepolicy/**/*", fileContexts.String()); err != nil || !matched {
|
||||
ctx.PropertyErrorf("file_contexts", "should be under system/sepolicy, but %q", fileContexts)
|
||||
if !strings.HasPrefix(fileContextsDir, "system/sepolicy/") {
|
||||
ctx.PropertyErrorf("file_contexts", "should be under system/sepolicy, but found in %q", fileContextsDir)
|
||||
}
|
||||
}
|
||||
if !android.ExistentPathForSource(ctx, fileContexts.String()).Valid() {
|
||||
|
Reference in New Issue
Block a user