summaryrefslogtreecommitdiff
path: root/python/binary.go
diff options
context:
space:
mode:
author Liz Kammer <eakammer@google.com> 2021-08-11 00:17:36 -0400
committer Liz Kammer <eakammer@google.com> 2021-08-17 15:57:09 -0400
commit2ada09a5463a0108d713773679c5ba2c35450fa4 (patch)
tree8282440f3f61ee1869a5cb827a7b91d971475236 /python/binary.go
parent0dd067d30908d1cc6d4bfa5e68d6c1c197ecd1d7 (diff)
Don't create a new module for bp2build conversion.
A performance improvement for bp2build as Blueprint/Soong no longer have the overhead of additional modules. The creation of these modules results in: * traversal of additional modules for each subsequent mutator * synchronization over a go channel to collect newly created modules: https://cs.android.com/android/platform/superproject/+/master:build/blueprint/context.go;l=2594,2600;drc=1602226f23181b8c3fbfcaf3358f0297e839d7d3 We avoid both of these by storing the information directly in the underlying module. Also as a fringe benefit, removes some necessary boilerplate for conversion. For benchmarks, reduces runtime ~1% for 1% converted, ~24% for 100% converted. See more: go/benchmarks-for-https:-r.android.com-1792714 Test: ran benchmarks/tests in bp2build Test: build/bazel/ci/bp2build.sh Change-Id: Ie9273b8cbab5bc6edac1728067ce184382feb211
Diffstat (limited to 'python/binary.go')
-rw-r--r--python/binary.go20
1 files changed, 1 insertions, 19 deletions
diff --git a/python/binary.go b/python/binary.go
index e955492a6..b1065369c 100644
--- a/python/binary.go
+++ b/python/binary.go
@@ -41,24 +41,6 @@ type bazelPythonBinaryAttributes struct {
Python_version string
}
-type bazelPythonBinary struct {
- android.BazelTargetModuleBase
- bazelPythonBinaryAttributes
-}
-
-func BazelPythonBinaryFactory() android.Module {
- module := &bazelPythonBinary{}
- module.AddProperties(&module.bazelPythonBinaryAttributes)
- android.InitBazelTargetModule(module)
- return module
-}
-
-func (m *bazelPythonBinary) Name() string {
- return m.BaseModuleName()
-}
-
-func (m *bazelPythonBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
-
func PythonBinaryBp2Build(ctx android.TopDownMutatorContext) {
m, ok := ctx.Module().(*Module)
if !ok || !m.ConvertWithBp2build(ctx) {
@@ -112,7 +94,7 @@ func PythonBinaryBp2Build(ctx android.TopDownMutatorContext) {
Rule_class: "py_binary",
}
- ctx.CreateBazelTargetModule(BazelPythonBinaryFactory, m.Name(), props, attrs)
+ ctx.CreateBazelTargetModule(m.Name(), props, attrs)
}
type BinaryProperties struct {