diff options
| author | 2024-11-26 02:12:09 +0000 | |
|---|---|---|
| committer | 2024-11-26 02:12:09 +0000 | |
| commit | 0147192e0c13bfe05db70fdb6dc2fec91d143e10 (patch) | |
| tree | ef59180db604ac4617f38251d1bdcb15d7bdd329 /filesystem/filesystem.go | |
| parent | 1f14b136ca847e3aa097b55b69193ff9f3c59603 (diff) | |
| parent | 01d0c56f32062afbe37a6dedf6cfe2795ffb526d (diff) | |
Merge "Reland: Do not allow vintf_fragments for modules installed in the filesystem" into main am: 01d0c56f32
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3364156
Change-Id: I013be20df0d8972f39cb445f0a4b31ec73929989
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'filesystem/filesystem.go')
| -rw-r--r-- | filesystem/filesystem.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index dadacae3d..9348f91d4 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -71,6 +71,10 @@ type filesystemBuilder interface { // For example, GSI system.img contains system_ext and product artifacts and their // relPathInPackage need to be rebased to system/system_ext and system/system_product. ModifyPackagingSpec(spec *android.PackagingSpec) + + // Function to check if the filesystem should not use `vintf_fragments` property, + // but use `vintf_fragment` module type instead + ShouldUseVintfFragmentModuleOnly() bool } var _ filesystemBuilder = (*filesystem)(nil) @@ -343,6 +347,9 @@ var pctx = android.NewPackageContext("android/soong/filesystem") func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { validatePartitionType(ctx, f) + if f.filesystemBuilder.ShouldUseVintfFragmentModuleOnly() { + f.validateVintfFragments(ctx) + } switch f.fsType(ctx) { case ext4Type, erofsType, f2fsType: f.output = f.buildImageUsingBuildImage(ctx) @@ -371,6 +378,43 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { } } +func (f *filesystem) validateVintfFragments(ctx android.ModuleContext) { + visitedModule := map[string]bool{} + packagingSpecs := f.gatherFilteredPackagingSpecs(ctx) + + moduleInFileSystem := func(mod android.Module) bool { + for _, ps := range android.OtherModuleProviderOrDefault( + ctx, mod, android.InstallFilesProvider).PackagingSpecs { + if _, ok := packagingSpecs[ps.RelPathInPackage()]; ok { + return true + } + } + return false + } + + ctx.WalkDeps(func(child, parent android.Module) bool { + if visitedModule[child.Name()] { + return false + } + if !moduleInFileSystem(child) { + visitedModule[child.Name()] = true + return true + } + if vintfFragments := child.VintfFragments(ctx); vintfFragments != nil { + ctx.PropertyErrorf( + "vintf_fragments", + "Module %s is referenced by soong-defined filesystem %s with property vintf_fragments(%s) in use."+ + " Use vintf_fragment_modules property instead.", + child.Name(), + f.BaseModuleName(), + strings.Join(vintfFragments, ", "), + ) + } + visitedModule[child.Name()] = true + return true + }) +} + func (f *filesystem) appendToEntry(ctx android.ModuleContext, installedFile android.Path) { partitionBaseDir := android.PathForModuleOut(ctx, "root", f.partitionName()).String() + "/" @@ -779,6 +823,10 @@ func (f *filesystem) BuildLinkerConfigFile(ctx android.ModuleContext, builder *a f.appendToEntry(ctx, output) } +func (f *filesystem) ShouldUseVintfFragmentModuleOnly() bool { + return false +} + type partition interface { PartitionType() string } |