Bug: 345301870

Clone this repo:
  1. 5716f9a Upgrade bazel_features to v1.22.0 by HONG Yifan · 6 weeks ago main
  2. abd658e Add `macro` and `subrule` to globals (#86) by Fabian Meumertzheim · 7 weeks ago upstream/v1.22.0
  3. 05d5fce Update Bazel to 7.4.1 and add `.gitignore` lines (#85) by Fabian Meumertzheim · 7 weeks ago
  4. a037675 Treat RCs as equivalent to releases (#83) by Fabian Meumertzheim · 8 weeks ago upstream/v1.21.0
  5. 7f2d4e3 Add `rule_extension_apis_available` (#80) by hvadehra · 3 months ago

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.