From ed5276f0827915166e89b72bf26f7e65f68d2dd5 Mon Sep 17 00:00:00 2001 From: Priyanka Advani Date: Wed, 1 May 2024 20:02:36 +0000 Subject: [PATCH] Revert "Make the enabled property configurable" Revert submission 27162921-configurable_enabled_property Reason for revert: Droid-monitor created revert due to Build breakage in b/338253720. Will be verifying through ABTD before submission. Reverted changes: /q/submissionid:27162921-configurable_enabled_property Change-Id: I2d144f9d297373a13a1190b173d10c966181ad84 --- android/Android.bp | 1 - android/androidmk.go | 12 ++++++------ android/arch.go | 4 ++-- android/arch_test.go | 4 ++-- android/base_module_context.go | 2 +- android/configurable_properties.go | 28 ---------------------------- android/early_module_context.go | 2 +- android/gen_notice.go | 2 +- android/license_metadata.go | 4 ++-- android/makevars.go | 3 +-- android/module.go | 19 +++++++++++-------- android/mutator.go | 6 ++++-- android/override_module.go | 2 +- android/paths.go | 3 +-- android/prebuilt.go | 6 +++--- android/prebuilt_test.go | 2 +- android/register.go | 3 +-- android/singleton.go | 2 +- android/testing.go | 18 ------------------ android/variable.go | 4 ++-- apex/apex.go | 16 ++++++++-------- apex/apex_test.go | 17 ++--------------- cc/cc.go | 4 ++-- cc/fuzz.go | 18 +++++++++++------- cc/makevars.go | 2 +- cc/ndk_abi.go | 4 ++-- cc/ndk_library.go | 2 +- cc/ndk_sysroot.go | 2 +- cc/sanitize.go | 4 ++-- cc/tidy.go | 2 +- cc/vndk.go | 9 ++++----- fuzz/fuzz_common.go | 4 ++-- genrule/genrule.go | 2 +- java/app_import_test.go | 6 +++--- java/boot_jars.go | 4 ++-- java/bootclasspath.go | 5 +---- java/bootclasspath_fragment.go | 6 +++--- java/dexpreopt_bootjars.go | 4 ++-- java/fuzz.go | 16 ++++++++-------- java/hiddenapi_modular.go | 2 +- java/jacoco.go | 2 +- java/jdeps.go | 2 +- java/platform_compat_config.go | 3 +-- java/sdk_library.go | 2 +- provenance/provenance_singleton.go | 20 ++++++++++---------- rust/afdo.go | 2 +- rust/doc.go | 2 +- rust/fuzz.go | 21 +++++++++++---------- rust/library.go | 2 +- rust/project_json.go | 2 +- rust/rust.go | 2 +- rust/sanitize.go | 2 +- snapshot/host_fake_snapshot.go | 2 +- 53 files changed, 131 insertions(+), 189 deletions(-) delete mode 100644 android/configurable_properties.go diff --git a/android/Android.bp b/android/Android.bp index fa78e15fb..f130d3aee 100644 --- a/android/Android.bp +++ b/android/Android.bp @@ -41,7 +41,6 @@ bootstrap_go_package { "buildinfo_prop.go", "config.go", "test_config.go", - "configurable_properties.go", "configured_jars.go", "csuite_config.go", "deapexer.go", diff --git a/android/androidmk.go b/android/androidmk.go index 0a366e14c..07f7c58d0 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -849,7 +849,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs * mod blueprint.Module, provider AndroidMkDataProvider) error { amod := mod.(Module).base() - if shouldSkipAndroidMkProcessing(ctx, amod) { + if shouldSkipAndroidMkProcessing(amod) { return nil } @@ -939,7 +939,7 @@ func WriteAndroidMkData(w io.Writer, data AndroidMkData) { func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON, mod blueprint.Module, provider AndroidMkEntriesProvider) error { - if shouldSkipAndroidMkProcessing(ctx, mod.(Module).base()) { + if shouldSkipAndroidMkProcessing(mod.(Module).base()) { return nil } @@ -961,11 +961,11 @@ func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, moduleIn return nil } -func ShouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module Module) bool { - return shouldSkipAndroidMkProcessing(ctx, module.base()) +func ShouldSkipAndroidMkProcessing(module Module) bool { + return shouldSkipAndroidMkProcessing(module.base()) } -func shouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module *ModuleBase) bool { +func shouldSkipAndroidMkProcessing(module *ModuleBase) bool { if !module.commonProperties.NamespaceExportedToMake { // TODO(jeffrygaston) do we want to validate that there are no modules being // exported to Kati that depend on this module? @@ -984,7 +984,7 @@ func shouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module *ModuleBase return true } - return !module.Enabled(ctx) || + return !module.Enabled() || module.commonProperties.HideFromMake || // Make does not understand LinuxBionic module.Os() == LinuxBionic || diff --git a/android/arch.go b/android/arch.go index e0c6908c1..cd8882bbd 100644 --- a/android/arch.go +++ b/android/arch.go @@ -486,7 +486,7 @@ func osMutator(bpctx blueprint.BottomUpMutatorContext) { // dependencies on OsType variants that are explicitly disabled in their // properties. The CommonOS variant will still depend on disabled variants // if they are disabled afterwards, e.g. in archMutator if - if module.Enabled(mctx) { + if module.Enabled() { mctx.AddInterVariantDependency(commonOsToOsSpecificVariantTag, commonOSVariant, module) } } @@ -511,7 +511,7 @@ func GetOsSpecificVariantsOfCommonOSVariant(mctx BaseModuleContext) []Module { var variants []Module mctx.VisitDirectDeps(func(m Module) { if mctx.OtherModuleDependencyTag(m) == commonOsToOsSpecificVariantTag { - if m.Enabled(mctx) { + if m.Enabled() { variants = append(variants, m) } } diff --git a/android/arch_test.go b/android/arch_test.go index f0a58a90b..5021a67af 100644 --- a/android/arch_test.go +++ b/android/arch_test.go @@ -423,7 +423,7 @@ func TestArchMutator(t *testing.T) { variants := ctx.ModuleVariantsForTests(name) for _, variant := range variants { m := ctx.ModuleForTests(name, variant) - if m.Module().Enabled(PanickingConfigAndErrorContext(ctx)) { + if m.Module().Enabled() { ret = append(ret, variant) } } @@ -533,7 +533,7 @@ func TestArchMutatorNativeBridge(t *testing.T) { variants := ctx.ModuleVariantsForTests(name) for _, variant := range variants { m := ctx.ModuleForTests(name, variant) - if m.Module().Enabled(PanickingConfigAndErrorContext(ctx)) { + if m.Module().Enabled() { ret = append(ret, variant) } } diff --git a/android/base_module_context.go b/android/base_module_context.go index 296352057..c5fe58578 100644 --- a/android/base_module_context.go +++ b/android/base_module_context.go @@ -325,7 +325,7 @@ func (b *baseModuleContext) validateAndroidModule(module blueprint.Module, tag b return nil } - if !aModule.Enabled(b) { + if !aModule.Enabled() { if t, ok := tag.(AllowDisabledModuleDependency); !ok || !t.AllowDisabledModuleDependency(aModule) { if b.Config().AllowMissingDependencies() { b.AddMissingDependencies([]string{b.OtherModuleName(aModule)}) diff --git a/android/configurable_properties.go b/android/configurable_properties.go deleted file mode 100644 index dad42fa1d..000000000 --- a/android/configurable_properties.go +++ /dev/null @@ -1,28 +0,0 @@ -package android - -import "github.com/google/blueprint/proptools" - -// CreateSelectOsToBool is a utility function that makes it easy to create a -// Configurable property value that maps from os to a bool. Use an empty string -// to indicate a "default" case. -func CreateSelectOsToBool(cases map[string]*bool) proptools.Configurable[bool] { - var resultCases []proptools.ConfigurableCase[bool] - for pattern, value := range cases { - if pattern == "" { - resultCases = append(resultCases, proptools.NewConfigurableCase( - []proptools.ConfigurablePattern{proptools.NewDefaultConfigurablePattern()}, - value, - )) - } else { - resultCases = append(resultCases, proptools.NewConfigurableCase( - []proptools.ConfigurablePattern{proptools.NewStringConfigurablePattern(pattern)}, - value, - )) - } - } - - return proptools.NewConfigurable( - []proptools.ConfigurableCondition{proptools.NewConfigurableCondition("os", nil)}, - resultCases, - ) -} diff --git a/android/early_module_context.go b/android/early_module_context.go index 23f4c90a2..cf1b5fcab 100644 --- a/android/early_module_context.go +++ b/android/early_module_context.go @@ -173,5 +173,5 @@ func (e *earlyModuleContext) Namespace() *Namespace { } func (e *earlyModuleContext) OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{}) { - e.EarlyModuleContext.OtherModulePropertyErrorf(module, property, fmt, args...) + e.EarlyModuleContext.OtherModulePropertyErrorf(module, property, fmt, args) } diff --git a/android/gen_notice.go b/android/gen_notice.go index 6815f6467..1acc638e8 100644 --- a/android/gen_notice.go +++ b/android/gen_notice.go @@ -62,7 +62,7 @@ func (s *genNoticeBuildRules) GenerateBuildActions(ctx SingletonContext) { if mod == nil { continue } - if !mod.Enabled(ctx) { // don't depend on variants without build rules + if !mod.Enabled() { // don't depend on variants without build rules continue } modules = append(modules, mod) diff --git a/android/license_metadata.go b/android/license_metadata.go index d515cdd1b..eabb1b170 100644 --- a/android/license_metadata.go +++ b/android/license_metadata.go @@ -36,7 +36,7 @@ var ( func buildLicenseMetadata(ctx ModuleContext, licenseMetadataFile WritablePath) { base := ctx.Module().base() - if !base.Enabled(ctx) { + if !base.Enabled() { return } @@ -69,7 +69,7 @@ func buildLicenseMetadata(ctx ModuleContext, licenseMetadataFile WritablePath) { if dep == nil { return } - if !dep.Enabled(ctx) { + if !dep.Enabled() { return } diff --git a/android/makevars.go b/android/makevars.go index e73645fdc..4039e7edb 100644 --- a/android/makevars.go +++ b/android/makevars.go @@ -98,7 +98,6 @@ type MakeVarsContext interface { BlueprintFile(module blueprint.Module) string ModuleErrorf(module blueprint.Module, format string, args ...interface{}) - OtherModulePropertyErrorf(module Module, property, format string, args ...interface{}) Errorf(format string, args ...interface{}) VisitAllModules(visit func(Module)) @@ -266,7 +265,7 @@ func (s *makeVarsSingleton) GenerateBuildActions(ctx SingletonContext) { } ctx.VisitAllModules(func(m Module) { - if provider, ok := m.(ModuleMakeVarsProvider); ok && m.Enabled(ctx) { + if provider, ok := m.(ModuleMakeVarsProvider); ok && m.Enabled() { mctx := &makeVarsContext{ SingletonContext: ctx, } diff --git a/android/module.go b/android/module.go index 5d69ba1d6..effca0346 100644 --- a/android/module.go +++ b/android/module.go @@ -60,7 +60,7 @@ type Module interface { base() *ModuleBase Disable() - Enabled(ctx ConfigAndErrorContext) bool + Enabled() bool Target() Target MultiTargets() []Target @@ -287,7 +287,7 @@ type commonProperties struct { // but are not usually required (e.g. superceded by a prebuilt) should not be // disabled as that will prevent them from being built by the checkbuild target // and so prevent early detection of changes that have broken those modules. - Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"` + Enabled *bool `android:"arch_variant"` // Controls the visibility of this module to other modules. Allowable values are one or more of // these formats: @@ -1392,11 +1392,14 @@ func (m *ModuleBase) PartitionTag(config DeviceConfig) string { return partition } -func (m *ModuleBase) Enabled(ctx ConfigAndErrorContext) bool { +func (m *ModuleBase) Enabled() bool { if m.commonProperties.ForcedDisabled { return false } - return m.commonProperties.Enabled.GetOrDefault(m.ConfigurableEvaluator(ctx), !m.Os().DefaultDisabled) + if m.commonProperties.Enabled == nil { + return !m.Os().DefaultDisabled + } + return *m.commonProperties.Enabled } func (m *ModuleBase) Disable() { @@ -1640,7 +1643,7 @@ func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) { // not be created if the module is not exported to make. // Those could depend on the build target and fail to compile // for the current build target. - if !ctx.Config().KatiEnabled() || !shouldSkipAndroidMkProcessing(ctx, a) { + if !ctx.Config().KatiEnabled() || !shouldSkipAndroidMkProcessing(a) { allCheckbuildFiles = append(allCheckbuildFiles, a.checkbuildFiles...) } }) @@ -1832,7 +1835,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) checkDistProperties(ctx, fmt.Sprintf("dists[%d]", i), &m.distProperties.Dists[i]) } - if m.Enabled(ctx) { + if m.Enabled() { // ensure all direct android.Module deps are enabled ctx.VisitDirectDepsBlueprint(func(bm blueprint.Module) { if m, ok := bm.(Module); ok { @@ -2133,7 +2136,7 @@ func (m *ModuleBase) ConfigurableEvaluator(ctx ConfigAndErrorContext) proptools. } func (e configurationEvalutor) PropertyErrorf(property string, fmt string, args ...interface{}) { - e.ctx.OtherModulePropertyErrorf(e.m, property, fmt, args...) + e.ctx.OtherModulePropertyErrorf(e.m, property, fmt, args) } func (e configurationEvalutor) EvaluateConfiguration(condition proptools.ConfigurableCondition, property string) proptools.ConfigurableValue { @@ -2532,7 +2535,7 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx SingletonContext) { } osDeps := map[osAndCross]Paths{} ctx.VisitAllModules(func(module Module) { - if module.Enabled(ctx) { + if module.Enabled() { key := osAndCross{os: module.Target().Os, hostCross: module.Target().HostCross} osDeps[key] = append(osDeps[key], module.base().checkbuildFiles...) } diff --git a/android/mutator.go b/android/mutator.go index 5abb05de7..75ba65048 100644 --- a/android/mutator.go +++ b/android/mutator.go @@ -674,11 +674,13 @@ func RegisterComponentsMutator(ctx RegisterMutatorsContext) { // on component modules to be added so that they can depend directly on a prebuilt // module. func componentDepsMutator(ctx BottomUpMutatorContext) { - ctx.Module().ComponentDepsMutator(ctx) + if m := ctx.Module(); m.Enabled() { + m.ComponentDepsMutator(ctx) + } } func depsMutator(ctx BottomUpMutatorContext) { - if m := ctx.Module(); m.Enabled(ctx) { + if m := ctx.Module(); m.Enabled() { m.base().baseDepsMutator(ctx) m.DepsMutator(ctx) } diff --git a/android/override_module.go b/android/override_module.go index 21cf38125..1341f537c 100644 --- a/android/override_module.go +++ b/android/override_module.go @@ -322,7 +322,7 @@ func performOverrideMutator(ctx BottomUpMutatorContext) { } func overridableModuleDepsMutator(ctx BottomUpMutatorContext) { - if b, ok := ctx.Module().(OverridableModule); ok && b.Enabled(ctx) { + if b, ok := ctx.Module().(OverridableModule); ok && b.Enabled() { b.OverridablePropertiesDepsMutator(ctx) } } diff --git a/android/paths.go b/android/paths.go index f5bdb3867..2b33f67ce 100644 --- a/android/paths.go +++ b/android/paths.go @@ -60,7 +60,6 @@ type EarlyModulePathContext interface { ModuleDir() string ModuleErrorf(fmt string, args ...interface{}) - OtherModulePropertyErrorf(module Module, property, fmt string, args ...interface{}) } var _ EarlyModulePathContext = ModuleContext(nil) @@ -551,7 +550,7 @@ func getPathsFromModuleDep(ctx ModuleWithDepsPathContext, path, moduleName, tag if module == nil { return nil, missingDependencyError{[]string{moduleName}} } - if aModule, ok := module.(Module); ok && !aModule.Enabled(ctx) { + if aModule, ok := module.(Module); ok && !aModule.Enabled() { return nil, missingDependencyError{[]string{moduleName}} } if outProducer, ok := module.(OutputFileProducer); ok { diff --git a/android/prebuilt.go b/android/prebuilt.go index 1f9b33111..2b7b55b5d 100644 --- a/android/prebuilt.go +++ b/android/prebuilt.go @@ -275,7 +275,7 @@ func InitSingleSourcePrebuiltModule(module PrebuiltInterface, srcProps interface srcPropertyName := proptools.PropertyNameForField(srcField) srcsSupplier := func(ctx BaseModuleContext, _ Module) []string { - if !module.Enabled(ctx) { + if !module.Enabled() { return nil } value := srcPropsValue.FieldByIndex(srcFieldIndex) @@ -425,7 +425,7 @@ func PrebuiltSourceDepsMutator(ctx BottomUpMutatorContext) { m := ctx.Module() // If this module is a prebuilt, is enabled and has not been renamed to source then add a // dependency onto the source if it is present. - if p := GetEmbeddedPrebuilt(m); p != nil && m.Enabled(ctx) && !p.properties.PrebuiltRenamedToSource { + if p := GetEmbeddedPrebuilt(m); p != nil && m.Enabled() && !p.properties.PrebuiltRenamedToSource { bmn, _ := m.(baseModuleName) name := bmn.BaseModuleName() if ctx.OtherModuleReverseDependencyVariantExists(name) { @@ -702,7 +702,7 @@ func (p *Prebuilt) usePrebuilt(ctx BaseMutatorContext, source Module, prebuilt M } // If source is not available or is disabled then always use the prebuilt. - if source == nil || !source.Enabled(ctx) { + if source == nil || !source.Enabled() { return true } diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go index 5e1431c6f..2574ed487 100644 --- a/android/prebuilt_test.go +++ b/android/prebuilt_test.go @@ -351,7 +351,7 @@ func TestPrebuilts(t *testing.T) { } }) - moduleIsDisabled := !foo.Module().Enabled(PanickingConfigAndErrorContext(result.TestContext)) + moduleIsDisabled := !foo.Module().Enabled() deps := foo.Module().(*sourceModule).deps if moduleIsDisabled { if len(deps) > 0 { diff --git a/android/register.go b/android/register.go index aeb3b4c1b..d00c15fd0 100644 --- a/android/register.go +++ b/android/register.go @@ -16,9 +16,8 @@ package android import ( "fmt" - "reflect" - "github.com/google/blueprint" + "reflect" ) // A sortable component is one whose registration order affects the order in which it is executed diff --git a/android/singleton.go b/android/singleton.go index d364384e2..76df1ebba 100644 --- a/android/singleton.go +++ b/android/singleton.go @@ -284,5 +284,5 @@ func (s *singletonContextAdaptor) moduleProvider(module blueprint.Module, provid } func (s *singletonContextAdaptor) OtherModulePropertyErrorf(module Module, property string, format string, args ...interface{}) { - s.blueprintSingletonContext().OtherModulePropertyErrorf(module, property, format, args...) + s.blueprintSingletonContext().OtherModulePropertyErrorf(module, property, format, args) } diff --git a/android/testing.go b/android/testing.go index c692c7295..7b4411e2f 100644 --- a/android/testing.go +++ b/android/testing.go @@ -1287,21 +1287,3 @@ func EnsureListContainsSuffix(t *testing.T, result []string, expected string) { t.Errorf("%q is not found in %v", expected, result) } } - -type panickingConfigAndErrorContext struct { - ctx *TestContext -} - -func (ctx *panickingConfigAndErrorContext) OtherModulePropertyErrorf(module Module, property, fmt string, args ...interface{}) { - panic(ctx.ctx.PropertyErrorf(module, property, fmt, args...).Error()) -} - -func (ctx *panickingConfigAndErrorContext) Config() Config { - return ctx.ctx.Config() -} - -func PanickingConfigAndErrorContext(ctx *TestContext) ConfigAndErrorContext { - return &panickingConfigAndErrorContext{ - ctx: ctx, - } -} diff --git a/android/variable.go b/android/variable.go index 309824fc5..599f88e3f 100644 --- a/android/variable.go +++ b/android/variable.go @@ -58,13 +58,13 @@ type variableProperties struct { // unbundled_build is a catch-all property to annotate modules that don't build in one or // more unbundled branches, usually due to dependencies missing from the manifest. Unbundled_build struct { - Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"` + Enabled *bool `android:"arch_variant"` } `android:"arch_variant"` // similar to `Unbundled_build`, but `Always_use_prebuilt_sdks` means that it uses prebuilt // sdk specifically. Always_use_prebuilt_sdks struct { - Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"` + Enabled *bool `android:"arch_variant"` } `android:"arch_variant"` Malloc_not_svelte struct { diff --git a/apex/apex.go b/apex/apex.go index 12a6c9bf4..ef57d7efc 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -1077,7 +1077,7 @@ type ApexInfoMutator interface { // specific variant to modules that support the ApexInfoMutator. // It also propagates updatable=true to apps of updatable apexes func apexInfoMutator(mctx android.TopDownMutatorContext) { - if !mctx.Module().Enabled(mctx) { + if !mctx.Module().Enabled() { return } @@ -1094,7 +1094,7 @@ func apexInfoMutator(mctx android.TopDownMutatorContext) { // apexStrictUpdatibilityLintMutator propagates strict_updatability_linting to transitive deps of a mainline module // This check is enforced for updatable modules func apexStrictUpdatibilityLintMutator(mctx android.TopDownMutatorContext) { - if !mctx.Module().Enabled(mctx) { + if !mctx.Module().Enabled() { return } if apex, ok := mctx.Module().(*apexBundle); ok && apex.checkStrictUpdatabilityLinting() { @@ -1121,7 +1121,7 @@ func apexStrictUpdatibilityLintMutator(mctx android.TopDownMutatorContext) { // enforceAppUpdatability propagates updatable=true to apps of updatable apexes func enforceAppUpdatability(mctx android.TopDownMutatorContext) { - if !mctx.Module().Enabled(mctx) { + if !mctx.Module().Enabled() { return } if apex, ok := mctx.Module().(*apexBundle); ok && apex.Updatable() { @@ -1199,7 +1199,7 @@ func (a *apexBundle) checkStrictUpdatabilityLinting() bool { // unique apex variations for this module. See android/apex.go for more about unique apex variant. // TODO(jiyong): move this to android/apex.go? func apexUniqueVariationsMutator(mctx android.BottomUpMutatorContext) { - if !mctx.Module().Enabled(mctx) { + if !mctx.Module().Enabled() { return } if am, ok := mctx.Module().(android.ApexModule); ok { @@ -1211,7 +1211,7 @@ func apexUniqueVariationsMutator(mctx android.BottomUpMutatorContext) { // the apex in order to retrieve its contents later. // TODO(jiyong): move this to android/apex.go? func apexTestForDepsMutator(mctx android.BottomUpMutatorContext) { - if !mctx.Module().Enabled(mctx) { + if !mctx.Module().Enabled() { return } if am, ok := mctx.Module().(android.ApexModule); ok { @@ -1226,7 +1226,7 @@ func apexTestForDepsMutator(mctx android.BottomUpMutatorContext) { // TODO(jiyong): move this to android/apex.go? func apexTestForMutator(mctx android.BottomUpMutatorContext) { - if !mctx.Module().Enabled(mctx) { + if !mctx.Module().Enabled() { return } if _, ok := mctx.Module().(android.ApexModule); ok { @@ -1340,7 +1340,7 @@ func apexModuleTypeRequiresVariant(module ApexInfoMutator) bool { // See android.UpdateDirectlyInAnyApex // TODO(jiyong): move this to android/apex.go? func apexDirectlyInAnyMutator(mctx android.BottomUpMutatorContext) { - if !mctx.Module().Enabled(mctx) { + if !mctx.Module().Enabled() { return } if am, ok := mctx.Module().(android.ApexModule); ok { @@ -1968,7 +1968,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, if _, ok := depTag.(android.ExcludeFromApexContentsTag); ok { return false } - if mod, ok := child.(android.Module); ok && !mod.Enabled(ctx) { + if mod, ok := child.(android.Module); ok && !mod.Enabled() { return false } depName := ctx.OtherModuleName(child) diff --git a/apex/apex_test.go b/apex/apex_test.go index 187e30bd0..3e284b186 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -5622,21 +5622,8 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { compile_dex: true, } ` - // This test disables libbar, which causes the ComponentDepsMutator to add - // deps on libbar.stubs and other sub-modules that don't exist. We can - // enable AllowMissingDependencies to work around that, but enabling that - // causes extra checks for missing source files to dex_bootjars, so add those - // to the mock fs as well. - preparer2 := android.GroupFixturePreparers( - preparer, - android.PrepareForTestWithAllowMissingDependencies, - android.FixtureMergeMockFs(map[string][]byte{ - "build/soong/scripts/check_boot_jars/package_allowed_list.txt": nil, - "frameworks/base/config/boot-profile.txt": nil, - }), - ) - ctx := testDexpreoptWithApexes(t, bp, "", preparer2, fragment) + ctx := testDexpreoptWithApexes(t, bp, "", preparer, fragment) checkBootDexJarPath(t, ctx, "libfoo", "out/soong/.intermediates/prebuilt_myapex.deapexer/android_common/deapexer/javalib/libfoo.jar") checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/prebuilt_myapex.deapexer/android_common/deapexer/javalib/libbar.jar") @@ -9254,7 +9241,7 @@ func TestPrebuiltStubLibDep(t *testing.T) { continue } mod := ctx.ModuleForTests(modName, variant).Module().(*cc.Module) - if !mod.Enabled(android.PanickingConfigAndErrorContext(ctx)) || mod.IsHideFromMake() { + if !mod.Enabled() || mod.IsHideFromMake() { continue } for _, ent := range android.AndroidMkEntriesForTest(t, ctx, mod) { diff --git a/cc/cc.go b/cc/cc.go index 7fd4a2ef8..e3954d7a8 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -2508,7 +2508,7 @@ func (c *Module) shouldUseApiSurface() bool { } func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) { - if !c.Enabled(actx) { + if !c.Enabled() { return } @@ -2756,7 +2756,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) { } func BeginMutator(ctx android.BottomUpMutatorContext) { - if c, ok := ctx.Module().(*Module); ok && c.Enabled(ctx) { + if c, ok := ctx.Module().(*Module); ok && c.Enabled() { c.beginMutator(ctx) } } diff --git a/cc/fuzz.go b/cc/fuzz.go index 6144046de..2436f33d2 100644 --- a/cc/fuzz.go +++ b/cc/fuzz.go @@ -352,14 +352,18 @@ func NewFuzzer(hod android.HostOrDeviceSupported) *Module { Sanitize struct { Fuzzer *bool } - Enabled proptools.Configurable[bool] + Target struct { + Darwin struct { + Enabled *bool + } + Linux_bionic struct { + Enabled *bool + } + } }{} extraProps.Sanitize.Fuzzer = BoolPtr(true) - extraProps.Enabled = android.CreateSelectOsToBool(map[string]*bool{ - "": nil, - "darwin": proptools.BoolPtr(false), - "linux_bionic": proptools.BoolPtr(false), - }) + extraProps.Target.Darwin.Enabled = BoolPtr(false) + extraProps.Target.Linux_bionic.Enabled = BoolPtr(false) ctx.AppendProperties(&extraProps) targetFramework := fuzz.GetFramework(ctx, fuzz.Cc) @@ -429,7 +433,7 @@ func (s *ccRustFuzzPackager) GenerateBuildActions(ctx android.SingletonContext) return } // Discard non-fuzz targets. - if ok := fuzz.IsValid(ctx, ccModule.FuzzModuleStruct()); !ok { + if ok := fuzz.IsValid(ccModule.FuzzModuleStruct()); !ok { return } diff --git a/cc/makevars.go b/cc/makevars.go index 51bcbf090..9251d6a49 100644 --- a/cc/makevars.go +++ b/cc/makevars.go @@ -279,7 +279,7 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string, sanitizerLibs := android.SortedStringValues(sanitizerVariables) var sanitizerLibStems []string ctx.VisitAllModules(func(m android.Module) { - if !m.Enabled(ctx) { + if !m.Enabled() { return } diff --git a/cc/ndk_abi.go b/cc/ndk_abi.go index 5beeab1ee..86166dcbb 100644 --- a/cc/ndk_abi.go +++ b/cc/ndk_abi.go @@ -40,7 +40,7 @@ type ndkAbiDumpSingleton struct{} func (n *ndkAbiDumpSingleton) GenerateBuildActions(ctx android.SingletonContext) { var depPaths android.Paths ctx.VisitAllModules(func(module android.Module) { - if !module.Enabled(ctx) { + if !module.Enabled() { return } @@ -78,7 +78,7 @@ type ndkAbiDiffSingleton struct{} func (n *ndkAbiDiffSingleton) GenerateBuildActions(ctx android.SingletonContext) { var depPaths android.Paths ctx.VisitAllModules(func(module android.Module) { - if m, ok := module.(android.Module); ok && !m.Enabled(ctx) { + if m, ok := module.(android.Module); ok && !m.Enabled() { return } diff --git a/cc/ndk_library.go b/cc/ndk_library.go index f32606814..25231fdf5 100644 --- a/cc/ndk_library.go +++ b/cc/ndk_library.go @@ -148,7 +148,7 @@ func ndkLibraryVersions(ctx android.BaseMutatorContext, from android.ApiLevel) [ } func (this *stubDecorator) stubsVersions(ctx android.BaseMutatorContext) []string { - if !ctx.Module().Enabled(ctx) { + if !ctx.Module().Enabled() { return nil } if ctx.Target().NativeBridge == android.NativeBridgeEnabled { diff --git a/cc/ndk_sysroot.go b/cc/ndk_sysroot.go index 3c48f6881..e815172ae 100644 --- a/cc/ndk_sysroot.go +++ b/cc/ndk_sysroot.go @@ -150,7 +150,7 @@ func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) { var installPaths android.Paths var licensePaths android.Paths ctx.VisitAllModules(func(module android.Module) { - if m, ok := module.(android.Module); ok && !m.Enabled(ctx) { + if m, ok := module.(android.Module); ok && !m.Enabled() { return } diff --git a/cc/sanitize.go b/cc/sanitize.go index ef037c3ef..db046ec58 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -858,7 +858,7 @@ func (s *sanitize) flags(ctx ModuleContext, flags Flags) Flags { flags.Local.CFlags = append(flags.Local.CFlags, cfiCflags...) flags.Local.AsFlags = append(flags.Local.AsFlags, cfiAsflags...) - flags.CFlagsDeps = append(flags.CFlagsDeps, android.PathForSource(ctx, cfiBlocklistPath+"/"+cfiBlocklistFilename)) + flags.CFlagsDeps = append(flags.CFlagsDeps, android.PathForSource(ctx, cfiBlocklistPath + "/" + cfiBlocklistFilename)) if Bool(s.Properties.Sanitize.Config.Cfi_assembly_support) { flags.Local.CFlags = append(flags.Local.CFlags, cfiAssemblySupportFlag) } @@ -1371,7 +1371,7 @@ func sanitizerRuntimeDepsMutator(mctx android.TopDownMutatorContext) { // Add the dependency to the runtime library for each of the sanitizer variants func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) { if c, ok := mctx.Module().(*Module); ok && c.sanitize != nil { - if !c.Enabled(mctx) { + if !c.Enabled() { return } var sanitizers []string diff --git a/cc/tidy.go b/cc/tidy.go index ec1e8a206..76ac7d583 100644 --- a/cc/tidy.go +++ b/cc/tidy.go @@ -220,7 +220,7 @@ func collectTidyObjModuleTargets(ctx android.SingletonContext, module android.Mo // (1) Collect all obj/tidy files into OS-specific groups. ctx.VisitAllModuleVariants(module, func(variant android.Module) { - if ctx.Config().KatiEnabled() && android.ShouldSkipAndroidMkProcessing(ctx, variant) { + if ctx.Config().KatiEnabled() && android.ShouldSkipAndroidMkProcessing(variant) { return } if m, ok := variant.(*Module); ok { diff --git a/cc/vndk.go b/cc/vndk.go index 046368505..14b44b643 100644 --- a/cc/vndk.go +++ b/cc/vndk.go @@ -323,8 +323,8 @@ func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) { } // Check for modules that mustn't be VNDK -func shouldSkipVndkMutator(ctx android.ConfigAndErrorContext, m *Module) bool { - if !m.Enabled(ctx) { +func shouldSkipVndkMutator(m *Module) bool { + if !m.Enabled() { return true } if !m.Device() { @@ -339,7 +339,7 @@ func shouldSkipVndkMutator(ctx android.ConfigAndErrorContext, m *Module) bool { } func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool { - if shouldSkipVndkMutator(mctx, m) { + if shouldSkipVndkMutator(m) { return false } @@ -370,7 +370,7 @@ func VndkMutator(mctx android.BottomUpMutatorContext) { return } - if shouldSkipVndkMutator(mctx, m) { + if shouldSkipVndkMutator(m) { return } @@ -577,7 +577,6 @@ func (txt *vndkLibrariesTxt) SubDir() string { func (txt *vndkLibrariesTxt) OutputFiles(tag string) (android.Paths, error) { return android.Paths{txt.outputFile}, nil } - func getVndkFileName(m *Module) (string, error) { if library, ok := m.linker.(*libraryDecorator); ok { return library.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil diff --git a/fuzz/fuzz_common.go b/fuzz/fuzz_common.go index 306d65e29..47fd8f439 100644 --- a/fuzz/fuzz_common.go +++ b/fuzz/fuzz_common.go @@ -449,10 +449,10 @@ func IsValidFrameworkForModule(targetFramework Framework, lang Lang, moduleFrame } } -func IsValid(ctx android.ConfigAndErrorContext, fuzzModule FuzzModule) bool { +func IsValid(fuzzModule FuzzModule) bool { // Discard ramdisk + vendor_ramdisk + recovery modules, they're duplicates of // fuzz targets we're going to package anyway. - if !fuzzModule.Enabled(ctx) || fuzzModule.InRamdisk() || fuzzModule.InVendorRamdisk() || fuzzModule.InRecovery() { + if !fuzzModule.Enabled() || fuzzModule.InRamdisk() || fuzzModule.InVendorRamdisk() || fuzzModule.InRecovery() { return false } diff --git a/genrule/genrule.go b/genrule/genrule.go index e7d895a67..43f4fe5ee 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -299,7 +299,7 @@ func (g *Module) generateCommonBuildActions(ctx android.ModuleContext) { case android.HostToolProvider: // A HostToolProvider provides the path to a tool, which will be copied // into the sandbox. - if !t.(android.Module).Enabled(ctx) { + if !t.(android.Module).Enabled() { if ctx.Config().AllowMissingDependencies() { ctx.AddMissingDependencies([]string{tool}) } else { diff --git a/java/app_import_test.go b/java/app_import_test.go index 496fc1308..5de50e794 100644 --- a/java/app_import_test.go +++ b/java/app_import_test.go @@ -509,7 +509,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { variant := ctx.ModuleForTests("foo", "android_common") if test.expected == "" { - if variant.Module().Enabled(android.PanickingConfigAndErrorContext(ctx)) { + if variant.Module().Enabled() { t.Error("module should have been disabled, but wasn't") } rule := variant.MaybeRule("genProvenanceMetaData") @@ -586,7 +586,7 @@ func TestAndroidAppImport_SoongConfigVariables(t *testing.T) { variant := ctx.ModuleForTests("foo", "android_common") if test.expected == "" { - if variant.Module().Enabled(android.PanickingConfigAndErrorContext(ctx)) { + if variant.Module().Enabled() { t.Error("module should have been disabled, but wasn't") } rule := variant.MaybeRule("genProvenanceMetaData") @@ -629,7 +629,7 @@ func TestAndroidAppImport_overridesDisabledAndroidApp(t *testing.T) { if !a.prebuilt.UsePrebuilt() { t.Errorf("prebuilt foo module is not active") } - if !a.Enabled(android.PanickingConfigAndErrorContext(ctx)) { + if !a.Enabled() { t.Errorf("prebuilt foo module is disabled") } } diff --git a/java/boot_jars.go b/java/boot_jars.go index 6223dede8..5d40ec389 100644 --- a/java/boot_jars.go +++ b/java/boot_jars.go @@ -21,8 +21,8 @@ import ( // isActiveModule returns true if the given module should be considered for boot // jars, i.e. if it's enabled and the preferred one in case of source and // prebuilt alternatives. -func isActiveModule(ctx android.ConfigAndErrorContext, module android.Module) bool { - if !module.Enabled(ctx) { +func isActiveModule(module android.Module) bool { + if !module.Enabled() { return false } return android.IsModulePreferred(module) diff --git a/java/bootclasspath.go b/java/bootclasspath.go index 77ddf5c05..c7dc3afae 100644 --- a/java/bootclasspath.go +++ b/java/bootclasspath.go @@ -127,10 +127,7 @@ func reportMissingVariationDependency(ctx android.BottomUpMutatorContext, variat // added by addDependencyOntoApexModulePair. func gatherApexModulePairDepsWithTag(ctx android.BaseModuleContext, tag blueprint.DependencyTag) []android.Module { var modules []android.Module - isActiveModulePred := func(module android.Module) bool { - return isActiveModule(ctx, module) - } - ctx.VisitDirectDepsIf(isActiveModulePred, func(module android.Module) { + ctx.VisitDirectDepsIf(isActiveModule, func(module android.Module) { t := ctx.OtherModuleDependencyTag(module) if t == tag { modules = append(modules, module) diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index 82a34ca9d..cc3da7656 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -474,7 +474,7 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo // Only perform a consistency check if this module is the active module. That will prevent an // unused prebuilt that was created without instrumentation from breaking an instrumentation // build. - if isActiveModule(ctx, ctx.Module()) { + if isActiveModule(ctx.Module()) { b.bootclasspathFragmentPropertyCheck(ctx) } @@ -519,7 +519,7 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo // empty string if this module should not provide a boot image profile. func (b *BootclasspathFragmentModule) getProfileProviderApex(ctx android.BaseModuleContext) string { // Only use the profile from the module that is preferred. - if !isActiveModule(ctx, ctx.Module()) { + if !isActiveModule(ctx.Module()) { return "" } @@ -590,7 +590,7 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext) // So ignore it even if it is not in PRODUCT_APEX_BOOT_JARS. // TODO(b/202896428): Add better way to handle this. _, unknown = android.RemoveFromList("android.car-module", unknown) - if isActiveModule(ctx, ctx.Module()) && len(unknown) > 0 { + if isActiveModule(ctx.Module()) && len(unknown) > 0 { ctx.ModuleErrorf("%s in contents must also be declared in PRODUCT_APEX_BOOT_JARS", unknown) } } diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 7229ca02d..f7e3cb93a 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -562,7 +562,7 @@ func gatherBootclasspathFragments(ctx android.ModuleContext) map[string]android. return ctx.Config().Once(dexBootJarsFragmentsKey, func() interface{} { fragments := make(map[string]android.Module) ctx.WalkDeps(func(child, parent android.Module) bool { - if !isActiveModule(ctx, child) { + if !isActiveModule(child) { return false } tag := ctx.OtherModuleDependencyTag(child) @@ -1125,7 +1125,7 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p image.unstrippedInstalls = unstrippedInstalls // Only set the licenseMetadataFile from the active module. - if isActiveModule(ctx, ctx.Module()) { + if isActiveModule(ctx.Module()) { image.licenseMetadataFile = android.OptionalPathForPath(ctx.LicenseMetadataFile()) } diff --git a/java/fuzz.go b/java/fuzz.go index 78ab10891..fb31ce794 100644 --- a/java/fuzz.go +++ b/java/fuzz.go @@ -69,13 +69,13 @@ func JavaFuzzFactory() android.Module { android.AddLoadHook(module, func(ctx android.LoadHookContext) { disableLinuxBionic := struct { - Enabled proptools.Configurable[bool] - }{ - Enabled: android.CreateSelectOsToBool(map[string]*bool{ - "": nil, - "linux_bionic": proptools.BoolPtr(false), - }), - } + Target struct { + Linux_bionic struct { + Enabled *bool + } + } + }{} + disableLinuxBionic.Target.Linux_bionic.Enabled = proptools.BoolPtr(false) ctx.AppendProperties(&disableLinuxBionic) }) @@ -179,7 +179,7 @@ func (s *javaFuzzPackager) GenerateBuildActions(ctx android.SingletonContext) { javaFuzzModule.ApexModuleBase, } - if ok := fuzz.IsValid(ctx, fuzzModuleValidator); !ok { + if ok := fuzz.IsValid(fuzzModuleValidator); !ok { return } diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go index cab5402e9..ae587eac3 100644 --- a/java/hiddenapi_modular.go +++ b/java/hiddenapi_modular.go @@ -1428,7 +1428,7 @@ func deferReportingMissingBootDexJar(ctx android.ModuleContext, module android.M // should not contribute to anything. So, rather than have a missing dex jar cause a Soong // failure defer the error reporting to Ninja. Unless the prebuilt build target is explicitly // built Ninja should never use the dex jar file. - if !isActiveModule(ctx, module) { + if !isActiveModule(module) { return true } diff --git a/java/jacoco.go b/java/jacoco.go index 696a0cc37..a820b3855 100644 --- a/java/jacoco.go +++ b/java/jacoco.go @@ -53,7 +53,7 @@ func jacocoDepsMutator(ctx android.BottomUpMutatorContext) { } j, ok := ctx.Module().(instrumentable) - if !ctx.Module().Enabled(ctx) || !ok { + if !ctx.Module().Enabled() || !ok { return } diff --git a/java/jdeps.go b/java/jdeps.go index 340026318..91f7ce715 100644 --- a/java/jdeps.go +++ b/java/jdeps.go @@ -48,7 +48,7 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont moduleInfos := make(map[string]android.IdeInfo) ctx.VisitAllModules(func(module android.Module) { - if !module.Enabled(ctx) { + if !module.Enabled() { return } diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go index 99fa092be..2fc6c02a6 100644 --- a/java/platform_compat_config.go +++ b/java/platform_compat_config.go @@ -19,7 +19,6 @@ import ( "path/filepath" "android/soong/android" - "github.com/google/blueprint" "github.com/google/blueprint/proptools" ) @@ -234,7 +233,7 @@ func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.Singlet var compatConfigMetadata android.Paths ctx.VisitAllModules(func(module android.Module) { - if !module.Enabled(ctx) { + if !module.Enabled() { return } if c, ok := module.(platformCompatConfigMetadataProvider); ok { diff --git a/java/sdk_library.go b/java/sdk_library.go index 2b6c8f8de..113071fbb 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -2294,7 +2294,7 @@ func (module *SdkLibrary) getApiDir() string { // once for public API level and once for system API level func (module *SdkLibrary) CreateInternalModules(mctx android.DefaultableHookContext) { // If the module has been disabled then don't create any child modules. - if !module.Enabled(mctx) { + if !module.Enabled() { return } diff --git a/provenance/provenance_singleton.go b/provenance/provenance_singleton.go index 679632c10..97345afc3 100644 --- a/provenance/provenance_singleton.go +++ b/provenance/provenance_singleton.go @@ -18,7 +18,6 @@ package provenance import ( "android/soong/android" - "github.com/google/blueprint" ) @@ -69,15 +68,6 @@ type provenanceInfoSingleton struct { func (p *provenanceInfoSingleton) GenerateBuildActions(context android.SingletonContext) { allMetaDataFiles := make([]android.Path, 0) - moduleFilter := func(module android.Module) bool { - if !module.Enabled(context) || module.IsSkipInstall() { - return false - } - if p, ok := module.(ProvenanceMetadata); ok { - return p.ProvenanceMetaDataFile().String() != "" - } - return false - } context.VisitAllModulesIf(moduleFilter, func(module android.Module) { if p, ok := module.(ProvenanceMetadata); ok { allMetaDataFiles = append(allMetaDataFiles, p.ProvenanceMetaDataFile()) @@ -101,6 +91,16 @@ func (p *provenanceInfoSingleton) GenerateBuildActions(context android.Singleton context.Phony("droidcore", android.PathForPhony(context, "provenance_metadata")) } +func moduleFilter(module android.Module) bool { + if !module.Enabled() || module.IsSkipInstall() { + return false + } + if p, ok := module.(ProvenanceMetadata); ok { + return p.ProvenanceMetaDataFile().String() != "" + } + return false +} + func GenerateArtifactProvenanceMetaData(ctx android.ModuleContext, artifactPath android.Path, installedFile android.InstallPath) android.OutputPath { onDevicePathOfInstalledFile := android.InstallPathToOnDevicePath(ctx, installedFile) artifactMetaDataFile := android.PathForIntermediates(ctx, "provenance_metadata", ctx.ModuleDir(), ctx.ModuleName(), "provenance_metadata.textproto") diff --git a/rust/afdo.go b/rust/afdo.go index 6bd4bae1a..6116c5e21 100644 --- a/rust/afdo.go +++ b/rust/afdo.go @@ -39,7 +39,7 @@ func (afdo *afdo) addDep(ctx BaseModuleContext, actx android.BottomUpMutatorCont return } - if mod, ok := ctx.Module().(*Module); ok && mod.Enabled(ctx) { + if mod, ok := ctx.Module().(*Module); ok && mod.Enabled() { fdoProfileName, err := actx.DeviceConfig().AfdoProfile(actx.ModuleName()) if err != nil { ctx.ModuleErrorf("%s", err.Error()) diff --git a/rust/doc.go b/rust/doc.go index fe205233d..6970d7979 100644 --- a/rust/doc.go +++ b/rust/doc.go @@ -38,7 +38,7 @@ func (n *rustdocSingleton) GenerateBuildActions(ctx android.SingletonContext) { FlagWithArg("-D ", docDir.String()) ctx.VisitAllModules(func(module android.Module) { - if !module.Enabled(ctx) { + if !module.Enabled() { return } diff --git a/rust/fuzz.go b/rust/fuzz.go index da111b59e..1770d2e65 100644 --- a/rust/fuzz.go +++ b/rust/fuzz.go @@ -20,8 +20,6 @@ import ( "android/soong/fuzz" "android/soong/rust/config" "path/filepath" - - "github.com/google/blueprint/proptools" ) func init() { @@ -66,14 +64,17 @@ func NewRustFuzz(hod android.HostOrDeviceSupported) (*Module, *fuzzDecorator) { android.AddLoadHook(module, func(ctx android.LoadHookContext) { extraProps := struct { - Enabled proptools.Configurable[bool] - }{ - Enabled: android.CreateSelectOsToBool(map[string]*bool{ - "": nil, - "darwin": proptools.BoolPtr(false), - "linux_bionic": proptools.BoolPtr(false), - }), - } + Target struct { + Darwin struct { + Enabled *bool + } + Linux_bionic struct { + Enabled *bool + } + } + }{} + extraProps.Target.Darwin.Enabled = cc.BoolPtr(false) + extraProps.Target.Linux_bionic.Enabled = cc.BoolPtr(false) ctx.AppendProperties(&extraProps) }) diff --git a/rust/library.go b/rust/library.go index f58a54fcc..6be4917bf 100644 --- a/rust/library.go +++ b/rust/library.go @@ -713,7 +713,7 @@ func LibraryMutator(mctx android.BottomUpMutatorContext) { if sourceVariant { sv := modules[0] for _, v := range modules[1:] { - if !v.Enabled(mctx) { + if !v.Enabled() { continue } mctx.AddInterVariantDependency(sourceDepTag, v, sv) diff --git a/rust/project_json.go b/rust/project_json.go index 925dd80bd..ad9b69020 100644 --- a/rust/project_json.go +++ b/rust/project_json.go @@ -119,7 +119,7 @@ func isModuleSupported(ctx android.SingletonContext, module android.Module) (*Mo if !ok { return nil, false } - if !rModule.Enabled(ctx) { + if !rModule.Enabled() { return nil, false } return rModule, true diff --git a/rust/rust.go b/rust/rust.go index de049f77f..c2b61515c 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -1697,7 +1697,7 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) { } func BeginMutator(ctx android.BottomUpMutatorContext) { - if mod, ok := ctx.Module().(*Module); ok && mod.Enabled(ctx) { + if mod, ok := ctx.Module().(*Module); ok && mod.Enabled() { mod.beginMutator(ctx) } } diff --git a/rust/sanitize.go b/rust/sanitize.go index c086880ed..bfd397155 100644 --- a/rust/sanitize.go +++ b/rust/sanitize.go @@ -258,7 +258,7 @@ func (sanitize *sanitize) deps(ctx BaseModuleContext, deps Deps) Deps { func rustSanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) { if mod, ok := mctx.Module().(*Module); ok && mod.sanitize != nil { - if !mod.Enabled(mctx) { + if !mod.Enabled() { return } diff --git a/snapshot/host_fake_snapshot.go b/snapshot/host_fake_snapshot.go index b416ebdd4..63cd4e1b6 100644 --- a/snapshot/host_fake_snapshot.go +++ b/snapshot/host_fake_snapshot.go @@ -116,7 +116,7 @@ func (c *hostFakeSingleton) GenerateBuildActions(ctx android.SingletonContext) { prebuilts[android.RemoveOptionalPrebuiltPrefix(module.Name())] = true return } - if !module.Enabled(ctx) || module.IsHideFromMake() { + if !module.Enabled() || module.IsHideFromMake() { return } apexInfo, _ := android.SingletonModuleProvider(ctx, module, android.ApexInfoProvider)