xref: /JGit/tools/bazelisk_version.bzl (revision 5caa951515068409f913d62ff6712c8d0f3b72c4)
1_template = """
2load("@bazel_skylib//lib:versions.bzl", "versions")
3
4def check_bazel_version():
5  versions.check(minimum_bazel_version = "{version}")
6""".strip()
7
8def _impl(repository_ctx):
9    repository_ctx.symlink(Label("@//:.bazelversion"), ".bazelversion")
10    bazelversion = repository_ctx.read(".bazelversion").strip()
11
12    repository_ctx.file("BUILD", executable = False)
13
14    repository_ctx.file("check.bzl", executable = False, content = _template.format(version = bazelversion))
15
16bazelisk_version = repository_rule(implementation = _impl)
17