Bazel: Fix eclipse classpath generation

Since I819954da56 JUnit test is added that depends on reviewdb_proto,
however, this new dependency wasn't added to Eclipse classpath
generation machinery. Widen the visibility of that library and add
it to the transitive closure of Eclipse classpath generation.

Ad a side effect, we need to conditionally query compilation_info
attribute during classpath generation, because java_proto_library
doesn't expose this attribute.

Bug: Issue 9564
Change-Id: I4ef1be9b1f7db9764f6bc8e5571da6ba6ac211f6
This commit is contained in:
David Ostrovsky 2018-08-14 08:10:37 +02:00
parent f1d5780172
commit 3ed0112115
3 changed files with 7 additions and 2 deletions

View File

@ -23,6 +23,9 @@ proto_library(
java_proto_library(
name = "reviewdb_java_proto",
visibility = ["//javatests/com/google/gerrit/proto:__pkg__"],
visibility = [
"//javatests/com/google/gerrit/proto:__pkg__",
"//tools/eclipse:__pkg__",
],
deps = [":reviewdb_proto"],
)

View File

@ -3,7 +3,8 @@ def _classpath_collector(ctx):
for d in ctx.attr.deps:
if hasattr(d, "java"):
all += d.java.transitive_runtime_deps
all += d.java.compilation_info.runtime_classpath
if hasattr(d.java.compilation_info, "runtime_classpath"):
all += d.java.compilation_info.runtime_classpath
elif hasattr(d, "files"):
all += d.files

View File

@ -11,6 +11,7 @@ TEST_DEPS = [
"//gerrit-gwtui:ui_tests",
"//javatests/com/google/gerrit/elasticsearch:elasticsearch_test_utils",
"//javatests/com/google/gerrit/server:server_tests",
"//proto:reviewdb_java_proto",
]
DEPS = [