Do not append deps to exports when java_library has only proto srcs

This is to address the comment in aosp/2748099

Test: CI

Bug: 285952385
Change-Id: I0bc8c76e2bc9ee113ced8642e0ab93a95799211c
This commit is contained in:
Zi Wang
2023-09-13 10:06:54 -07:00
parent ef1fc04e1a
commit f038cde8df
2 changed files with 2 additions and 7 deletions

View File

@@ -3143,9 +3143,7 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
// bp2build converts this module to 2 java_libraries + java_xx_proto_library + proto_library
// the non-empty deps here are not necessary for compiling the protos, in which case
// they're unnecessary as deps on the java_library as well since they aren't
// being propagated to any dependencies.
// so we can put the deps to exports and drop deps here.
exports.Append(deps)
// being propagated to any dependencies. So we can drop deps here.
deps = bazel.LabelListAttribute{}
} else {
ctx.ModuleErrorf("Module has direct dependencies but no sources. Bazel will not allow this.")