summaryrefslogtreecommitdiff
path: root/apex/builder.go
diff options
context:
space:
mode:
author Inseob Kim <inseob@google.com> 2023-11-17 18:04:42 +0900
committer Inseob Kim <inseob@google.com> 2023-11-17 18:06:45 +0900
commit28d06d2eacef769b66d2d49a0d2bee73a4f4692f (patch)
treecc7b9a16365ece3a4f31841348e7360a1940db15 /apex/builder.go
parent88d5104ca123aba51850b120ba928132b6b14bfc (diff)
Allow apex to use generated file_contexts
To support trunk stable, file_contexts files should be processed before creating APEX images. That means that file_contexts may be under out/. This change relaxes the path check so we can use Soong-generated file_contexts, not only the real source file_contexts. Of course the restriction that modules should be under system/sepolicy is still enforced. Bug: 306563735 Test: build with generated file_contexts; see virt apex Change-Id: I3aa368b338141d4826fc8622e1c8d2838bfd8484
Diffstat (limited to 'apex/builder.go')
-rw-r--r--apex/builder.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/apex/builder.go b/apex/builder.go
index ba4df5f6b..8ec07fab5 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -344,10 +344,12 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.OutputPath {
var fileContexts android.Path
var fileContextsDir string
+ isFileContextsModule := false
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 != "" {
+ isFileContextsModule = true
otherModule := android.GetModuleFromPathDep(ctx, m, t)
fileContextsDir = ctx.OtherModuleDir(otherModule)
}
@@ -363,7 +365,7 @@ func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.Output
ctx.PropertyErrorf("file_contexts", "should be under system/sepolicy, but found in %q", fileContextsDir)
}
}
- if !android.ExistentPathForSource(ctx, fileContexts.String()).Valid() {
+ if !isFileContextsModule && !android.ExistentPathForSource(ctx, fileContexts.String()).Valid() {
ctx.PropertyErrorf("file_contexts", "cannot find file_contexts file: %q", fileContexts.String())
}