diff options
author | 2023-09-19 20:09:00 +0000 | |
---|---|---|
committer | 2023-09-20 14:49:35 +0000 | |
commit | 637458d3265e3f08cc42dcde3536d8775a2009b9 (patch) | |
tree | e3a34a4757f85a052f91de5b4e7e23cc74408433 /python/bp2build.go | |
parent | 9e12c7863726889853d12d8dea2bf7574b96133e (diff) |
Have ConvertWBp2build use Bp2buildMutatorContext
This no-op refactoring facilitates some upcoming functional changes for
"bp2build allowlist v2". The work requires that the bp2build conversion
mutator be changed from a TopDown mutator to a BottomUp mutator.
Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext
makes it easier to make this functional change without touching tens of
files and multiple projects.
Bug: 285631638
Test: m bp2build
Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
Diffstat (limited to 'python/bp2build.go')
-rw-r--r-- | python/bp2build.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/python/bp2build.go b/python/bp2build.go index 8bc3d0a3e..3b283e432 100644 --- a/python/bp2build.go +++ b/python/bp2build.go @@ -54,7 +54,7 @@ type baseAttributes struct { Imports bazel.StringListAttribute } -func (m *PythonLibraryModule) makeArchVariantBaseAttributes(ctx android.TopDownMutatorContext) baseAttributes { +func (m *PythonLibraryModule) makeArchVariantBaseAttributes(ctx android.Bp2buildMutatorContext) baseAttributes { var attrs baseAttributes archVariantBaseProps := m.GetArchVariantProperties(ctx, &BaseProperties{}) for axis, configToProps := range archVariantBaseProps { @@ -123,7 +123,7 @@ func (m *PythonLibraryModule) makeArchVariantBaseAttributes(ctx android.TopDownM return attrs } -func (m *PythonLibraryModule) bp2buildPythonVersion(ctx android.TopDownMutatorContext) *string { +func (m *PythonLibraryModule) bp2buildPythonVersion(ctx android.Bp2buildMutatorContext) *string { py3Enabled := proptools.BoolDefault(m.properties.Version.Py3.Enabled, true) py2Enabled := proptools.BoolDefault(m.properties.Version.Py2.Enabled, false) if py2Enabled && !py3Enabled { @@ -146,7 +146,7 @@ type bazelPythonBinaryAttributes struct { Imports bazel.StringListAttribute } -func (p *PythonLibraryModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) { +func (p *PythonLibraryModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) { // TODO(b/182306917): this doesn't fully handle all nested props versioned // by the python version, which would have been handled by the version split // mutator. This is sufficient for very simple python_library modules under @@ -176,7 +176,7 @@ func (p *PythonLibraryModule) ConvertWithBp2build(ctx android.TopDownMutatorCont }, attrs) } -func (p *PythonBinaryModule) bp2buildBinaryProperties(ctx android.TopDownMutatorContext) (*bazelPythonBinaryAttributes, bazel.LabelListAttribute) { +func (p *PythonBinaryModule) bp2buildBinaryProperties(ctx android.Bp2buildMutatorContext) (*bazelPythonBinaryAttributes, bazel.LabelListAttribute) { // TODO(b/182306917): this doesn't fully handle all nested props versioned // by the python version, which would have been handled by the version split // mutator. This is sufficient for very simple python_binary_host modules @@ -209,7 +209,7 @@ func (p *PythonBinaryModule) bp2buildBinaryProperties(ctx android.TopDownMutator return attrs, baseAttrs.Data } -func (p *PythonBinaryModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) { +func (p *PythonBinaryModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) { attrs, data := p.bp2buildBinaryProperties(ctx) props := bazel.BazelTargetModuleProperties{ @@ -223,7 +223,7 @@ func (p *PythonBinaryModule) ConvertWithBp2build(ctx android.TopDownMutatorConte }, attrs) } -func (p *PythonTestModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) { +func (p *PythonTestModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) { // Python tests are currently exactly the same as binaries, but with a different module type attrs, data := p.bp2buildBinaryProperties(ctx) |