Merge "Clean up BUILD rules"
diff --git a/BUILD b/BUILD
index 15148a1..d793ed7 100644
--- a/BUILD
+++ b/BUILD
@@ -2,36 +2,34 @@
load("//tools/bzl:junit.bzl", "junit_tests")
load(
"//tools/bzl:plugin.bzl",
- "PLUGIN_DEPS",
"PLUGIN_DEPS_NEVERLINK",
"PLUGIN_TEST_DEPS",
"gerrit_plugin",
)
-MODULE = ["src/main/java/com/googlesource/gerrit/plugins/findowners/Module.java"]
-
-java_library(
- name = "find-owners-lib",
- srcs = glob(
- ["src/main/java/**/*.java"],
- exclude = MODULE,
- ),
- deps = PLUGIN_DEPS_NEVERLINK + [
- "@prolog-runtime//jar:neverlink",
+prolog_cafe_library(
+ name = "find_owners_prolog_rules",
+ srcs = glob(["src/main/prolog/*.pl"]),
+ deps = [
+ ":find_owners",
+ "//prolog:gerrit-prolog-common",
],
)
-prolog_cafe_library(
- name = "find-owners-prolog-rules",
- srcs = glob(["src/main/prolog/*.pl"]),
- deps = PLUGIN_DEPS_NEVERLINK + [
- ":find-owners-lib",
- ],
+FIND_OWNERS_SRCS = glob(["src/main/java/**/*.java"])
+
+FIND_OWNERS_DEPS = ["@prolog-runtime//jar:neverlink"]
+
+java_library(
+ name = "find_owners",
+ srcs = FIND_OWNERS_SRCS,
+ resources = glob(["src/main/resources/**/*"]),
+ deps = FIND_OWNERS_DEPS + PLUGIN_DEPS_NEVERLINK,
)
gerrit_plugin(
name = "find-owners",
- srcs = MODULE,
+ srcs = FIND_OWNERS_SRCS,
manifest_entries = [
"Gerrit-PluginName: find-owners",
"Gerrit-ReloadMode: restart",
@@ -41,52 +39,55 @@
"Implementation-URL: https://gerrit.googlesource.com/plugins/find-owners",
],
resources = glob(["src/main/resources/**/*"]),
- deps = [
- ":find-owners-lib",
- ":find-owners-prolog-rules",
- ],
+ deps = FIND_OWNERS_DEPS + [":find_owners_prolog_rules"],
)
+# Libraries used by all find-owners junit tests.
+FIND_OWNERS_TESTS_DEPS = PLUGIN_TEST_DEPS
+
+FIND_OWNERS_TESTS_DEPS = FIND_OWNERS_TESTS_DEPS + [
+ ":find_owners",
+]
+
+# Base find_owners_IT library depends on these Gerrit IT acceptance libraries.
+FIND_OWNERS_IT_DEPS = [
+ "@commons-io//jar",
+]
+
+# All IT tests need the find_owners_IT and find_owners_IT libraries.
+FIND_OWNERS_IT_TESTS_DEPS = FIND_OWNERS_IT_DEPS + [
+ ":find_owners_IT",
+ ":find_owners_junit",
+ ":find_owners_prolog_rules",
+]
+
+# Utilities for junit tests.
java_library(
- name = "find-owners-junit",
+ name = "find_owners_junit",
testonly = 1,
srcs = glob(["src/test/java/**/Watcher.java"]),
- deps = PLUGIN_TEST_DEPS,
+ deps = FIND_OWNERS_TESTS_DEPS,
)
+# Base class and utilities for IT tests.
java_library(
- name = "find-owners-IT",
+ name = "find_owners_IT",
testonly = 1,
srcs = glob(["src/test/java/**/FindOwners.java"]),
- deps = PLUGIN_TEST_DEPS + [
- ":find-owners-junit",
- ":find-owners-lib",
- ":find-owners__plugin",
- ],
+ deps = FIND_OWNERS_TESTS_DEPS + FIND_OWNERS_IT_DEPS,
)
-# Separate fast junit tests from slow interation (IT) tests.
+# Simple fast junit non-IT tests.
junit_tests(
name = "findowners_junit_tests",
srcs = glob(["src/test/java/**/*Test.java"]),
- tags = ["findowners"],
- deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
- "@commons-io//jar",
- ":find-owners-junit",
- ":find-owners-lib",
- ],
+ deps = FIND_OWNERS_TESTS_DEPS + [":find_owners_junit"],
)
+# IT tests.
junit_tests(
name = "findowners_IT_tests",
srcs = glob(["src/test/java/**/*IT.java"]),
- tags = ["findowners"],
- deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
- "@commons-io//jar",
- ":find-owners-IT",
- ":find-owners-junit",
- ":find-owners-lib",
- ":find-owners-prolog-rules",
- ":find-owners__plugin",
- ],
+ shard_count = 4,
+ deps = FIND_OWNERS_IT_TESTS_DEPS + FIND_OWNERS_TESTS_DEPS,
)