diff options
author | 2025-01-10 11:20:24 -0800 | |
---|---|---|
committer | 2025-01-10 11:20:24 -0800 | |
commit | 14072ed49ed2e9c5df025ae162d1fd27c349a71e (patch) | |
tree | ddbfc4c4c6d0dcd46346d547d182c796ce86778e /filesystem/filesystem.go | |
parent | 7a63c47fbf7cca941879c3dde9fe1fb806dcd772 (diff) | |
parent | 460cf3783713a82c0f8c41d97c76f3e92451f3e6 (diff) |
Merge changes Ie937a236,I74e6ebef,Ib8020db0 into main
* changes:
Convert hasCode and aaptLibs to use ModuleProxy.
Convert validatePartitionType and checkJniLibsSdkVersion to use ModuleProxy.
Convert getLibsForLinkerConfig to use ModuleProxy.
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r-- | filesystem/filesystem.go | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index b112568f6..1861d8e7a 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -357,6 +357,14 @@ type FilesystemInfo struct { var FilesystemProvider = blueprint.NewProvider[FilesystemInfo]() +type FilesystemDefaultsInfo struct { + // Identifies which partition this is for //visibility:any_system_image (and others) visibility + // checks, and will be used in the future for API surface checks. + PartitionType string +} + +var FilesystemDefaultsInfoProvider = blueprint.NewProvider[FilesystemDefaultsInfo]() + func GetFsTypeFromString(ctx android.EarlyModuleContext, typeStr string) fsType { switch typeStr { case "ext4": @@ -525,12 +533,12 @@ func validatePartitionType(ctx android.ModuleContext, p partition) { ctx.PropertyErrorf("partition_type", "partition_type must be one of %s, found: %s", validPartitions, p.PartitionType()) } - ctx.VisitDirectDepsWithTag(android.DefaultsDepTag, func(m android.Module) { - if fdm, ok := m.(*filesystemDefaults); ok { - if p.PartitionType() != fdm.PartitionType() { + ctx.VisitDirectDepsProxyWithTag(android.DefaultsDepTag, func(m android.ModuleProxy) { + if fdm, ok := android.OtherModuleProvider(ctx, m, FilesystemDefaultsInfoProvider); ok { + if p.PartitionType() != fdm.PartitionType { ctx.PropertyErrorf("partition_type", "%s doesn't match with the partition type %s of the filesystem default module %s", - p.PartitionType(), fdm.PartitionType(), m.Name()) + p.PartitionType(), fdm.PartitionType, m.Name()) } } }) @@ -1076,6 +1084,9 @@ var _ partition = (*filesystemDefaults)(nil) func (f *filesystemDefaults) GenerateAndroidBuildActions(ctx android.ModuleContext) { validatePartitionType(ctx, f) + android.SetProvider(ctx, FilesystemDefaultsInfoProvider, FilesystemDefaultsInfo{ + PartitionType: f.PartitionType(), + }) } // getLibsForLinkerConfig returns @@ -1085,14 +1096,14 @@ func (f *filesystemDefaults) GenerateAndroidBuildActions(ctx android.ModuleConte // `linkerconfig.BuildLinkerConfig` will convert these two to a linker.config.pb for the filesystem // (1) will be added to --provideLibs if they are C libraries with a stable interface (has stubs) // (2) will be added to --requireLibs if they are C libraries with a stable interface (has stubs) -func (f *filesystem) getLibsForLinkerConfig(ctx android.ModuleContext) ([]android.Module, []android.Module) { +func (f *filesystem) getLibsForLinkerConfig(ctx android.ModuleContext) ([]android.ModuleProxy, []android.ModuleProxy) { // we need "Module"s for packaging items - modulesInPackageByModule := make(map[android.Module]bool) + modulesInPackageByModule := make(map[android.ModuleProxy]bool) modulesInPackageByName := make(map[string]bool) deps := f.gatherFilteredPackagingSpecs(ctx) - ctx.WalkDeps(func(child, _ android.Module) bool { - if !child.Enabled(ctx) { + ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool { + if !android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoKey).Enabled { return false } for _, ps := range android.OtherModuleProviderOrDefault( @@ -1106,14 +1117,14 @@ func (f *filesystem) getLibsForLinkerConfig(ctx android.ModuleContext) ([]androi return true }) - provideModules := make([]android.Module, 0, len(modulesInPackageByModule)) + provideModules := make([]android.ModuleProxy, 0, len(modulesInPackageByModule)) for mod := range modulesInPackageByModule { provideModules = append(provideModules, mod) } - var requireModules []android.Module - ctx.WalkDeps(func(child, parent android.Module) bool { - if !child.Enabled(ctx) { + var requireModules []android.ModuleProxy + ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool { + if !android.OtherModuleProviderOrDefault(ctx, child, android.CommonModuleInfoKey).Enabled { return false } _, parentInPackage := modulesInPackageByModule[parent] |