Consider plugin's test deps in eclipse classpath generation
Introduce the CUSTOM_PLUGINS_TEST_DEPS in tools/bzl/plugins.bzl
that allow plugin with external test dependencies to be listed.
That way Eclipse classpath generation process can consider these
dependencies.
Because the plugin's own test rule need these dependencies, it
should expose java_library rule called: <plugin>__plugin_test_deps:
java_library(
name = "high-availability__plugin_test_deps",
visibility = ["//visibility:public"],
exports = [
"@byte-buddy//jar",
"@mockito//jar",
"@objenesis//jar",
"@wiremock//jar",
],
)
and re-use this rule in junit_tests rule, e.g.:
junit_tests(
name = "high_availability_tests",
[...]
deps = [
[...]
":high-availability__plugin_test_deps",
]
)
Bug: Issue 6351
Change-Id: I55b402fa6edb9f2506a91451d70e68d44d1a7762
diff --git a/tools/bzl/plugins.bzl b/tools/bzl/plugins.bzl
index 447ee7f..149dbb5 100644
--- a/tools/bzl/plugins.bzl
+++ b/tools/bzl/plugins.bzl
@@ -10,3 +10,7 @@
CUSTOM_PLUGINS = [
# Add custom core plugins here
]
+
+CUSTOM_PLUGINS_TEST_DEPS = [
+ # Add custom core plugins with tests deps here
+]
diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD
index ad37707..7d79bc2 100644
--- a/tools/eclipse/BUILD
+++ b/tools/eclipse/BUILD
@@ -4,6 +4,7 @@
"//tools/bzl:plugins.bzl",
"CORE_PLUGINS",
"CUSTOM_PLUGINS",
+ "CUSTOM_PLUGINS_TEST_DEPS",
)
TEST_DEPS = [
@@ -49,7 +50,8 @@
name = "main_classpath_collect",
testonly = 1,
deps = LIBS + PGMLIBS + DEPS + TEST_DEPS +
- ["//plugins/%s:%s__plugin" % (n, n) for n in CORE_PLUGINS + CUSTOM_PLUGINS],
+ ["//plugins/%s:%s__plugin" % (n, n) for n in CORE_PLUGINS + CUSTOM_PLUGINS] +
+ ["//plugins/%s:%s__plugin_test_deps" % (n, n) for n in CUSTOM_PLUGINS_TEST_DEPS],
)
classpath_collector(