summaryrefslogtreecommitdiff
path: root/python/python.go
diff options
context:
space:
mode:
author Alex Márquez Pérez Muñíz Díaz Púras Thaureaux <alexmarquez@google.com> 2021-09-17 20:30:21 +0000
committer Alex Márquez Pérez Muñíz Díaz Púras Thaureaux <alexmarquez@google.com> 2021-10-01 19:51:02 +0000
commit19d399d4c58e2883c6aa453d6fad834313ce6d44 (patch)
treeec0a27307e4498bbd35762a0ee677d70a6c212c0 /python/python.go
parent1b5262bd69ad18b66166bd7279ef5cebd068c952 (diff)
Have python_*{,_host} handle arch-variants
Bug: 196081778 Test: TestPython*{,Host}ArchVariance Test: go test Test: mixed_{libc,droid}.sh Change-Id: I89304e58f5bacd61534732bade4ad6bb5f2671c0
Diffstat (limited to 'python/python.go')
-rw-r--r--python/python.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/python/python.go b/python/python.go
index f90017268..401d91fe3 100644
--- a/python/python.go
+++ b/python/python.go
@@ -22,6 +22,7 @@ import (
"regexp"
"strings"
+ "android/soong/bazel"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -120,6 +121,18 @@ type BaseProperties struct {
Embedded_launcher *bool `blueprint:"mutated"`
}
+type baseAttributes struct {
+ // TODO(b/200311466): Probably not translate b/c Bazel has no good equiv
+ //Pkg_path bazel.StringAttribute
+ // TODO: Related to Pkg_bath and similarLy gated
+ //Is_internal bazel.BoolAttribute
+ // Combines Srcs and Exclude_srcs
+ Srcs bazel.LabelListAttribute
+ Deps bazel.LabelListAttribute
+ // Combines Data and Java_data (invariant)
+ Data bazel.LabelListAttribute
+}
+
// Used to store files of current module after expanding dependencies
type pathMapping struct {
dest string
@@ -177,6 +190,25 @@ func newModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Mo
}
}
+func (m *Module) makeArchVariantBaseAttributes(ctx android.TopDownMutatorContext) baseAttributes {
+ var attrs baseAttributes
+ archVariantBaseProps := m.GetArchVariantProperties(ctx, &BaseProperties{})
+ for axis, configToProps := range archVariantBaseProps {
+ for config, props := range configToProps {
+ if baseProps, ok := props.(*BaseProperties); ok {
+ attrs.Srcs.SetSelectValue(axis, config,
+ android.BazelLabelForModuleSrcExcludes(ctx, baseProps.Srcs, baseProps.Exclude_srcs))
+ attrs.Deps.SetSelectValue(axis, config,
+ android.BazelLabelForModuleDeps(ctx, baseProps.Libs))
+ data := android.BazelLabelForModuleSrc(ctx, baseProps.Data)
+ data.Append(android.BazelLabelForModuleSrc(ctx, baseProps.Java_data))
+ attrs.Data.SetSelectValue(axis, config, data)
+ }
+ }
+ }
+ return attrs
+}
+
// bootstrapper interface should be implemented for runnable modules, e.g. binary and test
type bootstrapper interface {
bootstrapperProps() []interface{}