From e91d0303f2f1c71eec9e9f89da8b1985a966e81a Mon Sep 17 00:00:00 2001 From: Sam Delmerico Date: Wed, 23 Feb 2022 15:28:33 +0000 Subject: bp2build supports arch variant srcs for java_library Bug: 209577426 Test: build/bazel/ci/bp2build.sh Change-Id: I6799bda904d286616e580f2395601ce4f764180f --- java/java.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index 0a35908dd..895ce7af1 100644 --- a/java/java.go +++ b/java/java.go @@ -2011,8 +2011,16 @@ type javaLibraryAttributes struct { } func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) *javaLibraryAttributes { - //TODO(b/209577426): Support multiple arch variants - srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, m.properties.Srcs, m.properties.Exclude_srcs)) + var srcs bazel.LabelListAttribute + archVariantProps := m.GetArchVariantProperties(ctx, &CommonProperties{}) + for axis, configToProps := range archVariantProps { + for config, _props := range configToProps { + if archProps, ok := _props.(*CommonProperties); ok { + archSrcs := android.BazelLabelForModuleSrcExcludes(ctx, archProps.Srcs, archProps.Exclude_srcs) + srcs.SetSelectValue(axis, config, archSrcs) + } + } + } javaSrcPartition := "java" protoSrcPartition := "proto" -- cgit v1.2.3-59-g8ed1b