Migrate to bazelmod Change-Id: Ief5a43cdd5e7829aafd1ed01306530fdb328d696
diff --git a/BUILD b/BUILD index eca48a1..7010e8d 100644 --- a/BUILD +++ b/BUILD
@@ -1,13 +1,11 @@ -load("//tools/bzl:junit.bzl", "junit_tests") load( - "//tools/bzl:plugin.bzl", + "@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl", "gerrit_plugin", - "PLUGIN_DEPS", - "PLUGIN_TEST_DEPS", + "gerrit_plugin_tests", ) gerrit_plugin( - name = "its-jira", + plugin = "its-jira", srcs = glob(["src/main/java/**/*.java"]), manifest_entries = [ "Gerrit-PluginName: its-jira", @@ -23,26 +21,10 @@ ], ) -junit_tests( - name = "its_jira_tests", - testonly = 1, - srcs = glob( - ["src/test/java/**/*.java"], - ), - tags = ["its-jira"], - deps = [ - "its-jira__plugin_test_deps", - ], -) - -java_library( - name = "its-jira__plugin_test_deps", - testonly = 1, - visibility = ["//visibility:public"], - exports = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [ - ":its-jira__plugin", - "//plugins/its-base", - "@mockito//jar", - "@wiremock//jar", - ], -) +gerrit_plugin_tests( + srcs = glob(["src/test/java/**/*.java"]), + ext_deps = ["com.github.tomakehurst:wiremock-standalone"], + plugin = "its-jira", + skip_dependency_tests = True, + deps = ["//plugins/its-base"], +) \ No newline at end of file
diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..40847d8 --- /dev/null +++ b/MODULE.bazel
@@ -0,0 +1,32 @@ +module(name = "gerrit-its-jira") + +bazel_dep(name = "rules_java", version = "9.3.0") +bazel_dep(name = "rules_jvm_external", version = "7.0") + +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") + +maven.install( + name = "its-jira_plugin_deps", + artifacts = [ + "com.github.tomakehurst:wiremock-standalone:2.27.2", + ], + duplicate_version_warning = "error", + excluded_artifacts = [ + "com.google.code.findbugs:jsr305", + "com.google.errorprone:error_prone_annotations", + "com.google.guava:failureaccess", + "com.google.guava:guava", + "com.google.j2objc:j2objc-annotations", + "junit:junit", + "org.slf4j:slf4j-api", + ], + fail_if_repin_required = True, + fail_on_missing_checksum = True, + fetch_sources = True, + lock_file = "//:its-jira_plugin_deps.lock.json", + repositories = [ + "https://repo1.maven.org/maven2", + ], + version_conflict_policy = "pinned", +) +use_repo(maven, "its-jira_plugin_deps") \ No newline at end of file
diff --git a/external_plugin_deps.MODULE.bazel b/external_plugin_deps.MODULE.bazel new file mode 100644 index 0000000..8d89187 --- /dev/null +++ b/external_plugin_deps.MODULE.bazel
@@ -0,0 +1,19 @@ +# Module fragment for wiring this plugin's Bazel module into the +# Gerrit in-tree build when using Bzlmod. +# +# This file is included from Gerrit's plugins/external_plugin_deps.MODULE.bazel. +# It wires the plugin module into the root dependency graph and exposes +# any repositories it creates (for example via rules_jvm_external). +# +# NOTE: This file must be self-contained: bindings do not cross include() +# boundaries, so it re-declares the rules_jvm_external extension handle. + +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") + +bazel_dep(name = "gerrit-its-jira") +local_path_override( + module_name = "gerrit-its-jira", + path = "plugins/its-jira", +) + +use_repo(maven, "its-jira_plugin_deps") \ No newline at end of file
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl deleted file mode 100644 index 2d26664..0000000 --- a/external_plugin_deps.bzl +++ /dev/null
@@ -1,30 +0,0 @@ -load("//tools/bzl:maven_jar.bzl", "maven_jar") - -def external_plugin_deps(): - maven_jar( - name = "mockito", - artifact = "org.mockito:mockito-core:2.13.0", - sha1 = "8e372943974e4a121fb8617baced8ebfe46d54f0", - deps = [ - '@byte-buddy//jar', - '@objenesis//jar', - ], - ) - - maven_jar( - name = "byte-buddy", - artifact = "net.bytebuddy:byte-buddy:1.7.9", - sha1 = "51218a01a882c04d0aba8c028179cce488bbcb58", - ) - - maven_jar( - name = "objenesis", - artifact = "org.objenesis:objenesis:2.6", - sha1 = "639033469776fd37c08358c6b92a4761feb2af4b", - ) - - maven_jar( - name = "wiremock", - artifact = "com.github.tomakehurst:wiremock-standalone:2.27.2", - sha1 = "327647a19b2319af2526b9c33a5733a2241723e0", - )
diff --git a/its-jira_plugin_deps.lock.json b/its-jira_plugin_deps.lock.json new file mode 100755 index 0000000..67b7900 --- /dev/null +++ b/its-jira_plugin_deps.lock.json
@@ -0,0 +1,311 @@ +{ + "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", + "__INPUT_ARTIFACTS_HASH": { + "com.github.tomakehurst:wiremock-standalone": -1985332777, + "com.google.code.findbugs:jsr305": -313338248, + "com.google.errorprone:error_prone_annotations": 227507220, + "com.google.guava:failureaccess": -1493823684, + "com.google.guava:guava": -2125091860, + "com.google.j2objc:j2objc-annotations": 1772577837, + "junit:junit": 1843337614, + "org.slf4j:slf4j-api": 2145585153, + "repositories": -1949687017 + }, + "__RESOLVED_ARTIFACTS_HASH": { + "com.github.tomakehurst:wiremock-standalone": -1133549878, + "com.github.tomakehurst:wiremock-standalone:jar:sources": 669893243 + }, + "artifacts": { + "com.github.tomakehurst:wiremock-standalone": { + "shasums": { + "jar": "00b14f9d6399a9bba96139f84354f981d9fd1c3f4cf6938d36391f292f76382b", + "sources": "5a532b966f344c1d154262674403586e0e0a0de8e4b7bbfe9b4813875b62ab9d" + }, + "version": "2.27.2" + } + }, + "dependencies": {}, + "packages": { + "com.github.tomakehurst:wiremock-standalone": [ + "com.flipkart.zjsonpatch", + "com.github.tomakehurst.wiremock", + "com.github.tomakehurst.wiremock.admin", + "com.github.tomakehurst.wiremock.admin.model", + "com.github.tomakehurst.wiremock.admin.tasks", + "com.github.tomakehurst.wiremock.client", + "com.github.tomakehurst.wiremock.common", + "com.github.tomakehurst.wiremock.common.ssl", + "com.github.tomakehurst.wiremock.common.xml", + "com.github.tomakehurst.wiremock.core", + "com.github.tomakehurst.wiremock.extension", + "com.github.tomakehurst.wiremock.extension.requestfilter", + "com.github.tomakehurst.wiremock.extension.responsetemplating", + "com.github.tomakehurst.wiremock.extension.responsetemplating.helpers", + "com.github.tomakehurst.wiremock.global", + "com.github.tomakehurst.wiremock.http", + "com.github.tomakehurst.wiremock.http.multipart", + "com.github.tomakehurst.wiremock.http.ssl", + "com.github.tomakehurst.wiremock.http.trafficlistener", + "com.github.tomakehurst.wiremock.jetty9", + "com.github.tomakehurst.wiremock.jetty92", + "com.github.tomakehurst.wiremock.junit", + "com.github.tomakehurst.wiremock.matching", + "com.github.tomakehurst.wiremock.recording", + "com.github.tomakehurst.wiremock.security", + "com.github.tomakehurst.wiremock.servlet", + "com.github.tomakehurst.wiremock.standalone", + "com.github.tomakehurst.wiremock.stubbing", + "com.github.tomakehurst.wiremock.verification", + "com.github.tomakehurst.wiremock.verification.diff", + "com.github.tomakehurst.wiremock.verification.notmatched", + "joptsimple", + "joptsimple.internal", + "joptsimple.util", + "org.slf4j", + "org.slf4j.event", + "org.slf4j.helpers", + "org.slf4j.spi", + "wiremock.com.fasterxml.jackson.annotation", + "wiremock.com.fasterxml.jackson.core", + "wiremock.com.fasterxml.jackson.core.async", + "wiremock.com.fasterxml.jackson.core.base", + "wiremock.com.fasterxml.jackson.core.exc", + "wiremock.com.fasterxml.jackson.core.filter", + "wiremock.com.fasterxml.jackson.core.format", + "wiremock.com.fasterxml.jackson.core.io", + "wiremock.com.fasterxml.jackson.core.json", + "wiremock.com.fasterxml.jackson.core.json.async", + "wiremock.com.fasterxml.jackson.core.sym", + "wiremock.com.fasterxml.jackson.core.type", + "wiremock.com.fasterxml.jackson.core.util", + "wiremock.com.fasterxml.jackson.databind", + "wiremock.com.fasterxml.jackson.databind.annotation", + "wiremock.com.fasterxml.jackson.databind.cfg", + "wiremock.com.fasterxml.jackson.databind.deser", + "wiremock.com.fasterxml.jackson.databind.deser.impl", + "wiremock.com.fasterxml.jackson.databind.deser.std", + "wiremock.com.fasterxml.jackson.databind.exc", + "wiremock.com.fasterxml.jackson.databind.ext", + "wiremock.com.fasterxml.jackson.databind.introspect", + "wiremock.com.fasterxml.jackson.databind.json", + "wiremock.com.fasterxml.jackson.databind.jsonFormatVisitors", + "wiremock.com.fasterxml.jackson.databind.jsonschema", + "wiremock.com.fasterxml.jackson.databind.jsontype", + "wiremock.com.fasterxml.jackson.databind.jsontype.impl", + "wiremock.com.fasterxml.jackson.databind.module", + "wiremock.com.fasterxml.jackson.databind.node", + "wiremock.com.fasterxml.jackson.databind.ser", + "wiremock.com.fasterxml.jackson.databind.ser.impl", + "wiremock.com.fasterxml.jackson.databind.ser.std", + "wiremock.com.fasterxml.jackson.databind.type", + "wiremock.com.fasterxml.jackson.databind.util", + "wiremock.com.github.jknack.handlebars", + "wiremock.com.github.jknack.handlebars.cache", + "wiremock.com.github.jknack.handlebars.context", + "wiremock.com.github.jknack.handlebars.helper", + "wiremock.com.github.jknack.handlebars.internal", + "wiremock.com.github.jknack.handlebars.internal.js", + "wiremock.com.github.jknack.handlebars.internal.path", + "wiremock.com.github.jknack.handlebars.io", + "wiremock.com.github.jknack.handlebars.js", + "wiremock.com.google.common.annotations", + "wiremock.com.google.common.base", + "wiremock.com.google.common.base.internal", + "wiremock.com.google.common.cache", + "wiremock.com.google.common.collect", + "wiremock.com.google.common.escape", + "wiremock.com.google.common.eventbus", + "wiremock.com.google.common.graph", + "wiremock.com.google.common.hash", + "wiremock.com.google.common.html", + "wiremock.com.google.common.io", + "wiremock.com.google.common.math", + "wiremock.com.google.common.net", + "wiremock.com.google.common.primitives", + "wiremock.com.google.common.reflect", + "wiremock.com.google.common.util.concurrent", + "wiremock.com.google.common.xml", + "wiremock.com.google.thirdparty.publicsuffix", + "wiremock.com.jayway.jsonpath", + "wiremock.com.jayway.jsonpath.internal", + "wiremock.com.jayway.jsonpath.internal.filter", + "wiremock.com.jayway.jsonpath.internal.function", + "wiremock.com.jayway.jsonpath.internal.function.json", + "wiremock.com.jayway.jsonpath.internal.function.latebinding", + "wiremock.com.jayway.jsonpath.internal.function.numeric", + "wiremock.com.jayway.jsonpath.internal.function.text", + "wiremock.com.jayway.jsonpath.internal.path", + "wiremock.com.jayway.jsonpath.spi.cache", + "wiremock.com.jayway.jsonpath.spi.json", + "wiremock.com.jayway.jsonpath.spi.mapper", + "wiremock.javax.servlet", + "wiremock.javax.servlet.annotation", + "wiremock.javax.servlet.descriptor", + "wiremock.javax.servlet.http", + "wiremock.net.minidev.asm", + "wiremock.net.minidev.asm.ex", + "wiremock.net.minidev.json", + "wiremock.net.minidev.json.annotate", + "wiremock.net.minidev.json.parser", + "wiremock.net.minidev.json.reader", + "wiremock.net.minidev.json.writer", + "wiremock.org.antlr.v4.runtime", + "wiremock.org.antlr.v4.runtime.atn", + "wiremock.org.antlr.v4.runtime.dfa", + "wiremock.org.antlr.v4.runtime.misc", + "wiremock.org.antlr.v4.runtime.tree", + "wiremock.org.antlr.v4.runtime.tree.pattern", + "wiremock.org.antlr.v4.runtime.tree.xpath", + "wiremock.org.apache.commons.codec", + "wiremock.org.apache.commons.codec.binary", + "wiremock.org.apache.commons.codec.cli", + "wiremock.org.apache.commons.codec.digest", + "wiremock.org.apache.commons.codec.language", + "wiremock.org.apache.commons.codec.language.bm", + "wiremock.org.apache.commons.codec.net", + "wiremock.org.apache.commons.fileupload", + "wiremock.org.apache.commons.fileupload.disk", + "wiremock.org.apache.commons.fileupload.portlet", + "wiremock.org.apache.commons.fileupload.servlet", + "wiremock.org.apache.commons.fileupload.util", + "wiremock.org.apache.commons.fileupload.util.mime", + "wiremock.org.apache.commons.io", + "wiremock.org.apache.commons.io.comparator", + "wiremock.org.apache.commons.io.filefilter", + "wiremock.org.apache.commons.io.input", + "wiremock.org.apache.commons.io.monitor", + "wiremock.org.apache.commons.io.output", + "wiremock.org.apache.commons.lang3", + "wiremock.org.apache.commons.lang3.arch", + "wiremock.org.apache.commons.lang3.builder", + "wiremock.org.apache.commons.lang3.concurrent", + "wiremock.org.apache.commons.lang3.event", + "wiremock.org.apache.commons.lang3.exception", + "wiremock.org.apache.commons.lang3.math", + "wiremock.org.apache.commons.lang3.mutable", + "wiremock.org.apache.commons.lang3.reflect", + "wiremock.org.apache.commons.lang3.text", + "wiremock.org.apache.commons.lang3.text.translate", + "wiremock.org.apache.commons.lang3.time", + "wiremock.org.apache.commons.lang3.tuple", + "wiremock.org.apache.commons.logging", + "wiremock.org.apache.commons.logging.impl", + "wiremock.org.apache.http", + "wiremock.org.apache.http.annotation", + "wiremock.org.apache.http.auth", + "wiremock.org.apache.http.auth.params", + "wiremock.org.apache.http.client", + "wiremock.org.apache.http.client.config", + "wiremock.org.apache.http.client.entity", + "wiremock.org.apache.http.client.methods", + "wiremock.org.apache.http.client.params", + "wiremock.org.apache.http.client.protocol", + "wiremock.org.apache.http.client.utils", + "wiremock.org.apache.http.concurrent", + "wiremock.org.apache.http.config", + "wiremock.org.apache.http.conn", + "wiremock.org.apache.http.conn.params", + "wiremock.org.apache.http.conn.routing", + "wiremock.org.apache.http.conn.scheme", + "wiremock.org.apache.http.conn.socket", + "wiremock.org.apache.http.conn.ssl", + "wiremock.org.apache.http.conn.util", + "wiremock.org.apache.http.cookie", + "wiremock.org.apache.http.cookie.params", + "wiremock.org.apache.http.entity", + "wiremock.org.apache.http.impl", + "wiremock.org.apache.http.impl.auth", + "wiremock.org.apache.http.impl.bootstrap", + "wiremock.org.apache.http.impl.client", + "wiremock.org.apache.http.impl.conn", + "wiremock.org.apache.http.impl.conn.tsccm", + "wiremock.org.apache.http.impl.cookie", + "wiremock.org.apache.http.impl.entity", + "wiremock.org.apache.http.impl.execchain", + "wiremock.org.apache.http.impl.io", + "wiremock.org.apache.http.impl.pool", + "wiremock.org.apache.http.io", + "wiremock.org.apache.http.message", + "wiremock.org.apache.http.params", + "wiremock.org.apache.http.pool", + "wiremock.org.apache.http.protocol", + "wiremock.org.apache.http.ssl", + "wiremock.org.apache.http.util", + "wiremock.org.custommonkey.xmlunit", + "wiremock.org.custommonkey.xmlunit.examples", + "wiremock.org.custommonkey.xmlunit.exceptions", + "wiremock.org.custommonkey.xmlunit.jaxp13", + "wiremock.org.custommonkey.xmlunit.util", + "wiremock.org.eclipse.jetty.client", + "wiremock.org.eclipse.jetty.client.api", + "wiremock.org.eclipse.jetty.client.http", + "wiremock.org.eclipse.jetty.client.util", + "wiremock.org.eclipse.jetty.continuation", + "wiremock.org.eclipse.jetty.http", + "wiremock.org.eclipse.jetty.http.pathmap", + "wiremock.org.eclipse.jetty.io", + "wiremock.org.eclipse.jetty.io.ssl", + "wiremock.org.eclipse.jetty.proxy", + "wiremock.org.eclipse.jetty.security", + "wiremock.org.eclipse.jetty.security.authentication", + "wiremock.org.eclipse.jetty.server", + "wiremock.org.eclipse.jetty.server.handler", + "wiremock.org.eclipse.jetty.server.handler.jmx", + "wiremock.org.eclipse.jetty.server.jmx", + "wiremock.org.eclipse.jetty.server.nio", + "wiremock.org.eclipse.jetty.server.session", + "wiremock.org.eclipse.jetty.server.session.jmx", + "wiremock.org.eclipse.jetty.servlet", + "wiremock.org.eclipse.jetty.servlet.jmx", + "wiremock.org.eclipse.jetty.servlet.listener", + "wiremock.org.eclipse.jetty.servlets", + "wiremock.org.eclipse.jetty.servlets.gzip", + "wiremock.org.eclipse.jetty.util", + "wiremock.org.eclipse.jetty.util.annotation", + "wiremock.org.eclipse.jetty.util.component", + "wiremock.org.eclipse.jetty.util.log", + "wiremock.org.eclipse.jetty.util.preventers", + "wiremock.org.eclipse.jetty.util.resource", + "wiremock.org.eclipse.jetty.util.security", + "wiremock.org.eclipse.jetty.util.ssl", + "wiremock.org.eclipse.jetty.util.statistic", + "wiremock.org.eclipse.jetty.util.thread", + "wiremock.org.eclipse.jetty.webapp", + "wiremock.org.eclipse.jetty.xml", + "wiremock.org.objectweb.asm", + "wiremock.org.objectweb.asm.signature", + "wiremock.org.xmlunit", + "wiremock.org.xmlunit.builder", + "wiremock.org.xmlunit.diff", + "wiremock.org.xmlunit.input", + "wiremock.org.xmlunit.placeholder", + "wiremock.org.xmlunit.transform", + "wiremock.org.xmlunit.util", + "wiremock.org.xmlunit.validation", + "wiremock.org.xmlunit.xpath" + ] + }, + "repositories": { + "https://repo1.maven.org/maven2/": [ + "com.github.tomakehurst:wiremock-standalone", + "com.github.tomakehurst:wiremock-standalone:jar:sources" + ] + }, + "services": { + "com.github.tomakehurst:wiremock-standalone": { + "wiremock.com.fasterxml.jackson.core.JsonFactory": [ + "wiremock.com.fasterxml.jackson.core.JsonFactory" + ], + "wiremock.com.fasterxml.jackson.core.ObjectCodec": [ + "wiremock.com.fasterxml.jackson.databind.ObjectMapper" + ], + "wiremock.org.xmlunit.placeholder.PlaceholderHandler": [ + "wiremock.org.xmlunit.placeholder.IgnorePlaceholderHandler", + "wiremock.org.xmlunit.placeholder.IsDateTimePlaceholderHandler", + "wiremock.org.xmlunit.placeholder.IsNumberPlaceholderHandler", + "wiremock.org.xmlunit.placeholder.MatchesRegexPlaceholderHandler" + ] + } + }, + "version": "3" +}
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md index a5b86f0..ae8be94 100644 --- a/src/main/resources/Documentation/build.md +++ b/src/main/resources/Documentation/build.md
@@ -7,12 +7,12 @@ [plugins/its-base](https://gerrit-review.googlesource.com/#/admin/projects/plugins/its-base) to the `plugins` directory of Gerrit's source tree. -Put the external dependency Bazel build file into the Gerrit plugins directory, -replacing the existing empty one. +Wire the plugin's Maven dependencies into the in-tree build by linking its +module fragment into the Gerrit plugins directory. ``` cd gerrit/plugins - ln -sf @PLUGIN@/external_plugin_deps.bzl . + ln -sf @PLUGIN@/external_plugin_deps.MODULE.bazel . ``` Then issue @@ -29,15 +29,6 @@ bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar ``` -This project can be imported into the Eclipse IDE. -Add the plugin name to the `CUSTOM_PLUGINS` and -`CUSTOM_PLUGINS_TEST_DEPS` sets in the file -`<gerrit_source_code>/tools/bzl/plugins.bzl` and execute: - -``` - ./tools/eclipse/project.py -``` - To execute the tests run: ```