1 _bouncycastle_jar_rule = """ 2 java_import( 3 name = "bouncycastle_jar", 4 jars = ["bouncycastle.jar"], 5 visibility = ["//visibility:public"], 6 ) 7 """ 8 9 # TODO(ekasper): implement environment invalidation once supported by bazel, 10 # see https://bazel.build/designs/2016/10/18/repository-invalidation.html 11 # Meanwhile, users have to call 'bazel clean' explicitly when the 12 # environment changes. 13 def _local_jars_impl(repository_ctx): 14 contents = "" 15 if "WYCHEPROOF_BOUNCYCASTLE_JAR" in repository_ctx.os.environ: 16 repository_ctx.symlink(repository_ctx.os.environ["WYCHEPROOF_BOUNCYCASTLE_JAR"], 17 "bouncycastle.jar") 18 contents += _bouncycastle_jar_rule 19 20 repository_ctx.file("BUILD", contents) 21 22 local_jars = repository_rule( 23 implementation = _local_jars_impl, 24 local = True 25 ) 26