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:
committed by
David Ostrovsky
parent
b1040c8526
commit
ccb26667ba
@@ -354,14 +354,9 @@ And corresponding WORKSPACE excerpt:
|
|||||||
|
|
||||||
[[consume-jgit-from-development-tree]]
|
[[consume-jgit-from-development-tree]]
|
||||||
|
|
||||||
To consume the JGit dependency from the development tree, uncomment
|
To consume the JGit dependency from the development tree, edit
|
||||||
`local_repository` rule for `jgit` in WORKSPACE file and uncomment
|
`lib/jgit/jgit.bzl` setting LOCAL_JGIT_REPO to a directory holding a
|
||||||
the lines in the `lib/jgit/**/BUILD` files for `jgit` rule aliases.
|
JGit repository.
|
||||||
`jgit-dev=1` must be passed in to bazel:
|
|
||||||
|
|
||||||
----
|
|
||||||
$ bazel test --define jgit-dev=1 ...
|
|
||||||
----
|
|
||||||
|
|
||||||
[[clean-cache]]
|
[[clean-cache]]
|
||||||
=== Cleaning The download cache
|
=== Cleaning The download cache
|
||||||
|
|||||||
44
WORKSPACE
44
WORKSPACE
@@ -130,34 +130,9 @@ maven_jar(
|
|||||||
sha1 = "cdb2dcb4e22b83d6b32b93095f644c3462739e82",
|
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")
|
||||||
|
|
||||||
#
|
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,
|
|
||||||
)
|
|
||||||
|
|
||||||
maven_jar(
|
maven_jar(
|
||||||
name = "javaewah",
|
name = "javaewah",
|
||||||
@@ -166,21 +141,6 @@ maven_jar(
|
|||||||
sha1 = "94ad16d728b374d65bd897625f3fbb3da223a2b6",
|
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(
|
maven_jar(
|
||||||
name = "gwtjsonrpc",
|
name = "gwtjsonrpc",
|
||||||
artifact = "com.google.gerrit:gwtjsonrpc:1.11",
|
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(
|
java_library(
|
||||||
name = "jgit-archive",
|
name = "jgit-archive",
|
||||||
data = ["//lib:LICENSE-jgit"],
|
data = ["//lib:LICENSE-jgit"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
exports = select({
|
exports = [jgit_dep("@jgit_archive//jar")],
|
||||||
# "//lib/jgit:dev": ["@jgit//org.eclipse.jgit.archive:jgit-archive"],
|
|
||||||
"//conditions:default": ["@jgit_archive//jar"],
|
|
||||||
}),
|
|
||||||
runtime_deps = ["//lib/jgit/org.eclipse.jgit:jgit"],
|
runtime_deps = ["//lib/jgit/org.eclipse.jgit:jgit"],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
|
load("//lib/jgit:jgit.bzl", "jgit_dep")
|
||||||
|
|
||||||
java_library(
|
java_library(
|
||||||
name = "jgit-servlet",
|
name = "jgit-servlet",
|
||||||
data = ["//lib:LICENSE-jgit"],
|
data = ["//lib:LICENSE-jgit"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
exports = select({
|
exports = [jgit_dep("@jgit_servlet//jar")],
|
||||||
# "//lib/jgit:dev": ["@jgit//org.eclipse.jgit.http.server:jgit-servlet"],
|
|
||||||
"//conditions:default": ["@jgit_servlet//jar"],
|
|
||||||
}),
|
|
||||||
runtime_deps = ["//lib/jgit/org.eclipse.jgit:jgit"],
|
runtime_deps = ["//lib/jgit/org.eclipse.jgit:jgit"],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
|
load("//lib/jgit:jgit.bzl", "jgit_dep")
|
||||||
|
|
||||||
java_library(
|
java_library(
|
||||||
name = "junit",
|
name = "junit",
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
data = ["//lib:LICENSE-DO_NOT_DISTRIBUTE"],
|
data = ["//lib:LICENSE-DO_NOT_DISTRIBUTE"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
exports = select({
|
exports = [jgit_dep("@jgit_junit//jar")],
|
||||||
# "//lib/jgit:dev": ["@jgit//org.eclipse.jgit.junit:junit"],
|
|
||||||
"//conditions:default": ["@jgit_junit//jar"],
|
|
||||||
}),
|
|
||||||
runtime_deps = ["//lib/jgit/org.eclipse.jgit:jgit"],
|
runtime_deps = ["//lib/jgit/org.eclipse.jgit:jgit"],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
|
load("//lib/jgit:jgit.bzl", "jgit_dep")
|
||||||
|
|
||||||
java_library(
|
java_library(
|
||||||
name = "jgit",
|
name = "jgit",
|
||||||
data = ["//lib:LICENSE-jgit"],
|
data = ["//lib:LICENSE-jgit"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
exports = select({
|
exports = [jgit_dep("@jgit_lib//jar")],
|
||||||
# "//lib/jgit:dev": ["@jgit//org.eclipse.jgit:jgit"],
|
|
||||||
"//conditions:default": ["@jgit_lib//jar"],
|
|
||||||
}),
|
|
||||||
runtime_deps = [":javaewah"],
|
runtime_deps = [":javaewah"],
|
||||||
)
|
)
|
||||||
|
|
||||||
alias(
|
alias(
|
||||||
name = "jgit-source",
|
name = "jgit-source",
|
||||||
actual = select({
|
actual = jgit_dep("@jgit_lib//jar:src"),
|
||||||
# "//lib/jgit:dev": "@jgit//org.eclipse.jgit:libjgit-src.jar",
|
|
||||||
"//conditions:default": "@jgit_lib//jar:src",
|
|
||||||
}),
|
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user