Remove MutatorHandle.Parallel()
All mutators are parallel by default, remove the explicit Parallel()
calls.
Bug: 372540665
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I41e3a71bd13c75b7fceae91b1c4cfe678ab62df2
diff --git a/android/defaults.go b/android/defaults.go
index 8fe2879..510ebe0 100644
--- a/android/defaults.go
+++ b/android/defaults.go
@@ -273,8 +273,8 @@
}
func RegisterDefaultsPreArchMutators(ctx RegisterMutatorsContext) {
- ctx.BottomUp("defaults_deps", defaultsDepsMutator).Parallel()
- ctx.BottomUp("defaults", defaultsMutator).Parallel().UsesCreateModule()
+ ctx.BottomUp("defaults_deps", defaultsDepsMutator)
+ ctx.BottomUp("defaults", defaultsMutator).UsesCreateModule()
}
func defaultsDepsMutator(ctx BottomUpMutatorContext) {
diff --git a/android/licenses.go b/android/licenses.go
index be1eede..949d678 100644
--- a/android/licenses.go
+++ b/android/licenses.go
@@ -106,19 +106,19 @@
//
// This goes before defaults expansion so the defaults can pick up the package default.
func RegisterLicensesPackageMapper(ctx RegisterMutatorsContext) {
- ctx.BottomUp("licensesPackageMapper", licensesPackageMapper).Parallel()
+ ctx.BottomUp("licensesPackageMapper", licensesPackageMapper)
}
// Registers the function that gathers the license dependencies for each module.
//
// This goes after defaults expansion so that it can pick up default licenses and before visibility enforcement.
func RegisterLicensesPropertyGatherer(ctx RegisterMutatorsContext) {
- ctx.BottomUp("licensesPropertyGatherer", licensesPropertyGatherer).Parallel()
+ ctx.BottomUp("licensesPropertyGatherer", licensesPropertyGatherer)
}
// Registers the function that verifies the licenses and license_kinds dependency types for each module.
func RegisterLicensesDependencyChecker(ctx RegisterMutatorsContext) {
- ctx.BottomUp("licensesPropertyChecker", licensesDependencyChecker).Parallel()
+ ctx.BottomUp("licensesPropertyChecker", licensesDependencyChecker)
}
// Maps each package to its default applicable licenses.
diff --git a/android/mutator.go b/android/mutator.go
index 0da3ec7..6bd2e60 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -211,10 +211,7 @@
// AddDependency adds a dependency to the given module. It returns a slice of modules for each
// dependency (some entries may be nil).
//
- // If the mutator is parallel (see MutatorHandle.Parallel), this method will pause until the
- // new dependencies have had the current mutator called on them. If the mutator is not
- // parallel this method does not affect the ordering of the current mutator pass, but will
- // be ordered correctly for all future mutator passes.
+ // This method will pause until the new dependencies have had the current mutator called on them.
AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string) []blueprint.Module
// AddReverseDependency adds a dependency from the destination to the given module.
@@ -230,10 +227,7 @@
// each dependency (some entries may be nil). A variant of the dependency must exist that matches
// all the non-local variations of the current module, plus the variations argument.
//
- // If the mutator is parallel (see MutatorHandle.Parallel), this method will pause until the
- // new dependencies have had the current mutator called on them. If the mutator is not
- // parallel this method does not affect the ordering of the current mutator pass, but will
- // be ordered correctly for all future mutator passes.
+ // This method will pause until the new dependencies have had the current mutator called on them.
AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag, names ...string) []blueprint.Module
// AddReverseVariationDependency adds a dependency from the named module to the current
@@ -256,10 +250,7 @@
// Unlike AddVariationDependencies, the variations of the current module are ignored - the
// dependency only needs to match the supplied variations.
//
- // If the mutator is parallel (see MutatorHandle.Parallel), this method will pause until the
- // new dependencies have had the current mutator called on them. If the mutator is not
- // parallel this method does not affect the ordering of the current mutator pass, but will
- // be ordered correctly for all future mutator passes.
+ // This method will pause until the new dependencies have had the current mutator called on them.
AddFarVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string) []blueprint.Module
// ReplaceDependencies finds all the variants of the module with the specified name, then
@@ -628,9 +619,6 @@
}
// Forward booleans set on the MutatorHandle to the blueprint.MutatorHandle.
- if mutator.parallel {
- handle.Parallel()
- }
if mutator.usesRename {
handle.UsesRename()
}
@@ -655,6 +643,7 @@
// Parallel sets the mutator to visit modules in parallel while maintaining ordering. Calling any
// method on the mutator context is thread-safe, but the mutator must handle synchronization
// for any modifications to global state or any modules outside the one it was invoked on.
+ // Deprecated: all Mutators are parallel by default.
Parallel() MutatorHandle
// UsesRename marks the mutator as using the BottomUpMutatorContext.Rename method, which prevents
@@ -683,7 +672,6 @@
}
func (mutator *mutator) Parallel() MutatorHandle {
- mutator.parallel = true
return mutator
}
@@ -718,7 +706,7 @@
}
func RegisterComponentsMutator(ctx RegisterMutatorsContext) {
- ctx.BottomUp("component-deps", componentDepsMutator).Parallel()
+ ctx.BottomUp("component-deps", componentDepsMutator)
}
// A special mutator that runs just prior to the deps mutator to allow the dependencies
@@ -736,7 +724,7 @@
}
func registerDepsMutator(ctx RegisterMutatorsContext) {
- ctx.BottomUp("deps", depsMutator).Parallel().UsesReverseDependencies()
+ ctx.BottomUp("deps", depsMutator).UsesReverseDependencies()
}
// android.topDownMutatorContext either has to embed blueprint.TopDownMutatorContext, in which case every method that
diff --git a/android/mutator_test.go b/android/mutator_test.go
index d8d4450..1d5f890 100644
--- a/android/mutator_test.go
+++ b/android/mutator_test.go
@@ -238,7 +238,7 @@
if !strings.HasPrefix(ctx.ModuleName(), "common_dep") {
ctx.AddFarVariationDependencies([]blueprint.Variation{}, dep1Tag, "common_dep_1")
}
- }).Parallel()
+ })
ctx.Transition("variant", &testTransitionMutator{
split: func(ctx BaseModuleContext) []string {
return []string{"a", "b"}
@@ -251,7 +251,7 @@
if !strings.HasPrefix(ctx.ModuleName(), "common_dep") {
ctx.AddFarVariationDependencies([]blueprint.Variation{}, dep2Tag, "common_dep_2")
}
- }).Parallel()
+ })
ctx.BottomUp("final", func(ctx BottomUpMutatorContext) {
counter, _ := finalGot.LoadOrStore(ctx.Module().String(), &atomic.Int64{})
counter.(*atomic.Int64).Add(1)
@@ -259,7 +259,7 @@
counter, _ := finalGot.LoadOrStore(fmt.Sprintf("%s -> %s", ctx.Module().String(), mod), &atomic.Int64{})
counter.(*atomic.Int64).Add(1)
})
- }).Parallel()
+ })
})
ctx.RegisterModuleType("test", mutatorTestModuleFactory)
diff --git a/android/namespace.go b/android/namespace.go
index 866d125..8b3ebc4 100644
--- a/android/namespace.go
+++ b/android/namespace.go
@@ -457,7 +457,7 @@
}
func RegisterNamespaceMutator(ctx RegisterMutatorsContext) {
- ctx.BottomUp("namespace_deps", namespaceMutator).Parallel().MutatesGlobalState()
+ ctx.BottomUp("namespace_deps", namespaceMutator).MutatesGlobalState()
}
func namespaceMutator(ctx BottomUpMutatorContext) {
diff --git a/android/neverallow.go b/android/neverallow.go
index e135f57..e93763b 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -44,7 +44,7 @@
// - it has none of the "Without" properties matched (same rules as above)
func registerNeverallowMutator(ctx RegisterMutatorsContext) {
- ctx.BottomUp("neverallow", neverallowMutator).Parallel()
+ ctx.BottomUp("neverallow", neverallowMutator)
}
var neverallows = []Rule{}
diff --git a/android/override_module.go b/android/override_module.go
index d844da6..50ddc9b 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -234,18 +234,18 @@
// Mutators for override/overridable modules. All the fun happens in these functions. It is critical
// to keep them in this order and not put any order mutators between them.
func RegisterOverridePostDepsMutators(ctx RegisterMutatorsContext) {
- ctx.BottomUp("override_deps", overrideModuleDepsMutator).Parallel().MutatesDependencies() // modifies deps via addOverride
+ ctx.BottomUp("override_deps", overrideModuleDepsMutator).MutatesDependencies() // modifies deps via addOverride
ctx.Transition("override", &overrideTransitionMutator{})
- ctx.BottomUp("override_apply", overrideApplyMutator).Parallel().MutatesDependencies()
+ ctx.BottomUp("override_apply", overrideApplyMutator).MutatesDependencies()
// overridableModuleDepsMutator calls OverridablePropertiesDepsMutator so that overridable modules can
// add deps from overridable properties.
- ctx.BottomUp("overridable_deps", overridableModuleDepsMutator).Parallel()
+ ctx.BottomUp("overridable_deps", overridableModuleDepsMutator)
// Because overridableModuleDepsMutator is run after PrebuiltPostDepsMutator,
// prebuilt's ReplaceDependencies doesn't affect to those deps added by overridable properties.
// By running PrebuiltPostDepsMutator again after overridableModuleDepsMutator, deps via overridable properties
// can be replaced with prebuilts.
- ctx.BottomUp("replace_deps_on_prebuilts_for_overridable_deps_again", PrebuiltPostDepsMutator).Parallel().UsesReplaceDependencies()
- ctx.BottomUp("replace_deps_on_override", replaceDepsOnOverridingModuleMutator).Parallel().UsesReplaceDependencies()
+ ctx.BottomUp("replace_deps_on_prebuilts_for_overridable_deps_again", PrebuiltPostDepsMutator).UsesReplaceDependencies()
+ ctx.BottomUp("replace_deps_on_override", replaceDepsOnOverridingModuleMutator).UsesReplaceDependencies()
}
type overrideBaseDependencyTag struct {
diff --git a/android/path_properties.go b/android/path_properties.go
index 6210aee..d80a8ed 100644
--- a/android/path_properties.go
+++ b/android/path_properties.go
@@ -27,7 +27,7 @@
// to the output file of the referenced module.
func registerPathDepsMutator(ctx RegisterMutatorsContext) {
- ctx.BottomUp("pathdeps", pathDepsMutator).Parallel()
+ ctx.BottomUp("pathdeps", pathDepsMutator)
}
// The pathDepsMutator automatically adds dependencies on any module that is listed with the
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 017ba76..d50841d 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -400,13 +400,13 @@
}
func RegisterPrebuiltsPreArchMutators(ctx RegisterMutatorsContext) {
- ctx.BottomUp("prebuilt_rename", PrebuiltRenameMutator).Parallel().UsesRename()
+ ctx.BottomUp("prebuilt_rename", PrebuiltRenameMutator).UsesRename()
}
func RegisterPrebuiltsPostDepsMutators(ctx RegisterMutatorsContext) {
- ctx.BottomUp("prebuilt_source", PrebuiltSourceDepsMutator).Parallel().UsesReverseDependencies()
- ctx.BottomUp("prebuilt_select", PrebuiltSelectModuleMutator).Parallel()
- ctx.BottomUp("prebuilt_postdeps", PrebuiltPostDepsMutator).Parallel().UsesReplaceDependencies()
+ ctx.BottomUp("prebuilt_source", PrebuiltSourceDepsMutator).UsesReverseDependencies()
+ ctx.BottomUp("prebuilt_select", PrebuiltSelectModuleMutator)
+ ctx.BottomUp("prebuilt_postdeps", PrebuiltPostDepsMutator).UsesReplaceDependencies()
}
// Returns the name of the source module corresponding to a prebuilt module
diff --git a/android/register.go b/android/register.go
index 94d875d..bb1ead7 100644
--- a/android/register.go
+++ b/android/register.go
@@ -92,7 +92,6 @@
topDownMutator blueprint.TopDownMutator
transitionMutator blueprint.TransitionMutator
- parallel bool
usesRename bool
usesReverseDependencies bool
usesReplaceDependencies bool
diff --git a/android/variable.go b/android/variable.go
index 417ba89..4f6e3ff 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -29,7 +29,7 @@
func registerVariableBuildComponents(ctx RegistrationContext) {
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
- ctx.BottomUp("variable", VariableMutator).Parallel()
+ ctx.BottomUp("variable", VariableMutator)
})
}
diff --git a/android/visibility.go b/android/visibility.go
index 61f2200..cee465e 100644
--- a/android/visibility.go
+++ b/android/visibility.go
@@ -268,7 +268,7 @@
// The rule checker needs to be registered before defaults expansion to correctly check that
// //visibility:xxx isn't combined with other packages in the same list in any one module.
func RegisterVisibilityRuleChecker(ctx RegisterMutatorsContext) {
- ctx.BottomUp("visibilityRuleChecker", visibilityRuleChecker).Parallel()
+ ctx.BottomUp("visibilityRuleChecker", visibilityRuleChecker)
}
// Registers the function that gathers the visibility rules for each module.
@@ -278,12 +278,12 @@
// the complete visibility lists from flat lists and after the package info is gathered to ensure
// that default_visibility is available.
func RegisterVisibilityRuleGatherer(ctx RegisterMutatorsContext) {
- ctx.BottomUp("visibilityRuleGatherer", visibilityRuleGatherer).Parallel()
+ ctx.BottomUp("visibilityRuleGatherer", visibilityRuleGatherer)
}
// This must be registered after the deps have been resolved.
func RegisterVisibilityRuleEnforcer(ctx RegisterMutatorsContext) {
- ctx.BottomUp("visibilityRuleEnforcer", visibilityRuleEnforcer).Parallel()
+ ctx.BottomUp("visibilityRuleEnforcer", visibilityRuleEnforcer)
}
// Checks the per-module visibility rule lists before defaults expansion.