Simplify local JGit development
Put all the logic in jgit.bzl, where a single edit suffices to get the local flavor. Given that all sha1 for jgit dependencies are in jgit.bzl, we can remove the constants and use sha1 values directly. Change-Id: Icabf651e02f226e5c025457d54588074a11ae283
This commit is contained in:
parent
ca0587bcbe
commit
fe81f93215
@ -354,14 +354,9 @@ And corresponding WORKSPACE excerpt:
|
||||
|
||||
[[consume-jgit-from-development-tree]]
|
||||
|
||||
To consume the JGit dependency from the development tree, uncomment
|
||||
`local_repository` rule for `jgit` in WORKSPACE file and uncomment
|
||||
the lines in the `lib/jgit/**/BUILD` files for `jgit` rule aliases.
|
||||
`jgit-dev=1` must be passed in to bazel:
|
||||
|
||||
----
|
||||
$ bazel test --define jgit-dev=1 ...
|
||||
----
|
||||
To consume the JGit dependency from the development tree, edit
|
||||
`lib/jgit/jgit.bzl` setting LOCAL_JGIT_REPO to a directory holding a
|
||||
JGit repository.
|
||||
|
||||
[[clean-cache]]
|
||||
=== Cleaning The download cache
|
||||
|
44
WORKSPACE
44
WORKSPACE
@ -130,34 +130,9 @@ maven_jar(
|
||||
sha1 = "cdb2dcb4e22b83d6b32b93095f644c3462739e82",
|
||||
)
|
||||
|
||||
load("//lib/jgit:jgit.bzl", "JGIT_VERS", "JGIT_REPO", "JGIT_SHA1", "JGIT_SRC_SHA1", "JGIT_SERVLET_SHA1", "JGIT_ARCHIVE_SHA1", "JGIT_JUNIT_SHA1")
|
||||
load("//lib/jgit:jgit.bzl", "jgit_repos")
|
||||
|
||||
#
|
||||
# Uncomment jgit repository to route JGit dependency to development tree.
|
||||
# Pass jgit-dev=1 in to bazel: `bazel test --define jgit-dev=1 ...`
|
||||
# Due to: https://github.com/bazelbuild/bazel/issues/2707
|
||||
# aliases to jgit should be uncommented in lib/jgit/**/BUILD files.
|
||||
#local_repository(
|
||||
# name = "jgit",
|
||||
# path = "/home/<user>/projects/jgit",
|
||||
#)
|
||||
|
||||
maven_jar(
|
||||
name = "jgit_lib",
|
||||
artifact = "org.eclipse.jgit:org.eclipse.jgit:" + JGIT_VERS,
|
||||
repository = JGIT_REPO,
|
||||
sha1 = JGIT_SHA1,
|
||||
src_sha1 = JGIT_SRC_SHA1,
|
||||
unsign = True,
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = "jgit_servlet",
|
||||
artifact = "org.eclipse.jgit:org.eclipse.jgit.http.server:" + JGIT_VERS,
|
||||
repository = JGIT_REPO,
|
||||
sha1 = JGIT_SERVLET_SHA1,
|
||||
unsign = True,
|
||||
)
|
||||
jgit_repos()
|
||||
|
||||
maven_jar(
|
||||
name = "javaewah",
|
||||
@ -166,21 +141,6 @@ maven_jar(
|
||||
sha1 = "94ad16d728b374d65bd897625f3fbb3da223a2b6",
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = "jgit_archive",
|
||||
artifact = "org.eclipse.jgit:org.eclipse.jgit.archive:" + JGIT_VERS,
|
||||
repository = JGIT_REPO,
|
||||
sha1 = JGIT_ARCHIVE_SHA1,
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = "jgit_junit",
|
||||
artifact = "org.eclipse.jgit:org.eclipse.jgit.junit:" + JGIT_VERS,
|
||||
repository = JGIT_REPO,
|
||||
sha1 = JGIT_JUNIT_SHA1,
|
||||
unsign = True,
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = "gwtjsonrpc",
|
||||
artifact = "com.google.gerrit:gwtjsonrpc:1.11",
|
||||
|
@ -1,7 +0,0 @@
|
||||
config_setting(
|
||||
name = "dev",
|
||||
values = {
|
||||
"define": "jgit-dev=1",
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
@ -1,19 +1,66 @@
|
||||
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_LOCAL", "MAVEN_CENTRAL")
|
||||
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_LOCAL", "MAVEN_CENTRAL", "maven_jar")
|
||||
|
||||
JGIT_VERS = "4.6.0.201612231935-r.30-gd3148f300"
|
||||
_JGIT_VERS = "4.6.0.201612231935-r.30-gd3148f300"
|
||||
|
||||
DOC_VERS = "4.6.0.201612231935-r" # Set to JGIT_VERS unless using a snapshot
|
||||
_DOC_VERS = "4.6.0.201612231935-r" # Set to _JGIT_VERS unless using a snapshot
|
||||
|
||||
JGIT_DOC_URL = "http://download.eclipse.org/jgit/site/" + DOC_VERS + "/apidocs"
|
||||
JGIT_DOC_URL = "http://download.eclipse.org/jgit/site/" + _DOC_VERS + "/apidocs"
|
||||
|
||||
JGIT_REPO = GERRIT # Leave here even if set to MAVEN_CENTRAL.
|
||||
_JGIT_REPO = GERRIT # Leave here even if set to MAVEN_CENTRAL.
|
||||
|
||||
JGIT_SHA1 = "a2b5970b853f8fee64589fc1103c0ceb7677ba63"
|
||||
# set this to use a local version.
|
||||
# "/home/<user>/projects/jgit"
|
||||
LOCAL_JGIT_REPO = ""
|
||||
|
||||
JGIT_SRC_SHA1 = "765f955774c36c226aa41fba7c20119451de2db7"
|
||||
def jgit_repos():
|
||||
if LOCAL_JGIT_REPO:
|
||||
native.local_repository(
|
||||
name = "jgit",
|
||||
path = LOCAL_JGIT_REPO,
|
||||
)
|
||||
else:
|
||||
jgit_maven_repos()
|
||||
|
||||
JGIT_SERVLET_SHA1 = "d3aa54bd610db9a5c246aa8fef13989982c98628"
|
||||
def jgit_maven_repos():
|
||||
maven_jar(
|
||||
name = "jgit_lib",
|
||||
artifact = "org.eclipse.jgit:org.eclipse.jgit:" + _JGIT_VERS,
|
||||
repository = _JGIT_REPO,
|
||||
sha1 = "a2b5970b853f8fee64589fc1103c0ceb7677ba63",
|
||||
src_sha1 = "765f955774c36c226aa41fba7c20119451de2db7",
|
||||
unsign = True,
|
||||
)
|
||||
maven_jar(
|
||||
name = "jgit_servlet",
|
||||
artifact = "org.eclipse.jgit:org.eclipse.jgit.http.server:" + _JGIT_VERS,
|
||||
repository = _JGIT_REPO,
|
||||
sha1 = "d3aa54bd610db9a5c246aa8fef13989982c98628",
|
||||
unsign = True,
|
||||
)
|
||||
maven_jar(
|
||||
name = "jgit_archive",
|
||||
artifact = "org.eclipse.jgit:org.eclipse.jgit.archive:" + _JGIT_VERS,
|
||||
repository = _JGIT_REPO,
|
||||
sha1 = "a728cf277396f1227c5a8dffcf5dee0188fc0821",
|
||||
)
|
||||
maven_jar(
|
||||
name = "jgit_junit",
|
||||
artifact = "org.eclipse.jgit:org.eclipse.jgit.junit:" + _JGIT_VERS,
|
||||
repository = _JGIT_REPO,
|
||||
sha1 = "6c2b2f192c95d25a2e1576aee5d1169dd8bd2266",
|
||||
unsign = True,
|
||||
)
|
||||
|
||||
JGIT_ARCHIVE_SHA1 = "a728cf277396f1227c5a8dffcf5dee0188fc0821"
|
||||
def jgit_dep(name):
|
||||
mapping = {
|
||||
"@jgit_junit//jar": "@jgit//org.eclipse.jgit.junit:junit",
|
||||
"@jgit_lib//jar:src": "@jgit//org.eclipse.jgit:libjgit-src.jar",
|
||||
"@jgit_lib//jar": "@jgit//org.eclipse.jgit:jgit",
|
||||
"@jgit_servlet//jar":"@jgit//org.eclipse.jgit.http.server:jgit-servlet",
|
||||
"@jgit_archive//jar": "@jgit//org.eclipse.jgit.archive:jgit-archive",
|
||||
}
|
||||
|
||||
JGIT_JUNIT_SHA1 = "6c2b2f192c95d25a2e1576aee5d1169dd8bd2266"
|
||||
if LOCAL_JGIT_REPO:
|
||||
return mapping[name]
|
||||
else:
|
||||
return name
|
||||
|
@ -1,10 +1,9 @@
|
||||
load("//lib/jgit:jgit.bzl", "jgit_dep")
|
||||
|
||||
java_library(
|
||||
name = "jgit-archive",
|
||||
data = ["//lib:LICENSE-jgit"],
|
||||
visibility = ["//visibility:public"],
|
||||
exports = select({
|
||||
# "//lib/jgit:dev": ["@jgit//org.eclipse.jgit.archive:jgit-archive"],
|
||||
"//conditions:default": ["@jgit_archive//jar"],
|
||||
}),
|
||||
exports = [jgit_dep("@jgit_archive//jar")],
|
||||
runtime_deps = ["//lib/jgit/org.eclipse.jgit:jgit"],
|
||||
)
|
||||
|
@ -1,10 +1,9 @@
|
||||
load("//lib/jgit:jgit.bzl", "jgit_dep")
|
||||
|
||||
java_library(
|
||||
name = "jgit-servlet",
|
||||
data = ["//lib:LICENSE-jgit"],
|
||||
visibility = ["//visibility:public"],
|
||||
exports = select({
|
||||
# "//lib/jgit:dev": ["@jgit//org.eclipse.jgit.http.server:jgit-servlet"],
|
||||
"//conditions:default": ["@jgit_servlet//jar"],
|
||||
}),
|
||||
exports = [jgit_dep("@jgit_servlet//jar")],
|
||||
runtime_deps = ["//lib/jgit/org.eclipse.jgit:jgit"],
|
||||
)
|
||||
|
@ -1,11 +1,10 @@
|
||||
load("//lib/jgit:jgit.bzl", "jgit_dep")
|
||||
|
||||
java_library(
|
||||
name = "junit",
|
||||
testonly = 1,
|
||||
data = ["//lib:LICENSE-DO_NOT_DISTRIBUTE"],
|
||||
visibility = ["//visibility:public"],
|
||||
exports = select({
|
||||
# "//lib/jgit:dev": ["@jgit//org.eclipse.jgit.junit:junit"],
|
||||
"//conditions:default": ["@jgit_junit//jar"],
|
||||
}),
|
||||
exports = [jgit_dep("@jgit_junit//jar")],
|
||||
runtime_deps = ["//lib/jgit/org.eclipse.jgit:jgit"],
|
||||
)
|
||||
|
@ -1,20 +1,16 @@
|
||||
load("//lib/jgit:jgit.bzl", "jgit_dep")
|
||||
|
||||
java_library(
|
||||
name = "jgit",
|
||||
data = ["//lib:LICENSE-jgit"],
|
||||
visibility = ["//visibility:public"],
|
||||
exports = select({
|
||||
# "//lib/jgit:dev": ["@jgit//org.eclipse.jgit:jgit"],
|
||||
"//conditions:default": ["@jgit_lib//jar"],
|
||||
}),
|
||||
exports = [jgit_dep("@jgit_lib//jar")],
|
||||
runtime_deps = [":javaewah"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "jgit-source",
|
||||
actual = select({
|
||||
# "//lib/jgit:dev": "@jgit//org.eclipse.jgit:libjgit-src.jar",
|
||||
"//conditions:default": "@jgit_lib//jar:src",
|
||||
}),
|
||||
actual = jgit_dep("@jgit_lib//jar:src"),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user