1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
load("@rules_java//java:defs.bzl", "java_library")
package(default_visibility = ["//visibility:public"])
INSECURE_CIPHER_FACTORY = [
"src/org/eclipse/jgit/transport/InsecureCipherFactory.java",
]
SRCS = glob(
["src/**/*.java"],
exclude = INSECURE_CIPHER_FACTORY,
)
RESOURCES = glob(["resources/**"])
java_library(
name = "jgit_non_stamped",
srcs = SRCS,
resource_strip_prefix = "org.eclipse.jgit/resources",
resources = RESOURCES,
deps = [
":insecure_cipher_factory",
"//lib:commons-codec",
"//lib:javaewah",
"//lib:slf4j-api",
],
javacopts = [
"-Xep:ReferenceEquality:OFF",
"-Xep:StringEquality:OFF",
"-Xep:TypeParameterUnusedInFormals:OFF",
"-Xep:DefaultCharset:OFF",
]
)
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 -t 198001010000 '{}' ';'",
"zip -Xqr $$ROOT/$@ .",
"rm -rf $$TMP",
]),
stamp = 1,
visibility = ["//visibility:public"],
)
java_library(
name = "insecure_cipher_factory",
srcs = INSECURE_CIPHER_FACTORY,
javacopts = ["-Xep:InsecureCryptoUsage:OFF"],
)
|