xref: /aosp_15_r20/external/wycheproof/local_repository_defs.bzl (revision 3d322d526be0ef039eebde10aa6ae75db8cc3a3d)
1_bouncycastle_jar_rule = """
2java_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.
13def _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
22local_jars = repository_rule(
23    implementation = _local_jars_impl,
24    local = True
25)
26