From be46fccc404c18f7b90d370835cfa350db1debd7 Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Mon, 1 Nov 2021 15:32:43 -0400 Subject: 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 --- python/binary.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'python/binary.go') diff --git a/python/binary.go b/python/binary.go index af02de63d..99c625916 100644 --- a/python/binary.go +++ b/python/binary.go @@ -27,7 +27,6 @@ import ( func init() { registerPythonBinaryComponents(android.InitRegistrationContext) - android.RegisterBp2BuildMutator("python_binary_host", PythonBinaryBp2Build) } func registerPythonBinaryComponents(ctx android.RegistrationContext) { @@ -41,17 +40,7 @@ type bazelPythonBinaryAttributes struct { Python_version *string } -func PythonBinaryBp2Build(ctx android.TopDownMutatorContext) { - m, ok := ctx.Module().(*Module) - if !ok || !m.ConvertWithBp2build(ctx) { - return - } - - // a Module can be something other than a python_binary_host - if ctx.ModuleType() != "python_binary_host" { - return - } - +func pythonBinaryBp2Build(ctx android.TopDownMutatorContext, m *Module) { var main *string for _, propIntf := range m.GetProperties() { if props, ok := propIntf.(*BinaryProperties); ok { -- cgit v1.2.3-59-g8ed1b