From 4b2bb5e9ab2d546959784113cd2b8ae8fc0ad3ff Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Mon, 29 Jul 2024 12:24:25 -0700 Subject: [PATCH] Cleanup configurable getter usages You don't have to call module.ConfigurableEvaluator(ctx) if ctx is already a ModuleContext, you only need to do that for more restricted contexts like SingletonContext. Bug: 323382414 Test: m nothing --no-skip-soong-tests Change-Id: I7612290d43dae7decfae283a341882d9016c98a3 --- android/defaults.go | 6 +++--- android/module.go | 2 +- apex/apex.go | 10 +++++----- apex/builder.go | 4 ++-- filesystem/vbmeta.go | 2 +- genrule/genrule.go | 2 +- phony/phony.go | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/android/defaults.go b/android/defaults.go index ba26e00c3..c0a2fc68f 100644 --- a/android/defaults.go +++ b/android/defaults.go @@ -278,13 +278,13 @@ func RegisterDefaultsPreArchMutators(ctx RegisterMutatorsContext) { func defaultsDepsMutator(ctx BottomUpMutatorContext) { if defaultable, ok := ctx.Module().(Defaultable); ok { - ctx.AddDependency(ctx.Module(), DefaultsDepTag, defaultable.defaults().Defaults.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil)...) + ctx.AddDependency(ctx.Module(), DefaultsDepTag, defaultable.defaults().Defaults.GetOrDefault(ctx, nil)...) } } func defaultsMutator(ctx TopDownMutatorContext) { if defaultable, ok := ctx.Module().(Defaultable); ok { - defaults := defaultable.defaults().Defaults.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil) + defaults := defaultable.defaults().Defaults.GetOrDefault(ctx, nil) if len(defaults) > 0 { var defaultsList []Defaults seen := make(map[Defaults]bool) @@ -295,7 +295,7 @@ func defaultsMutator(ctx TopDownMutatorContext) { if !seen[defaults] { seen[defaults] = true defaultsList = append(defaultsList, defaults) - return len(defaults.defaults().Defaults.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil)) > 0 + return len(defaults.defaults().Defaults.GetOrDefault(ctx, nil)) > 0 } } else { ctx.PropertyErrorf("defaults", "module %s is not an defaults module", diff --git a/android/module.go b/android/module.go index 05e7f6372..b888339d3 100644 --- a/android/module.go +++ b/android/module.go @@ -1881,7 +1881,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) } } - m.vintfFragmentsPaths = PathsForModuleSrc(ctx, m.commonProperties.Vintf_fragments.GetOrDefault(m.ConfigurableEvaluator(ctx), nil)) + m.vintfFragmentsPaths = PathsForModuleSrc(ctx, m.commonProperties.Vintf_fragments.GetOrDefault(ctx, nil)) vintfDir := PathForModuleInstall(ctx, "etc", "vintf", "manifest") for _, src := range m.vintfFragmentsPaths { installedVintfFragment := vintfDir.Join(ctx, src.Base()) diff --git a/apex/apex.go b/apex/apex.go index 0a91905b2..14c36b71a 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -263,10 +263,10 @@ func (a *ApexNativeDependencies) Merge(ctx android.BaseMutatorContext, b ApexNat a.Native_shared_libs = append(a.Native_shared_libs, b.Native_shared_libs...) a.Jni_libs = append(a.Jni_libs, b.Jni_libs...) a.Rust_dyn_libs = append(a.Rust_dyn_libs, b.Rust_dyn_libs...) - a.ResolvedBinaries = append(a.ResolvedBinaries, b.Binaries.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil)...) + a.ResolvedBinaries = append(a.ResolvedBinaries, b.Binaries.GetOrDefault(ctx, nil)...) a.Tests = append(a.Tests, b.Tests...) a.Filesystems = append(a.Filesystems, b.Filesystems...) - a.ResolvedPrebuilts = append(a.ResolvedPrebuilts, b.Prebuilts.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil)...) + a.ResolvedPrebuilts = append(a.ResolvedPrebuilts, b.Prebuilts.GetOrDefault(ctx, nil)...) a.Exclude_native_shared_libs = append(a.Exclude_native_shared_libs, b.Exclude_native_shared_libs...) a.Exclude_jni_libs = append(a.Exclude_jni_libs, b.Exclude_jni_libs...) @@ -844,7 +844,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { } } - a.properties.ResolvedSystemserverclasspathFragments = a.properties.Systemserverclasspath_fragments.GetOrDefault(a.ConfigurableEvaluator(ctx), nil) + a.properties.ResolvedSystemserverclasspathFragments = a.properties.Systemserverclasspath_fragments.GetOrDefault(ctx, nil) // Common-arch dependencies come next commonVariation := ctx.Config().AndroidCommonTarget.Variations() @@ -863,9 +863,9 @@ func (a *apexBundle) OverridablePropertiesDepsMutator(ctx android.BottomUpMutato } commonVariation := ctx.Config().AndroidCommonTarget.Variations() - ctx.AddFarVariationDependencies(commonVariation, androidAppTag, a.overridableProperties.Apps.GetOrDefault(a.ConfigurableEvaluator(ctx), nil)...) + ctx.AddFarVariationDependencies(commonVariation, androidAppTag, a.overridableProperties.Apps.GetOrDefault(ctx, nil)...) ctx.AddFarVariationDependencies(commonVariation, bpfTag, a.overridableProperties.Bpfs...) - if prebuilts := a.overridableProperties.Prebuilts.GetOrDefault(a.ConfigurableEvaluator(ctx), nil); len(prebuilts) > 0 { + if prebuilts := a.overridableProperties.Prebuilts.GetOrDefault(ctx, nil); len(prebuilts) > 0 { // For prebuilt_etc, use the first variant (64 on 64/32bit device, 32 on 32bit device) // regardless of the TARGET_PREFER_* setting. See b/144532908 arches := ctx.DeviceConfig().Arches() diff --git a/apex/builder.go b/apex/builder.go index 6f645ab04..bfe16922d 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -704,7 +704,7 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { optFlags = append(optFlags, "--override_apk_package_name "+manifestPackageName) } - androidManifest := a.properties.AndroidManifest.GetOrDefault(a.ConfigurableEvaluator(ctx), "") + androidManifest := a.properties.AndroidManifest.GetOrDefault(ctx, "") if androidManifest != "" { androidManifestFile := android.PathForModuleSrc(ctx, androidManifest) @@ -1196,7 +1196,7 @@ func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext, defaultReadO } // Custom fs_config is "appended" to the last so that entries from the file are preferred // over default ones set above. - customFsConfig := a.properties.Canned_fs_config.GetOrDefault(a.ConfigurableEvaluator(ctx), "") + customFsConfig := a.properties.Canned_fs_config.GetOrDefault(ctx, "") if customFsConfig != "" { cmd.Text("cat").Input(android.PathForModuleSrc(ctx, customFsConfig)) } diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go index f049ec49d..3a9a64daa 100644 --- a/filesystem/vbmeta.go +++ b/filesystem/vbmeta.go @@ -110,7 +110,7 @@ type vbmetaDep struct { var vbmetaPartitionDep = vbmetaDep{kind: "partition"} func (v *vbmeta) DepsMutator(ctx android.BottomUpMutatorContext) { - ctx.AddDependency(ctx.Module(), vbmetaPartitionDep, v.properties.Partitions.GetOrDefault(v.ConfigurableEvaluator(ctx), nil)...) + ctx.AddDependency(ctx.Module(), vbmetaPartitionDep, v.properties.Partitions.GetOrDefault(ctx, nil)...) } func (v *vbmeta) installFileName() string { diff --git a/genrule/genrule.go b/genrule/genrule.go index f974b37b8..1710bfe9b 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -397,7 +397,7 @@ func (g *Module) generateCommonBuildActions(ctx android.ModuleContext) { } return srcFiles } - g.properties.ResolvedSrcs = g.properties.Srcs.GetOrDefault(g.ConfigurableEvaluator(ctx), nil) + g.properties.ResolvedSrcs = g.properties.Srcs.GetOrDefault(ctx, nil) srcFiles := addLabelsForInputs("srcs", g.properties.ResolvedSrcs, g.properties.Exclude_srcs) android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcFiles.Strings()}) diff --git a/phony/phony.go b/phony/phony.go index 5505a3a40..807b95b32 100644 --- a/phony/phony.go +++ b/phony/phony.go @@ -112,7 +112,7 @@ func PhonyRuleFactory() android.Module { } func (p *PhonyRule) GenerateAndroidBuildActions(ctx android.ModuleContext) { - p.phonyDepsModuleNames = p.properties.Phony_deps.GetOrDefault(p.ConfigurableEvaluator(ctx), nil) + p.phonyDepsModuleNames = p.properties.Phony_deps.GetOrDefault(ctx, nil) } func (p *PhonyRule) AndroidMk() android.AndroidMkData {