bp2build: flatten *_defaults properties.

This CL brings the defaults mutators into bp2build, reusing the
implementation of flattening defaults from *_defaults module deps into
the modules themselves.

This is an approach to converge defaults semantics with Bazel, which
doesn't have existing equivalent abstractions, other than macros, which
require more infrastructure to be built.

Test: TH
Test: build_conversion_test.go
Change-Id: Ia1443f8e6c3eb277fa861bb96625425a22cfc6d7
This commit is contained in:
Jingwen Chen
2021-02-01 00:23:25 -05:00
parent 9da4aa8166
commit 041b184c92
2 changed files with 206 additions and 0 deletions

View File

@@ -48,6 +48,14 @@ func registerMutatorsToContext(ctx *blueprint.Context, mutators []*mutator) {
func RegisterMutatorsForBazelConversion(ctx *blueprint.Context, bp2buildMutators []RegisterMutatorFunc) {
mctx := &registerMutatorsContext{}
sharedMutators := []RegisterMutatorFunc{
RegisterDefaultsPreArchMutators,
}
for _, f := range sharedMutators {
f(mctx)
}
// Register bp2build mutators
for _, f := range bp2buildMutators {
f(mctx)