xref: /JGit/org.eclipse.jgit/BUILD (revision 5d925ecbb3d0977c586f0001baf20aff12823de9)
185cea8c5SDavid Pursehouseload("@rules_java//java:defs.bzl", "java_library")
285cea8c5SDavid Pursehouse
3dd5e500aSDavid Pursehousepackage(default_visibility = ["//visibility:public"])
4e92a0c3aSDavid Ostrovsky
5e92a0c3aSDavid OstrovskyINSECURE_CIPHER_FACTORY = [
6dd5e500aSDavid Pursehouse    "src/org/eclipse/jgit/transport/InsecureCipherFactory.java",
7e92a0c3aSDavid Ostrovsky]
8e92a0c3aSDavid Ostrovsky
9dd5e500aSDavid PursehouseSRCS = glob(
10c80d8c59SDavid Pursehouse    ["src/**/*.java"],
11dd5e500aSDavid Pursehouse    exclude = INSECURE_CIPHER_FACTORY,
12dd5e500aSDavid Pursehouse)
13dd5e500aSDavid Pursehouse
14dd5e500aSDavid PursehouseRESOURCES = glob(["resources/**"])
15e92a0c3aSDavid Ostrovsky
16e92a0c3aSDavid Ostrovskyjava_library(
17d35f0ffbSDavid Ostrovsky    name = "jgit_non_stamped",
18e92a0c3aSDavid Ostrovsky    srcs = SRCS,
19dd5e500aSDavid Pursehouse    resource_strip_prefix = "org.eclipse.jgit/resources",
20e92a0c3aSDavid Ostrovsky    resources = RESOURCES,
21e92a0c3aSDavid Ostrovsky    deps = [
22dd5e500aSDavid Pursehouse        ":insecure_cipher_factory",
23bc5014faSJonathan Nieder        "//lib:javaewah",
24bc5014faSJonathan Nieder        "//lib:slf4j-api",
25e92a0c3aSDavid Ostrovsky    ],
26e92a0c3aSDavid Ostrovsky)
27e92a0c3aSDavid Ostrovsky
28d35f0ffbSDavid Ostrovskygenrule(
29d35f0ffbSDavid Ostrovsky    name = "jgit",
30d35f0ffbSDavid Ostrovsky    srcs = [":jgit_non_stamped"],
31d35f0ffbSDavid Ostrovsky    outs = ["jgit.jar"],
32d35f0ffbSDavid Ostrovsky    cmd = " && ".join([
33d35f0ffbSDavid Ostrovsky        "ROOT=$$PWD",
34d35f0ffbSDavid Ostrovsky        "TMP=$$(mktemp -d || mktemp -d -t bazel-tmp)",
35d35f0ffbSDavid Ostrovsky        "TZ=UTC",
36d35f0ffbSDavid Ostrovsky        "export TZ",
37d35f0ffbSDavid Ostrovsky        "GEN_VERSION=$$(cat bazel-out/stable-status.txt | grep -w STABLE_BUILD_JGIT_LABEL | cut -d ' ' -f 2)",
38d35f0ffbSDavid Ostrovsky        "cd $$TMP",
39d35f0ffbSDavid Ostrovsky        "unzip -q $$ROOT/$<",
40d35f0ffbSDavid Ostrovsky        "echo \"Implementation-Version: $$GEN_VERSION\n$$(cat META-INF/MANIFEST.MF)\" > META-INF/MANIFEST.MF",
41*5d925ecbSDavid Ostrovsky        "find . -exec touch -t 198001010000 '{}' ';'",
42d35f0ffbSDavid Ostrovsky        "zip -Xqr $$ROOT/$@ .",
43d35f0ffbSDavid Ostrovsky        "rm -rf $$TMP",
44d35f0ffbSDavid Ostrovsky    ]),
45d35f0ffbSDavid Ostrovsky    stamp = 1,
46d35f0ffbSDavid Ostrovsky    visibility = ["//visibility:public"],
47d35f0ffbSDavid Ostrovsky)
48d35f0ffbSDavid Ostrovsky
49e92a0c3aSDavid Ostrovskyjava_library(
50dd5e500aSDavid Pursehouse    name = "insecure_cipher_factory",
51e92a0c3aSDavid Ostrovsky    srcs = INSECURE_CIPHER_FACTORY,
52b537e372SJonathan Nieder    javacopts = ["-Xep:InsecureCryptoUsage:OFF"],
53e92a0c3aSDavid Ostrovsky)
54