From ed0e733810da7f98ecaba7290d5589a12c9243a7 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim <4322804+ngiloq6@users.noreply.github.com> Date: Wed, 8 Nov 2023 15:57:57 +0100 Subject: [PATCH] Refetch version repositories when Bazel version changes (#26) Since every version change requires a server restart, it suffices to mark the version-dependent repos as `local`. Fixes #25 --- private/globals_repo.bzl | 2 ++ private/version_repo.bzl | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/private/globals_repo.bzl b/private/globals_repo.bzl index 0e7c90a..9487c80 100644 --- a/private/globals_repo.bzl +++ b/private/globals_repo.bzl @@ -19,6 +19,8 @@ def _globals_repo_impl(rctx): globals_repo = repository_rule( _globals_repo_impl, + # Force reruns on server restarts to keep native.bazel_version up-to-date. + local = True, attrs = { "globals": attr.string_dict( mandatory = True, diff --git a/private/version_repo.bzl b/private/version_repo.bzl index db18a5a..105aea8 100644 --- a/private/version_repo.bzl +++ b/private/version_repo.bzl @@ -2,4 +2,8 @@ def _version_repo_impl(rctx): rctx.file("BUILD.bazel", "exports_files([\"version.bzl\"])") rctx.file("version.bzl", "version = '" + native.bazel_version + "'") -version_repo = repository_rule(_version_repo_impl) +version_repo = repository_rule( + _version_repo_impl, + # Force reruns on server restarts to keep native.bazel_version up-to-date. + local = True, +)