Merge "Bazel: Externalize JGIT_VERS constant"
diff --git a/WORKSPACE b/WORKSPACE
index 78ae16b..ac50f4a 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -132,7 +132,7 @@
   sha256 = '80d63c117736ae2fb9837b7a39576f3f0c5bd19cd75127886550c77b4c478f87',
 )
 
-JGIT_VERS = '4.5.0.201609210915-r'
+load('//lib/jgit:jgit.bzl', 'JGIT_VERS')
 
 maven_jar(
   name = 'jgit',
diff --git a/gerrit-extension-api/BUILD b/gerrit-extension-api/BUILD
index b66617a..d242495 100644
--- a/gerrit-extension-api/BUILD
+++ b/gerrit-extension-api/BUILD
@@ -1,3 +1,4 @@
+load('//lib/jgit:jgit.bzl', 'JGIT_DOC_URL')
 load('//tools/bzl:gwt.bzl', 'gwt_module')
 
 SRC = 'src/main/java/com/google/gerrit/extensions/'
@@ -52,4 +53,5 @@
   title = 'Gerrit Review Extension API Documentation',
   libs = [':api'],
   pkgs = ['com.google.gerrit.extensions'],
+  external_docs = [JGIT_DOC_URL],
 )
diff --git a/lib/JGIT_VERSION b/lib/JGIT_VERSION
index b7f7c84..569cf59 100644
--- a/lib/JGIT_VERSION
+++ b/lib/JGIT_VERSION
@@ -1,6 +1,4 @@
+include_defs('//lib/jgit/jgit.bzl')
 include_defs('//lib/maven.defs')
 
 REPO = MAVEN_CENTRAL # Leave here even if set to MAVEN_CENTRAL.
-VERS = '4.5.0.201609210915-r'
-DOC_VERS = VERS # Set to VERS unless using a snapshot
-JGIT_DOC_URL="http://download.eclipse.org/jgit/site/" + DOC_VERS + "/apidocs"
diff --git a/lib/jgit/jgit.bzl b/lib/jgit/jgit.bzl
new file mode 100644
index 0000000..996e44d
--- /dev/null
+++ b/lib/jgit/jgit.bzl
@@ -0,0 +1,3 @@
+JGIT_VERS = '4.5.0.201609210915-r'
+DOC_VERS = JGIT_VERS # Set to VERS unless using a snapshot
+JGIT_DOC_URL="http://download.eclipse.org/jgit/site/" + DOC_VERS + "/apidocs"
diff --git a/lib/jgit/org.eclipse.jgit.archive/BUCK b/lib/jgit/org.eclipse.jgit.archive/BUCK
index 7c967b3..02f99c6 100644
--- a/lib/jgit/org.eclipse.jgit.archive/BUCK
+++ b/lib/jgit/org.eclipse.jgit.archive/BUCK
@@ -3,7 +3,7 @@
 
 maven_jar(
   name = 'jgit-archive',
-  id = 'org.eclipse.jgit:org.eclipse.jgit.archive:' + VERS,
+  id = 'org.eclipse.jgit:org.eclipse.jgit.archive:' + JGIT_VERS,
   sha1 = '2db2e7666672a31fa41b7e1dadcba51df6d30954',
   license = 'jgit',
   repository = REPO,
diff --git a/lib/jgit/org.eclipse.jgit.http.server/BUCK b/lib/jgit/org.eclipse.jgit.http.server/BUCK
index 06865cb..5dd3777 100644
--- a/lib/jgit/org.eclipse.jgit.http.server/BUCK
+++ b/lib/jgit/org.eclipse.jgit.http.server/BUCK
@@ -3,7 +3,7 @@
 
 maven_jar(
   name = 'jgit-servlet',
-  id = 'org.eclipse.jgit:org.eclipse.jgit.http.server:' + VERS,
+  id = 'org.eclipse.jgit:org.eclipse.jgit.http.server:' + JGIT_VERS,
   sha1 = '6e36638888918d9941dddec7e2abe1f162cc74d9',
   license = 'jgit',
   repository = REPO,
diff --git a/lib/jgit/org.eclipse.jgit.junit/BUCK b/lib/jgit/org.eclipse.jgit.junit/BUCK
index 77b637a..e5cd5c0 100644
--- a/lib/jgit/org.eclipse.jgit.junit/BUCK
+++ b/lib/jgit/org.eclipse.jgit.junit/BUCK
@@ -3,7 +3,7 @@
 
 maven_jar(
   name = 'junit',
-  id = 'org.eclipse.jgit:org.eclipse.jgit.junit:' + VERS,
+  id = 'org.eclipse.jgit:org.eclipse.jgit.junit:' + JGIT_VERS,
   sha1 = 'e8fb1d81f588c3174a9730bdecdbde9faa04140a',
   license = 'DO_NOT_DISTRIBUTE',
   repository = REPO,
diff --git a/lib/jgit/org.eclipse.jgit/BUCK b/lib/jgit/org.eclipse.jgit/BUCK
index 458703c..74338de 100644
--- a/lib/jgit/org.eclipse.jgit/BUCK
+++ b/lib/jgit/org.eclipse.jgit/BUCK
@@ -3,7 +3,7 @@
 
 maven_jar(
   name = 'jgit',
-  id = 'org.eclipse.jgit:org.eclipse.jgit:' + VERS,
+  id = 'org.eclipse.jgit:org.eclipse.jgit:' + JGIT_VERS,
   bin_sha1 = '3e3d0b73dcf4ad649f37758ea8502d92f3d299de',
   src_sha1 = 'fc352952db91a4046e4b832145eb2dc8afce8db1',
   license = 'jgit',