bazel_features
v1.21.0
published 8 months ago
24 stars
23 forks
7 watchers
Apache License 2.0
public
1 assets
30,003,664 downloads
15 KB
Compatibility level unknown
rz1Psc9PJZQstKkzsa2ToOqf6e5wwq9/Np+3KmfCZuU=
v1.21.0
November 25, 2024
[expand for release notes]

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.