aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/BUILD
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2020-06-21 16:56:57 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2020-07-17 01:10:15 +0200
commitd35f0ffb7c33a11f8192ec64da5a736827ab472d (patch)
tree0730ca36c8d6e5bc0d6d5ad6d8633a6c9ae91e9f /org.eclipse.jgit/BUILD
parent533272372945e0e5ddbab1502f185c5afd582f19 (diff)
downloadjgit-d35f0ffb7c33a11f8192ec64da5a736827ab472d.tar.gz
jgit-d35f0ffb7c33a11f8192ec64da5a736827ab472d.zip
Bazel: Add workspace status command to stamp final artifact
Include implementation version in jgit library. This version is used by other products that depend on JGit, and built using Bazel and not consume officially released artifact from Central or Eclipse own Maven repository. Most notably, in Gerrit Code Review JGit agent that was previously reported as "unknown", is now reported as: JGit/v5.8.0.202006091008-r-16-g14c43828d using this change [1]. [1] https://gerrit-review.googlesource.com/c/gerrit/+/272505 Change-Id: Ia50de9ac35b8dbe9e92d8ad7d0d14cd00f057863 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
Diffstat (limited to 'org.eclipse.jgit/BUILD')
-rw-r--r--org.eclipse.jgit/BUILD23
1 files changed, 22 insertions, 1 deletions
diff --git a/org.eclipse.jgit/BUILD b/org.eclipse.jgit/BUILD
index f7970976b0..2083372248 100644
--- a/org.eclipse.jgit/BUILD
+++ b/org.eclipse.jgit/BUILD
@@ -14,7 +14,7 @@ SRCS = glob(
RESOURCES = glob(["resources/**"])
java_library(
- name = "jgit",
+ name = "jgit_non_stamped",
srcs = SRCS,
resource_strip_prefix = "org.eclipse.jgit/resources",
resources = RESOURCES,
@@ -25,6 +25,27 @@ java_library(
],
)
+genrule(
+ name = "jgit",
+ srcs = [":jgit_non_stamped"],
+ outs = ["jgit.jar"],
+ cmd = " && ".join([
+ "ROOT=$$PWD",
+ "TMP=$$(mktemp -d || mktemp -d -t bazel-tmp)",
+ "TZ=UTC",
+ "export TZ",
+ "GEN_VERSION=$$(cat bazel-out/stable-status.txt | grep -w STABLE_BUILD_JGIT_LABEL | cut -d ' ' -f 2)",
+ "cd $$TMP",
+ "unzip -q $$ROOT/$<",
+ "echo \"Implementation-Version: $$GEN_VERSION\n$$(cat META-INF/MANIFEST.MF)\" > META-INF/MANIFEST.MF",
+ "find . -exec touch '{}' ';'",
+ "zip -Xqr $$ROOT/$@ .",
+ "rm -rf $$TMP",
+ ]),
+ stamp = 1,
+ visibility = ["//visibility:public"],
+)
+
java_library(
name = "insecure_cipher_factory",
srcs = INSECURE_CIPHER_FACTORY,