summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Sam Delmerico <delmerico@google.com> 2022-02-23 16:13:15 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-02-23 16:13:15 +0000
commitbc83b504ff94311aa0ccfba82058cec403bc5bd7 (patch)
tree34838192c1bf991c0cd38dd933904ccf6fccd192 /java/java.go
parent2ace628b86d93d9956ef02cad148bb8cd1323398 (diff)
parentc768102bce5d64f93559a75783edb5509669f58c (diff)
Merge "convert java proto libraries with bp2build"
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go
index e55f04599..d0f0abc7a 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2013,8 +2013,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))
+
+ javaSrcPartition := "java"
+ protoSrcPartition := "proto"
+ srcPartitions := bazel.PartitionLabelListAttribute(ctx, &srcs, bazel.LabelPartitions{
+ javaSrcPartition: bazel.LabelPartition{Extensions: []string{".java"}, Keep_remainder: true},
+ protoSrcPartition: android.ProtoSrcLabelPartition,
+ })
+
attrs := &javaLibraryAttributes{
- Srcs: srcs,
+ Srcs: srcPartitions[javaSrcPartition],
}
if m.properties.Javacflags != nil {
@@ -2029,6 +2037,12 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext)
//TODO(b/217236083) handle static libs similarly to Soong
deps.Append(android.BazelLabelForModuleDeps(ctx, m.properties.Static_libs))
}
+
+ protoDeps := bp2buildProto(ctx, &m.Module, srcPartitions[protoSrcPartition])
+ if protoDeps != nil {
+ deps.Add(protoDeps)
+ }
+
attrs.Deps = bazel.MakeLabelListAttribute(deps)
return attrs