diff options
| author | 2023-09-23 03:45:48 +0000 | |
|---|---|---|
| committer | 2023-09-23 03:45:48 +0000 | |
| commit | 7c5b6d5273472f50f27597ece38f59e645c9826c (patch) | |
| tree | dadb1804ec6bc2792d26c9d903b1371155378e7c /java/java.go | |
| parent | 11b20b2993977a66818b046563e4cadf5154c5c5 (diff) | |
| parent | 4dbd0e868875c6a839fc00b62f3701f8d9db6445 (diff) | |
Merge "Pass java_library libs and static_libs to java_*_proto_library" into main
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/java/java.go b/java/java.go index d5aeb7cb2..fbad4f390 100644 --- a/java/java.go +++ b/java/java.go @@ -3067,17 +3067,6 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.Bp2buildMutatorContext } } - protoDepLabel := bp2buildProto(ctx, &m.Module, srcPartitions[protoSrcPartition]) - // Soong does not differentiate between a java_library and the Bazel equivalent of - // a java_proto_library + proto_library pair. Instead, in Soong proto sources are - // listed directly in the srcs of a java_library, and the classes produced - // by protoc are included directly in the resulting JAR. Thus upstream dependencies - // that depend on a java_library with proto sources can link directly to the protobuf API, - // and so this should be a static dependency. - if protoDepLabel != nil { - staticDeps.Append(bazel.MakeSingleLabelListAttribute(*protoDepLabel)) - } - depLabels := &javaDependencyLabels{} depLabels.Deps = deps @@ -3093,6 +3082,20 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.Bp2buildMutatorContext } depLabels.StaticDeps.Append(staticDeps) + var additionalProtoDeps bazel.LabelListAttribute + additionalProtoDeps.Append(depLabels.Deps) + additionalProtoDeps.Append(depLabels.StaticDeps) + protoDepLabel := bp2buildProto(ctx, &m.Module, srcPartitions[protoSrcPartition], additionalProtoDeps) + // Soong does not differentiate between a java_library and the Bazel equivalent of + // a java_proto_library + proto_library pair. Instead, in Soong proto sources are + // listed directly in the srcs of a java_library, and the classes produced + // by protoc are included directly in the resulting JAR. Thus upstream dependencies + // that depend on a java_library with proto sources can link directly to the protobuf API, + // and so this should be a static dependency. + if protoDepLabel != nil { + depLabels.StaticDeps.Append(bazel.MakeSingleLabelListAttribute(*protoDepLabel)) + } + hasKotlin := !kotlinSrcs.IsEmpty() commonAttrs.kotlinAttributes = &kotlinAttributes{ Kotlincflags: &m.properties.Kotlincflags, |