Backport all build-related commits from master to stable-0.2 This is a squash of the following commits that are required to make gitiles buildable with the latest bazel: 9374f0a - Remove bazel-genfiles from .gitignore bd0c596 - Use bazelisk as first choice for mvn.sh 9d5cb21 - Replace references to bazel-genfiles with bazel-bin 268d677 - Bazel: Bump bazel version to 1.0.0 03cd750 - Bazel: rules_python must be loaded now 10641da - Upgrade bazlets to latest master revision 06d3ee0 - Bazel: Introduce .bazelversion and update to 0.29.1 3de4f96 - Format all build files with buildifier a267c30 - Bazel: Add fixes for --incompatible_load_java_rules_from_bzl 4d4432d - Upgrade bazlets to latest master revision 422d67a - Align Eclipse settings with Eclipse 2019.06 008bf1b - Update bazlets to latest revision on master Change-Id: I4894d7beee21a0ea4bfd92c6ce3c6bf6477ef639
diff --git a/tools/bazelisk_version.bzl b/tools/bazelisk_version.bzl new file mode 100644 index 0000000..d8b3d10 --- /dev/null +++ b/tools/bazelisk_version.bzl
@@ -0,0 +1,16 @@ +_template = """ +load("@bazel_skylib//lib:versions.bzl", "versions") + +def check_bazel_version(): + versions.check(minimum_bazel_version = "{version}") +""".strip() + +def _impl(repository_ctx): + repository_ctx.symlink(Label("@//:.bazelversion"), ".bazelversion") + bazelversion = repository_ctx.read(".bazelversion").strip() + + repository_ctx.file("BUILD", executable = False) + + repository_ctx.file("check.bzl", executable = False, content = _template.format(version = bazelversion)) + +bazelisk_version = repository_rule(implementation = _impl)