summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Sam Delmerico <delmerico@google.com> 2022-02-02 14:27:32 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-02-02 14:27:32 +0000
commitca1701f5183e709c86aaf7f78c1a81cba86d966c (patch)
treeaa32a117ef36fa78309f77752b8cc829594b754a /java/java.go
parentf8a4bb6d7fbc41253b99ff2ac7fd0bb1ca947b5a (diff)
parentc06ea03c9e0dfd360011bdf1501078e1970f4116 (diff)
Merge changes I09902215,I4f86780c
* changes: convert java_plugin with bp2build convert java static dependencies
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/java/java.go b/java/java.go
index fef9912b5..7a2a99195 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2010,7 +2010,7 @@ type javaLibraryAttributes struct {
Javacopts bazel.StringListAttribute
}
-func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
+func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) *javaLibraryAttributes {
srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, m.properties.Srcs, m.properties.Exclude_srcs))
attrs := &javaLibraryAttributes{
Srcs: srcs,
@@ -2020,9 +2020,21 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
attrs.Javacopts = bazel.MakeStringListAttribute(m.properties.Javacflags)
}
+ var deps bazel.LabelList
if m.properties.Libs != nil {
- attrs.Deps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, m.properties.Libs))
+ deps.Append(android.BazelLabelForModuleDeps(ctx, m.properties.Libs))
+ }
+ if m.properties.Static_libs != nil {
+ //TODO(b/217236083) handle static libs similarly to Soong
+ deps.Append(android.BazelLabelForModuleDeps(ctx, m.properties.Static_libs))
}
+ attrs.Deps = bazel.MakeLabelListAttribute(deps)
+
+ return attrs
+}
+
+func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
+ attrs := m.convertLibraryAttrsBp2Build(ctx)
props := bazel.BazelTargetModuleProperties{
Rule_class: "java_library",