diff options
Diffstat (limited to 'python/binary.go')
| -rw-r--r-- | python/binary.go | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/python/binary.go b/python/binary.go index e955492a6..bf6167c3c 100644 --- a/python/binary.go +++ b/python/binary.go @@ -37,28 +37,10 @@ func registerPythonBinaryComponents(ctx android.RegistrationContext) { type bazelPythonBinaryAttributes struct { Main string Srcs bazel.LabelListAttribute - Data bazel.LabelListAttribute + Deps bazel.LabelListAttribute 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) { @@ -80,6 +62,7 @@ func PythonBinaryBp2Build(ctx android.TopDownMutatorContext) { } } } + // 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 @@ -97,13 +80,11 @@ func PythonBinaryBp2Build(ctx android.TopDownMutatorContext) { // do nothing, since python_version defaults to PY3. } - srcs := android.BazelLabelForModuleSrcExcludes(ctx, m.properties.Srcs, m.properties.Exclude_srcs) - data := android.BazelLabelForModuleSrc(ctx, m.properties.Data) - + baseAttrs := m.makeArchVariantBaseAttributes(ctx) attrs := &bazelPythonBinaryAttributes{ Main: main, - Srcs: bazel.MakeLabelListAttribute(srcs), - Data: bazel.MakeLabelListAttribute(data), + Srcs: baseAttrs.Srcs, + Deps: baseAttrs.Deps, Python_version: python_version, } @@ -112,7 +93,10 @@ func PythonBinaryBp2Build(ctx android.TopDownMutatorContext) { Rule_class: "py_binary", } - ctx.CreateBazelTargetModule(BazelPythonBinaryFactory, m.Name(), props, attrs) + ctx.CreateBazelTargetModule(props, android.CommonAttributes{ + Name: m.Name(), + Data: baseAttrs.Data, + }, attrs) } type BinaryProperties struct { |