Migrate to bazelmod

Switch the BUILD from in-tree macros (//tools/bzl) to the bazlets
gerrit_plugin.bzl macros, which auto-detect the build mode and work
both in-tree and standalone.

* gerrit_plugin: use plugin= instead of name=
* fold junit_tests into gerrit_plugin_tests, which auto-wires the
  plugin classes, Gerrit API and acceptance framework deps

Change-Id: I32c77cfa0f7cd5139dbef9e04584e5c4ada111e9
diff --git a/BUILD b/BUILD
index 0acd015..b58a037 100644
--- a/BUILD
+++ b/BUILD
@@ -1,28 +1,22 @@
-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 = "ref-protection",
     srcs = glob(["src/main/java/**/*.java"]),
-    resources = glob(["src/main/resources/**/*"]),
     manifest_entries = [
         "Implementation-Title: Ref Protection plugin",
         "Implementation-URL: http://gerrit.googlesource.com/plugins/ref-protection",
         "Gerrit-PluginName: ref-protection",
         "Gerrit-Module: com.googlesource.gerrit.plugins.refprotection.RefProtectionModule",
     ],
+    plugin = "ref-protection",
+    resources = glob(["src/main/resources/**/*"]),
 )
 
-junit_tests(
-    name = "ref_protection_tests",
+gerrit_plugin_tests(
     srcs = glob(["src/test/java/**/*.java"]),
-    tags = ["ref-protection"],
-    deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
-        ":ref-protection__plugin",
-    ],
+    plugin = "ref-protection",
 )