diff options
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/java/java.go b/java/java.go index 1b6e559b3..713fe9492 100644 --- a/java/java.go +++ b/java/java.go @@ -2060,15 +2060,22 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) protoSrcPartition: android.ProtoSrcLabelPartition, }) + var javacopts []string + if m.properties.Javacflags != nil { + javacopts = append(javacopts, m.properties.Javacflags...) + } + epEnabled := m.properties.Errorprone.Enabled + //TODO(b/227504307) add configuration that depends on RUN_ERROR_PRONE environment variable + if Bool(epEnabled) { + javacopts = append(javacopts, m.properties.Errorprone.Javacflags...) + } + commonAttrs := &javaCommonAttributes{ Srcs: srcPartitions[javaSrcPartition], Plugins: bazel.MakeLabelListAttribute( android.BazelLabelForModuleDeps(ctx, m.properties.Plugins), ), - } - - if m.properties.Javacflags != nil { - commonAttrs.Javacopts = bazel.MakeStringListAttribute(m.properties.Javacflags) + Javacopts: bazel.MakeStringListAttribute(javacopts), } depLabels := &javaDependencyLabels{} @@ -2218,8 +2225,16 @@ type bazelJavaImportAttributes struct { // java_import bp2Build converter. func (i *Import) ConvertWithBp2build(ctx android.TopDownMutatorContext) { - //TODO(b/209577426): Support multiple arch variants - jars := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, i.properties.Jars, []string(nil))) + var jars bazel.LabelListAttribute + archVariantProps := i.GetArchVariantProperties(ctx, &ImportProperties{}) + for axis, configToProps := range archVariantProps { + for config, _props := range configToProps { + if archProps, ok := _props.(*ImportProperties); ok { + archJars := android.BazelLabelForModuleSrcExcludes(ctx, archProps.Jars, []string(nil)) + jars.SetSelectValue(axis, config, archJars) + } + } + } attrs := &bazelJavaImportAttributes{ Jars: jars, |