Dedupe gerrit_api and gerrit_api_maven_local

Much of the code was shared between gerrit_api and
gerrit_api_maven_local. This made it easy to miss version numbers when
updating. And it means much commenting/uncommenting when switching a
Gerrit plugin from a released API to a local one and vice-versa.

By bringing all the needed logic directly into `gerrit_api` we now have
a single canonical place for the used Gerrit API version, which
follow-up commits can use for stamping. And switching a Gerrit plugin's
standalone build from a released API version to a local one becomes
much simpler.

Change-Id: Ib638ee1a1791ffd720aabd7539597f89206ab957
diff --git a/README.md b/README.md
index 1423397..22ea51a 100644
--- a/README.md
+++ b/README.md
@@ -36,9 +36,9 @@
 provided:
 
 ```python
-load("@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
-     "gerrit_api_maven_local")
-gerrit_api_maven_local()
+load("@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
+     "gerrit_api")
+gerrit_api(local_repository = True)
 ```
 
 <a name="basic-example"></a>
diff --git a/gerrit_api.bzl b/gerrit_api.bzl
index af6d6a5..1efeb91 100644
--- a/gerrit_api.bzl
+++ b/gerrit_api.bzl
@@ -1,7 +1,7 @@
 load("//:bouncycastle.bzl", "bouncycastle_repos")
 load("//:gerrit_api_version.bzl", "gerrit_api_version")
 load("//:rules_python.bzl", "rules_python_repos")
-load("//tools:maven_jar.bzl", "maven_jar")
+load("//tools:maven_jar.bzl", "MAVEN_LOCAL", "MAVEN_CENTRAL", "maven_jar")
 
 """Bazel rule for building [Gerrit Code Review](https://www.gerritcodereview.com/)
 gerrit_api is rule for fetching Gerrit plugin API using Bazel.
@@ -9,7 +9,7 @@
 
 VER = "3.0.10"
 
-def gerrit_api():
+def gerrit_api(local_repository = False):
     gerrit_api_version(
         name = "gerrit_api_version",
         version = VER,
@@ -21,12 +21,14 @@
     maven_jar(
         name = "gerrit_plugin_api",
         artifact = "com.google.gerrit:gerrit-plugin-api:" + VER,
-        sha1 = "90df648d9ef9e1a953e253972d9922fc1b753f83",
+        sha1 = "" if local_repository else "90df648d9ef9e1a953e253972d9922fc1b753f83",
+        repository = MAVEN_LOCAL if local_repository else MAVEN_CENTRAL,
     )
     maven_jar(
         name = "gerrit_acceptance_framework",
         artifact = "com.google.gerrit:gerrit-acceptance-framework:" + VER,
-        sha1 = "9c30ee281fa9016d460d16dd08a87ef16cedbf84",
+        sha1 = "" if local_repository else "9c30ee281fa9016d460d16dd08a87ef16cedbf84",
+        repository = MAVEN_LOCAL if local_repository else MAVEN_CENTRAL,
     )
     native.bind(
         name = "gerrit-plugin-api",
diff --git a/gerrit_api_maven_local.bzl b/gerrit_api_maven_local.bzl
deleted file mode 100644
index 8c13011..0000000
--- a/gerrit_api_maven_local.bzl
+++ /dev/null
@@ -1,46 +0,0 @@
-load("//:bouncycastle.bzl", "bouncycastle_repos")
-load("//:gerrit_api_version.bzl", "gerrit_api_version")
-load("//:rules_python.bzl", "rules_python_repos")
-load("//tools:maven_jar.bzl", "MAVEN_LOCAL", "maven_jar")
-
-"""Bazel rule for building [Gerrit Code Review](https://www.gerritcodereview.com/)
-gerrit_api is rule for fetching Gerrit plugin API using Bazel.
-"""
-
-VER = "3.0.11-SNAPSHOT"
-
-def gerrit_api_maven_local():
-    gerrit_api_version(
-        name = "gerrit_api_version",
-        version = VER,
-    )
-
-    bouncycastle_repos()
-    rules_python_repos()
-
-    maven_jar(
-        name = "gerrit_plugin_api",
-        artifact = "com.google.gerrit:gerrit-plugin-api:" + VER,
-        repository = MAVEN_LOCAL,
-    )
-    maven_jar(
-        name = "gerrit_acceptance_framework",
-        artifact = "com.google.gerrit:gerrit-acceptance-framework:" + VER,
-        repository = MAVEN_LOCAL,
-    )
-    native.bind(
-        name = "gerrit-plugin-api",
-        actual = "@gerrit_plugin_api//jar",
-    )
-    native.bind(
-        name = "gerrit-acceptance-framework",
-        actual = "@gerrit_acceptance_framework//jar",
-    )
-    native.bind(
-        name = "gerrit-plugin-api-neverlink",
-        actual = "@gerrit_plugin_api//jar:neverlink",
-    )
-    native.bind(
-        name = "gerrit-acceptance-framework-neverlink",
-        actual = "@gerrit_acceptance_framework//jar:neverlink",
-    )