| David Pursehouse | a7b74f2 | 2019-09-27 09:52:59 +0900 | [diff] [blame^] | 1 | _template = """ |
| 2 | load("@bazel_skylib//lib:versions.bzl", "versions") |
| 3 | |
| 4 | def check_bazel_version(): |
| 5 | versions.check(minimum_bazel_version = "{version}") |
| 6 | """.strip() |
| 7 | |
| 8 | def _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 | |
| 16 | bazelisk_version = repository_rule(implementation = _impl) |