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
This commit is contained in:
David Ostrovsky 2017-05-31 07:48:39 +02:00 committed by David Ostrovsky
parent 56517ff895
commit f2f4ee165c
2 changed files with 7 additions and 1 deletions

View File

@ -10,3 +10,7 @@ CORE_PLUGINS = [
CUSTOM_PLUGINS = [
# Add custom core plugins here
]
CUSTOM_PLUGINS_TEST_DEPS = [
# Add custom core plugins with tests deps here
]

View File

@ -4,6 +4,7 @@ load(
"//tools/bzl:plugins.bzl",
"CORE_PLUGINS",
"CUSTOM_PLUGINS",
"CUSTOM_PLUGINS_TEST_DEPS",
)
TEST_DEPS = [
@ -49,7 +50,8 @@ classpath_collector(
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(