Bazel: Remove redundant plugin build boilerplate

Recent bazlets changes let gerrit_plugin() resolve Maven coordinates
passed through ext_deps against the default <plugin>_plugin_deps
repository.

They also let gerrit_plugin_tests() derive the default test target name,
wire the plugin under test, resolve external test dependencies from
ext_deps, and generate the runtime dependency checks when plugin is set.

Use those macro defaults in owners-common-api instead of spelling out
artifact() conversions and dependency test rules locally.

Change-Id: Idbae85352a6e1621de195896efd672219a2f7ab1
1 file changed
tree: 8294cdaf8babc8318be89deecc58e878ab7855fd
  1. src/
  2. .gitignore
  3. BUILD
  4. external_plugin_deps.MODULE.bazel
  5. Jenkinsfile
  6. LICENSE
  7. MODULE.bazel
  8. MODULE.bazel.lock
  9. owners-common-api_plugin_deps.lock.json
  10. owners-common-api_third_party_runtime_jars.allowlist.txt
  11. README.md
README.md

Gerrit Owners-Common-API Plugin

This repository contains the basic infrastructure and API for building and running two separate plugins, owners and owners-autoassign.

It provides the ability to parse the OWNERS file format and it's parsing across branches and repositories.

Building the plugins

This plugin is built with Bazel in Gerrit tree

Create symbolic links of the owners-common-api folderd and of the external_plugin_deps.bzl file to the Gerrit source code /plugins directory.

Then build the owners-common-api plugin with the usual Gerrit plugin compile command.

Example:

  git clone https://gerrit.googlesource.com/plugins/owners-common-api
  git clone --recurse-submodules https://gerrit.googlesource.com/gerrit
  cd gerrit/plugins
  ln -s ../../owners/owners-common-api .
  ln -sf owners-common-api/external_plugin_deps.bzl.MODULE.bazel .
  cd ..
  bazel build plugins/owners-common-api

The output is created in

  bazel-bin/plugins/owners-common-api/owners-common-api.jar

To execute the tests run:

  bazel test plugins/owners-common-api/...

This project can be imported into the Eclipse IDE:

Add the plugin name to the CUSTOM_PLUGINS (and in case when you want to run tests from the IDE to CUSTOM_PLUGINS_TEST_DEPS) in Gerrit core in tools/bzl/plugins.bzl file and run:

  ./tools/eclipse/project.py