Bazel: switch oauth BUILD to native ext_deps support Use native `ext_deps` support in `gerrit_plugin()` and `gerrit_plugin_tests()` in the oauth plugin BUILD file. Declare external dependencies as Maven coordinates instead of generated Bazel labels, and share common test dependencies through `EXT_DEPS`. This removes repeated `@oauth_plugin_deps//...` labels, avoids explicit test target naming and manual `:oauth__plugin` wiring, and drops the separate call to `gerrit_plugin_dependency_tests()`. Change-Id: Ib076fc310be6b0b75b17dff7d80e25defdd2b728
diff --git a/BUILD b/BUILD index 950cad0..e323273 100644 --- a/BUILD +++ b/BUILD
@@ -1,13 +1,25 @@ load( "@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl", "gerrit_plugin", - "gerrit_plugin_dependency_tests", "gerrit_plugin_tests", ) +EXT_DEPS = [ + "com.github.scribejava:scribejava-apis", + "com.github.scribejava:scribejava-core", + "com.sap.cloud.security.java:api", + "com.sap.cloud.security.java:security", +] + +PLUGIN = "oauth" + gerrit_plugin( - name = "oauth", srcs = glob(["src/main/java/**/*.java"]), + ext_deps = [ + "com.fasterxml.jackson.core:jackson-databind", + "com.sap.cloud.security:env", + "com.sap.cloud.security.xsuaa:token-client", + ] + EXT_DEPS, manifest_entries = [ "Gerrit-PluginName: gerrit-oauth-provider", "Gerrit-Module: com.googlesource.gerrit.plugins.oauth.Module", @@ -16,29 +28,12 @@ "Implementation-Title: Gerrit OAuth authentication provider", "Implementation-URL: https://github.com/davido/gerrit-oauth-provider", ], + plugin = PLUGIN, resources = glob(["src/main/resources/**/*"]), - deps = [ - "@oauth_plugin_deps//:com_fasterxml_jackson_core_jackson_databind", - "@oauth_plugin_deps//:com_github_scribejava_scribejava_apis", - "@oauth_plugin_deps//:com_github_scribejava_scribejava_core", - "@oauth_plugin_deps//:com_sap_cloud_security_env", - "@oauth_plugin_deps//:com_sap_cloud_security_java_api", - "@oauth_plugin_deps//:com_sap_cloud_security_java_security", - "@oauth_plugin_deps//:com_sap_cloud_security_xsuaa_token_client", - ], ) gerrit_plugin_tests( - name = "oauth_tests", srcs = glob(["src/test/java/**/*.java"]), - tags = ["oauth"], - deps = [ - ":oauth__plugin", - "@oauth_plugin_deps//:com_github_scribejava_scribejava_apis", - "@oauth_plugin_deps//:com_github_scribejava_scribejava_core", - "@oauth_plugin_deps//:com_sap_cloud_security_java_api", - "@oauth_plugin_deps//:com_sap_cloud_security_java_security", - ], + ext_deps = EXT_DEPS, + plugin = PLUGIN, ) - -gerrit_plugin_dependency_tests(plugin = "oauth")