Use one mutator for all bp2build conversion.
Each conversion required defining a separate mutator, which will each operate on _all_ modules and requires each to repeat checks whether the mutator should operator. Instead, we introduce a single mutator and modules can define a ConvertWithBp2build to implement bp2build conversion for that module. Test: bp2build.sh Bug: 183079158 Change-Id: I99d4b51f441c2903879092c5b56313d606d4338d
This commit is contained in:
@@ -178,13 +178,7 @@ func (ctx *Context) RegisterForBazelConversion() {
|
||||
t.register(ctx)
|
||||
}
|
||||
|
||||
bp2buildMutatorList := []RegisterMutatorFunc{}
|
||||
for t, f := range bp2buildMutators {
|
||||
ctx.config.bp2buildModuleTypeConfig[t] = true
|
||||
bp2buildMutatorList = append(bp2buildMutatorList, f)
|
||||
}
|
||||
|
||||
RegisterMutatorsForBazelConversion(ctx, bp2buildPreArchMutators, bp2buildMutatorList)
|
||||
RegisterMutatorsForBazelConversion(ctx, bp2buildPreArchMutators)
|
||||
}
|
||||
|
||||
// Register the pipeline of singletons, module types, and mutators for
|
||||
@@ -196,15 +190,6 @@ func (ctx *Context) Register() {
|
||||
t.register(ctx)
|
||||
}
|
||||
|
||||
if ctx.config.BazelContext.BazelEnabled() {
|
||||
// Hydrate the configuration of bp2build-enabled module types. This is
|
||||
// required as a signal to identify which modules should be deferred to
|
||||
// Bazel in mixed builds, if it is enabled.
|
||||
for t, _ := range bp2buildMutators {
|
||||
ctx.config.bp2buildModuleTypeConfig[t] = true
|
||||
}
|
||||
}
|
||||
|
||||
mutators := collateGloballyRegisteredMutators()
|
||||
mutators.registerAll(ctx)
|
||||
|
||||
|
Reference in New Issue
Block a user