Bazel: Migrate to gerrit_js_bundle rule

Depends-On: https://gerrit-review.googlesource.com/c/gerrit/+/304225
Change-Id: I6df9f2cf537d26beb6c638eaafb32c84ed03c466
(cherry picked from commit d4a749c627d163117238baf443ce2ce77cb4cc4a)
diff --git a/BUILD b/BUILD
index b0ef90f..52f43b1 100644
--- a/BUILD
+++ b/BUILD
@@ -1,5 +1,4 @@
 load("@rules_java//java:defs.bzl", "java_library")
-load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
 load("//tools/bzl:junit.bzl", "junit_tests")
 load("//tools/js:eslint.bzl", "eslint")
 load(
@@ -8,8 +7,7 @@
     "PLUGIN_TEST_DEPS",
     "gerrit_plugin",
 )
-load("//tools/bzl:genrule2.bzl", "genrule2")
-load("//tools/bzl:js.bzl", "polygerrit_plugin")
+load("//tools/bzl:js.bzl", "gerrit_js_bundle")
 
 gerrit_plugin(
     name = "reviewers",
@@ -18,38 +16,14 @@
         "Gerrit-PluginName: reviewers",
         "Gerrit-Module: com.googlesource.gerrit.plugins.reviewers.Module",
     ],
-    resource_jars = [":rv-reviewers-static"],
+    resource_jars = [":rv-reviewers"],
     resources = glob(["src/main/resources/**/*"]),
 )
 
-genrule2(
-    name = "rv-reviewers-static",
-    srcs = [":rv-reviewers"],
-    outs = ["rv-reviewers-static.jar"],
-    cmd = " && ".join([
-        "mkdir $$TMP/static",
-        "cp -r $(locations :rv-reviewers) $$TMP/static",
-        "cd $$TMP",
-        "zip -Drq $$ROOT/$@ -g .",
-    ]),
-)
-
-polygerrit_plugin(
+gerrit_js_bundle(
     name = "rv-reviewers",
-    app = "reviewers-bundle.js",
-    plugin_name = "rv-reviewers",
-)
-
-rollup_bundle(
-    name = "reviewers-bundle",
     srcs = glob(["rv-reviewers/*.js"]),
     entry_point = "rv-reviewers/plugin.js",
-    format = "iife",
-    rollup_bin = "//tools/node_tools:rollup-bin",
-    sourcemap = "hidden",
-    deps = [
-        "@tools_npm//rollup-plugin-node-resolve",
-    ],
 )
 
 junit_tests(