From b898a62f3f61fa30bf1ffd1e04016387ccd59141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilia=20K=C3=A4sper?= Date: Thu, 12 Jan 2017 02:57:11 +0100 Subject: Option to test a local BouncyCastle jar (#16) Resolves Github issue #4 --- local_repository_defs.bzl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 local_repository_defs.bzl (limited to 'local_repository_defs.bzl') diff --git a/local_repository_defs.bzl b/local_repository_defs.bzl new file mode 100644 index 0000000..3c9b348 --- /dev/null +++ b/local_repository_defs.bzl @@ -0,0 +1,25 @@ +_bouncycastle_jar_rule = """ +java_import( + name = "bouncycastle_jar", + jars = ["bouncycastle.jar"], + visibility = ["//visibility:public"], + ) +""" + +# TODO(ekasper): implement environment invalidation once supported by bazel, +# see https://bazel.build/designs/2016/10/18/repository-invalidation.html +# Meanwhile, users have to call 'bazel clean' explicitly when the +# environment changes. +def _local_jars_impl(repository_ctx): + contents = "" + if "WYCHEPROOF_BOUNCYCASTLE_JAR" in repository_ctx.os.environ: + repository_ctx.symlink(repository_ctx.os.environ["WYCHEPROOF_BOUNCYCASTLE_JAR"], + "bouncycastle.jar") + contents += _bouncycastle_jar_rule + + repository_ctx.file("BUILD", contents) + +local_jars = repository_rule( + implementation = _local_jars_impl, + local = True +) -- cgit v1.2.3