repository_defs.bzl 507 B

123456789101112131415
  1. # A hacky way to work around the fact that native.bazel_version is only
  2. # available from WORKSPACE macros, not BUILD macros or rules.
  3. #
  4. # Hopefully we can remove this if/when this is fixed:
  5. # https://github.com/bazelbuild/bazel/issues/8305
  6. def _impl(repository_ctx):
  7. s = "bazel_version = \"" + native.bazel_version + "\""
  8. repository_ctx.file("bazel_version.bzl", s)
  9. repository_ctx.file("BUILD", "")
  10. bazel_version_repository = repository_rule(
  11. implementation = _impl,
  12. local = True,
  13. )