Clone this repo:
  1. 7ef7f31 Add `set` to globals (#120) by Alexey Tereshenkov · 11 days ago upstream/main v1.39.0
  2. d60b754 Add 'merkle_cache_v2' feature (#118) by David Zbarsky · 3 months ago v1.38.0
  3. 71e2d05 Fix handling of globals that were newly introduced and then removed (#115) by hvadehra · 3 months ago v1.37.0
  4. 05e3cc8 Add detection for repo_metadata_has_reproducible (#113) by David Zbarsky · 4 months ago v1.36.0
  5. e71aba7 Add has_default_test_toolchain_type (#112) by Keith Smiley · 5 months ago v1.35.0

Bazel Features

Use this to determine the availability of a Bazel feature in your ruleset. It works under the hood by comparing the Bazel version against a known range in which the feature is available. Example usage:

load("@bazel_features//:features.bzl", "bazel_features")
if bazel_features.toolchains.has_optional_toolchains:
    # Do something

The features.bzl file contains the list of features.

Accessing globals

References to global Starlark symbols that do not exist cause load time errors, which means that their availability in Bazel cannot be tested via a regular feature. Instead, use bazel_features.globals.<symbol>, which is <symbol> if the symbol is available and None else.

See globals.bzl for the list of symbols that can be checked for in this way.