Bazel: Respect test dependencies for classpath generation
Test dependencies must be respected during classpath generation because some third party dependencies can be only used for the tests, but not for production code path. Otherwise, we would end up producng classpath that missing some dependencies and thus compilation errors in the IDE. This was the case with jimfs, that was added as implicit dependency to the 'tools/eclipse:classpath' rule. Skip Test_runner_deploy.jar library from the Eclipse classpath, as it includes some other third party dependency (most notably outdated auto-value) that could collide with our own version of those dependencies, causing classpath collisions, see: [1] for the glory details: [1]. This is safe thing to do, as we rely on the Eclipse as JUnit test execution environment anyway. * [1] https://github.com/bazelbuild/bazel/issues/2044 Change-Id: I87fff277695a2f64c44a3af65471c0c901860a02
This commit is contained in:

committed by
David Ostrovsky

parent
8c9a9ea486
commit
7f95f255c1
@@ -23,8 +23,6 @@ DEPS = [
|
||||
'//gerrit-main:main_lib',
|
||||
'//gerrit-plugin-gwtui:gwtui-api-lib',
|
||||
'//gerrit-server:server',
|
||||
# TODO(davido): figure out why it's not reached through test dependencies
|
||||
'//lib:jimfs',
|
||||
'//lib/asciidoctor:asciidoc_lib',
|
||||
'//lib/asciidoctor:doc_indexer_lib',
|
||||
'//lib/auto:auto-value',
|
||||
@@ -50,7 +48,7 @@ java_library(
|
||||
|
||||
classpath_collector(
|
||||
name = 'main_classpath_collect',
|
||||
deps = LIBS + PGMLIBS + DEPS + PROVIDED_DEPS,
|
||||
deps = LIBS + PGMLIBS + DEPS + TEST_DEPS + PROVIDED_DEPS,
|
||||
testonly = 1,
|
||||
# TODO(davido): Handle plugins
|
||||
#scan_plugins(),
|
||||
|
@@ -158,6 +158,10 @@ def gen_classpath(ext):
|
||||
p.endswith('prolog/libcommon.jar'):
|
||||
lib.add(p)
|
||||
else:
|
||||
# Don't mess up with Bazel internal test runner dependencies.
|
||||
# When we use Eclipse we rely on it for running the tests
|
||||
if p.endswith("external/bazel_tools/tools/jdk/TestRunner_deploy.jar"):
|
||||
continue
|
||||
if p.startswith("external"):
|
||||
p = path.join(ext, p)
|
||||
lib.add(p)
|
||||
|
Reference in New Issue
Block a user