Bazel: Reuse version from .bazelversion for minimum used version check

Bazel is still supported in addition to the Bazel wrapper Bazelisk,
that is recommended, as it would automatically switch to the right
Bazel version on stable branches (like it was the case with Buck).

That why minimum used Bazel version check is still needed in WORKSPACE
file in addition to the .bazelversion used by Bazelisk. That means that
currently, bazel version is maintained in two places:

* .bazelversion
* WORKSPACE

This change introduces the repository rule to read the bazel version
from the .bazelversion file and perform the minimum version check.

When all Gerrit users and developers switched to using Bazelisk, we
might consider to remove the check altogether.

Inspired-By: Yannic Bonenberger <yannic@yannic-bonenberger.com>
Change-Id: I2fb8b2e5524be501571a0d2418f4676c8fb484ae
This commit is contained in:
David Ostrovsky
2019-09-04 08:40:36 +02:00
committed by David Pursehouse
parent 09c905ef16
commit 4ef157dde6
2 changed files with 23 additions and 2 deletions

View File

@@ -63,9 +63,14 @@ http_file(
urls = ["https://raw.githubusercontent.com/google/closure-compiler/775609aad61e14aef289ebec4bfc09ad88877f9e/contrib/externs/polymer-1.0.js"],
)
load("@bazel_skylib//lib:versions.bzl", "versions")
# Check Bazel version when invoked by Bazel directly
load("//tools/bzl:bazelisk_version.bzl", "bazelisk_version")
versions.check(minimum_bazel_version = "0.29.0")
bazelisk_version(name = "bazelisk_version")
load("@bazelisk_version//:check.bzl", "check_bazel_version")
check_bazel_version()
# Rules Python
http_archive(