Merge "Register singletons in api_bp2build"

This commit is contained in:
Spandan Das 2022-12-06 00:57:06 +00:00 committed by Gerrit Code Review
commit c74bf95708

View file

@ -165,29 +165,30 @@ func NewContext(config Config) *Context {
return ctx
}
// RegisterForBazelConversion registers an alternate shadow pipeline of
// singletons, module types and mutators to register for converting Blueprint
// files to semantically equivalent BUILD files.
func (ctx *Context) RegisterForBazelConversion() {
// Helper function to register the module types used in bp2build and
// api_bp2build.
func registerModuleTypes(ctx *Context) {
for _, t := range moduleTypes {
t.register(ctx)
}
// Required for SingletonModule types, even though we are not using them.
for _, t := range singletons {
t.register(ctx)
}
}
// RegisterForBazelConversion registers an alternate shadow pipeline of
// singletons, module types and mutators to register for converting Blueprint
// files to semantically equivalent BUILD files.
func (ctx *Context) RegisterForBazelConversion() {
registerModuleTypes(ctx)
RegisterMutatorsForBazelConversion(ctx, bp2buildPreArchMutators)
}
// RegisterForApiBazelConversion is similar to RegisterForBazelConversion except that
// it only generates API targets in the generated workspace
func (ctx *Context) RegisterForApiBazelConversion() {
for _, t := range moduleTypes {
t.register(ctx)
}
registerModuleTypes(ctx)
RegisterMutatorsForApiBazelConversion(ctx, bp2buildPreArchMutators)
}