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