Add target parameter to gerrit_plugin_dependency_tests

gerrit_plugin_dependency_tests() previously hardcoded :NAME__plugin
as the runtime-classpath-providing target. That worked for plugins
built via gerrit_plugin(), but blocked the same runtime-JAR checks
for plugins that ship a standalone java_library -- e.g. shared
OAuth/lib modules consumed by a sibling java_binary, where there is
no :NAME__plugin target.

Add an optional `target` parameter that, when provided, overrides
the default :%s__plugin derivation. Existing callers are unaffected:
omitting `target` keeps the previous behavior.

Change-Id: Ib84e6f67cb8d38802684b1211aa94a6a3abb2b76
diff --git a/gerrit_plugin.bzl b/gerrit_plugin.bzl
index 7b1b743..c59ce2b 100644
--- a/gerrit_plugin.bzl
+++ b/gerrit_plugin.bzl
@@ -376,7 +376,8 @@
         plugin,
         name = "dependency_tests",
         allowlist = None,
-        overlap_against = None):
+        overlap_against = None,
+        target = None):
     """Generates runtime JAR safety tests for a Gerrit plugin.
 
     Targets the `:{plugin}__plugin` library created by `gerrit_plugin()`, so
@@ -405,6 +406,12 @@
       overlap_against: Label of a JAR-ID manifest to check for overlap (e.g.
                        the Gerrit WAR's `//:headless.war.jars.txt`). Defaults
                        to `//:headless.war.jars.txt`.
+      target: Optional Bazel label of the runtime-classpath-providing target
+              to inspect. Defaults to `:{plugin}__plugin` (the library created
+              by `gerrit_plugin()`). Pass an explicit label when the runtime
+              jars are carried by something other than a `gerrit_plugin()`
+              target — e.g. a standalone `java_library` consumed by a sibling
+              `java_binary`.
 
     Example:
       load(
@@ -429,7 +436,7 @@
           # overlap_against = "//:headless.war.jars.txt",
       )
     """
-    plugin_target = ":%s__plugin" % plugin
+    plugin_target = target if target else ":%s__plugin" % plugin
 
     if not allowlist:
         allowlist = ":%s_third_party_runtime_jars.allowlist.txt" % plugin