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( 17*d35f0ffbSDavid 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 28*d35f0ffbSDavid Ostrovskygenrule( 29*d35f0ffbSDavid Ostrovsky name = "jgit", 30*d35f0ffbSDavid Ostrovsky srcs = [":jgit_non_stamped"], 31*d35f0ffbSDavid Ostrovsky outs = ["jgit.jar"], 32*d35f0ffbSDavid Ostrovsky cmd = " && ".join([ 33*d35f0ffbSDavid Ostrovsky "ROOT=$$PWD", 34*d35f0ffbSDavid Ostrovsky "TMP=$$(mktemp -d || mktemp -d -t bazel-tmp)", 35*d35f0ffbSDavid Ostrovsky "TZ=UTC", 36*d35f0ffbSDavid Ostrovsky "export TZ", 37*d35f0ffbSDavid Ostrovsky "GEN_VERSION=$$(cat bazel-out/stable-status.txt | grep -w STABLE_BUILD_JGIT_LABEL | cut -d ' ' -f 2)", 38*d35f0ffbSDavid Ostrovsky "cd $$TMP", 39*d35f0ffbSDavid Ostrovsky "unzip -q $$ROOT/$<", 40*d35f0ffbSDavid Ostrovsky "echo \"Implementation-Version: $$GEN_VERSION\n$$(cat META-INF/MANIFEST.MF)\" > META-INF/MANIFEST.MF", 41*d35f0ffbSDavid Ostrovsky "find . -exec touch '{}' ';'", 42*d35f0ffbSDavid Ostrovsky "zip -Xqr $$ROOT/$@ .", 43*d35f0ffbSDavid Ostrovsky "rm -rf $$TMP", 44*d35f0ffbSDavid Ostrovsky ]), 45*d35f0ffbSDavid Ostrovsky stamp = 1, 46*d35f0ffbSDavid Ostrovsky visibility = ["//visibility:public"], 47*d35f0ffbSDavid Ostrovsky) 48*d35f0ffbSDavid 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