Adapt Bazel build and deps to latest stable-3.5
The latest stable-3.5 has removed all the leftover
of dependencies from testcontainer and docker-java which
needs to be part of this plugin instead.
Also fix formatting of build files with buildifier.
Change-Id: Ic795dd62c1d382ec4e451e4f0ffc3d2365f3a074
diff --git a/BUILD b/BUILD
index 06352ab..4e5a433 100644
--- a/BUILD
+++ b/BUILD
@@ -1,110 +1,28 @@
-load("@rules_java//java:defs.bzl", "java_library")
load("//tools/bzl:junit.bzl", "junit_tests")
-load("//javatests/com/google/gerrit/acceptance:tests.bzl", "acceptance_tests")
load(
"//tools/bzl:plugin.bzl",
- "PLUGIN_DEPS",
"PLUGIN_TEST_DEPS",
"gerrit_plugin",
)
-gerrit_plugin (
+gerrit_plugin(
name = "index-elasticsearch",
srcs = glob(["src/main/java/**/*.java"]),
deps = [
- "//java/com/google/gerrit/common:annotations",
- "//java/com/google/gerrit/entities",
- "//java/com/google/gerrit/exceptions",
- "//java/com/google/gerrit/extensions:api",
- "//java/com/google/gerrit/index",
- "//java/com/google/gerrit/index:query_exception",
- "//java/com/google/gerrit/index/project",
- "//java/com/google/gerrit/lifecycle",
"//java/com/google/gerrit/proto",
- "//java/com/google/gerrit/server",
- "//lib:gson",
- "//lib:guava",
- "//lib:jgit",
- "//lib:protobuf",
- "//lib/commons:lang",
"@elasticsearch-rest-client//jar",
- "//lib/flogger:api",
- "//lib/guice",
- "//lib/guice:guice-assistedinject",
"@httpasyncclient//jar",
- "//lib/httpcomponents:httpclient",
- "//lib/httpcomponents:httpcore",
"@httpcore-nio//jar",
"@jackson-core//jar",
],
)
-java_library(
- name = "elasticsearch_test_utils",
- testonly = True,
- srcs = [],
- visibility = ["//visibility:public"],
- deps = [
- "//java/com/google/gerrit/index",
- "//lib:guava",
- "//lib:jgit",
- "//lib:junit",
- "//lib/guice",
- "//lib/httpcomponents:httpcore",
- "//lib/jackson:jackson-annotations",
- "//lib/testcontainers",
- "//lib/testcontainers:docker-java-api",
- "//lib/testcontainers:docker-java-transport",
- "@testcontainers-elasticsearch//jar",
- ":index-elasticsearch__plugin",
- ],
-)
-
-ELASTICSEARCH_DEPS = [
- ":elasticsearch_test_utils",
- "//java/com/google/gerrit/testing:gerrit-test-util",
- "//lib/guice",
- "//lib:jgit",
-]
-
-HTTP_TEST_DEPS = [
- "@httpasyncclient//jar",
- "//lib/httpcomponents:httpclient",
-]
-
-QUERY_TESTS_DEP = "//javatests/com/google/gerrit/server/query/%s:abstract_query_tests"
-
-TYPES = [
- "account",
- "change",
- "group",
- "project",
-]
-
-SUFFIX = "sTest.java"
-
-ELASTICSEARCH_TESTS_V7 = {i: "ElasticV7Query" + i.capitalize() + SUFFIX for i in TYPES}
-
-ELASTICSEARCH_TAGS = [
- "docker",
- "elastic",
-]
-
junit_tests(
name = "index-elasticsearch_tests",
size = "small",
- srcs = glob(
- ["src/test/java/**/*Test.java"],
- exclude = ["Elastic*Query*" + SUFFIX],
- ),
+ srcs = glob(["src/test/java/**/*Test.java"]),
tags = ["elastic"],
- deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
- "//java/com/google/gerrit/testing:gerrit-test-util",
- "//lib:guava",
- "//lib:jgit",
- "//lib/guice",
- "//lib/httpcomponents:httpcore",
- "//lib/truth",
- ":elasticsearch_test_utils",
+ deps = PLUGIN_TEST_DEPS + [
+ ":index-elasticsearch__plugin",
],
)
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index b863175..fc1420c 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -5,6 +5,12 @@
# Ensure artifacts compatibility by selecting them from the Bill Of Materials
# https://search.maven.org/artifact/net.openhft/chronicle-bom/2.20.191/pom
def external_plugin_deps():
+ maven_jar(
+ name = "testcontainers",
+ artifact = "org.testcontainers:testcontainers:" + TESTCONTAINERS_VERSION,
+ sha1 = "95c6cfde71c2209f0c29cb14e432471e0b111880",
+ )
+
# When upgrading elasticsearch-rest-client, also upgrade httpcore-nio
# and httpasyncclient as necessary in tools/nongoogle.bzl. Consider
# also the other org.apache.httpcomponents dependencies in
@@ -21,6 +27,38 @@
sha1 = "595e3a50f59cd3c1d281ca6c1bc4037e277a1353",
)
+ maven_jar(
+ name = "duct-tape",
+ artifact = "org.rnorth.duct-tape:duct-tape:1.0.8",
+ sha1 = "92edc22a9ab2f3e17c9bf700aaee377d50e8b530",
+ )
+
+ maven_jar(
+ name = "visible-assertions",
+ artifact = "org.rnorth.visible-assertions:visible-assertions:2.1.2",
+ sha1 = "20d31a578030ec8e941888537267d3123c2ad1c1",
+ )
+
+ maven_jar(
+ name = "jna",
+ artifact = "net.java.dev.jna:jna:5.5.0",
+ sha1 = "0e0845217c4907822403912ad6828d8e0b256208",
+ )
+
+ DOCKER_JAVA_VERS = "3.2.8"
+
+ maven_jar(
+ name = "docker-java-api",
+ artifact = "com.github.docker-java:docker-java-api:" + DOCKER_JAVA_VERS,
+ sha1 = "4ac22a72d546a9f3523cd4b5fabffa77c4a6ec7c",
+ )
+
+ maven_jar(
+ name = "docker-java-transport",
+ artifact = "com.github.docker-java:docker-java-transport:" + DOCKER_JAVA_VERS,
+ sha1 = "c3b5598c67d0a5e2e780bf48f520da26b9915eab",
+ )
+
# elasticsearch-rest-client explicitly depends on this version
maven_jar(
name = "httpasyncclient",
@@ -42,8 +80,13 @@
)
maven_jar(
+ name = "jackson-annotations",
+ artifact = "com.fasterxml.jackson.core:jackson-annotations:2.10.3",
+ sha1 = "0f63b3b1da563767d04d2e4d3fc1ae0cdeffebe7",
+ )
+
+ maven_jar(
name = "httpasyncclient",
artifact = "org.apache.httpcomponents:httpasyncclient:4.1.4",
sha1 = "f3a3240681faae3fa46b573a4c7e50cec9db0d86",
)
-