diff options
author | 2024-12-13 11:20:24 -0800 | |
---|---|---|
committer | 2024-12-13 11:29:16 -0800 | |
commit | 34592c02f83c582c1e2c317a21e85aa9a1eaced8 (patch) | |
tree | 27c94bc852d469bb979d941f0692d546caa32836 /filesystem/aconfig_files.go | |
parent | c6f264854e38c6f4964409902eb20832d764d2d4 (diff) |
Make system partition import system_ext's aconfig flags
This is the behavior in make since aosp/3261300. It's a problem for
treble though, so maybe should be revised in the future.
If the system -> system_ext dependency becomes a problem (like if we
need to add a system_ext -> system dependency later), I think we could
break it up by creating a ".aconfig" sub-module of filesystem modules,
and then the dependency is only added from system -> system_ext.aconfig.
But we don't need that right now.
Fixes: 382518797
Test: diff out/target/product/vsoc_x86_64/system/etc/aconfig_flags.pb out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_system_image/android_common/system/system/etc/aconfig_flags.pb
Change-Id: Ia0d043e35f03bbf2bc8a29df0b2b8ecd8427e727
Diffstat (limited to 'filesystem/aconfig_files.go')
-rw-r--r-- | filesystem/aconfig_files.go | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/filesystem/aconfig_files.go b/filesystem/aconfig_files.go index c80ae03d7..492ec697a 100644 --- a/filesystem/aconfig_files.go +++ b/filesystem/aconfig_files.go @@ -17,26 +17,55 @@ package filesystem import ( "android/soong/android" + "github.com/google/blueprint" "github.com/google/blueprint/proptools" ) -func (f *filesystem) buildAconfigFlagsFiles(ctx android.ModuleContext, builder *android.RuleBuilder, specs map[string]android.PackagingSpec, dir android.OutputPath) { - if !proptools.Bool(f.properties.Gen_aconfig_flags_pb) { - return - } +type installedAconfigFlagsInfo struct { + aconfigFiles android.Paths +} + +var installedAconfigFlagsProvider = blueprint.NewProvider[installedAconfigFlagsInfo]() + +type importAconfigDepDag struct { + blueprint.BaseDependencyTag +} + +var importAconfigDependencyTag = interPartitionDepTag{} +func (f *filesystem) buildAconfigFlagsFiles(ctx android.ModuleContext, builder *android.RuleBuilder, specs map[string]android.PackagingSpec, dir android.OutputPath) { var caches []android.Path for _, ps := range specs { caches = append(caches, ps.GetAconfigPaths()...) } + + ctx.VisitDirectDepsWithTag(importAconfigDependencyTag, func(m android.Module) { + info, ok := android.OtherModuleProvider(ctx, m, installedAconfigFlagsProvider) + if !ok { + ctx.ModuleErrorf("expected dependency %s to have an installedAconfigFlagsProvider", m.Name()) + return + } + caches = append(caches, info.aconfigFiles...) + }) caches = android.SortedUniquePaths(caches) + android.SetProvider(ctx, installedAconfigFlagsProvider, installedAconfigFlagsInfo{ + aconfigFiles: caches, + }) + + if !proptools.Bool(f.properties.Gen_aconfig_flags_pb) { + return + } + + container := f.PartitionType() + installAconfigFlagsPath := dir.Join(ctx, "etc", "aconfig_flags.pb") cmd := builder.Command(). BuiltTool("aconfig"). Text(" dump-cache --dedup --format protobuf --out"). Output(installAconfigFlagsPath). - Textf("--filter container:%s", f.PartitionType()) + Textf("--filter container:%s+state:ENABLED", container). + Textf("--filter container:%s+permission:READ_WRITE", container) for _, cache := range caches { cmd.FlagWithInput("--cache ", cache) } @@ -49,7 +78,7 @@ func (f *filesystem) buildAconfigFlagsFiles(ctx android.ModuleContext, builder * outputPath := installAconfigStorageDir.Join(ctx, fileName) builder.Command(). BuiltTool("aconfig"). - FlagWithArg("create-storage --container ", f.PartitionType()). + FlagWithArg("create-storage --container ", container). FlagWithArg("--file ", fileType). FlagWithOutput("--out ", outputPath). FlagWithArg("--cache ", installAconfigFlagsPath.String()) |