diff options
| author | Alix <agespino@google.com> | 2023-01-12 18:20:32 +0000 |
|---|---|---|
| committer | Alix <agespino@google.com> | 2023-01-19 20:42:24 +0000 |
| commit | 495cc8a6ffe5880a1955b85dae9974bab8bd67c2 (patch) | |
| tree | 285be38a1438725cd0d85bcfc50f4a4a1876f852 /java/java.go | |
| parent | 733b1b78fa969ca04e2b826808cd0b3fb79a8287 (diff) | |
arch variant support for libs property
Test: bp2build tests and manually inspected Build file for libprotobuf-java-lite
Bug: 244210934
Change-Id: Id60d859eea2c23fa7a29784faeed5cb050d4193e
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/java/java.go b/java/java.go index 0479f1049..146931b2b 100644 --- a/java/java.go +++ b/java/java.go @@ -2568,7 +2568,7 @@ type bp2BuildJavaInfo struct { // to be returned to the calling function. func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) (*javaCommonAttributes, *bp2BuildJavaInfo) { var srcs bazel.LabelListAttribute - var deps bazel.LabelList + var deps bazel.LabelListAttribute var staticDeps bazel.LabelList archVariantProps := m.GetArchVariantProperties(ctx, &CommonProperties{}) @@ -2674,11 +2674,17 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) Javacopts: bazel.MakeStringListAttribute(javacopts), } - if m.properties.Libs != nil { - for _, d := range m.properties.Libs { - neverlinkLabel := android.BazelLabelForModuleDepSingle(ctx, d) - neverlinkLabel.Label = neverlinkLabel.Label + "-neverlink" - deps.Add(&neverlinkLabel) + for axis, configToProps := range archVariantProps { + for config, _props := range configToProps { + if archProps, ok := _props.(*CommonProperties); ok { + var libLabels []bazel.Label + for _, d := range archProps.Libs { + neverlinkLabel := android.BazelLabelForModuleDepSingle(ctx, d) + neverlinkLabel.Label = neverlinkLabel.Label + "-neverlink" + libLabels = append(libLabels, neverlinkLabel) + } + deps.SetSelectValue(axis, config, bazel.MakeLabelList(libLabels)) + } } } @@ -2696,7 +2702,7 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) staticDeps.Add(protoDepLabel) depLabels := &javaDependencyLabels{} - depLabels.Deps = bazel.MakeLabelListAttribute(deps) + depLabels.Deps = deps depLabels.StaticDeps = bazel.MakeLabelListAttribute(staticDeps) bp2BuildInfo := &bp2BuildJavaInfo{ |
