@bazel_env.bzl@bazel_env.bzl
Functions & Macros
bazel_envMakes Bazel-managed tools and toolchains available under stable paths.
Build this target to make the given tools and toolchains available under stable,
platform-independent paths:
- tools are staged in
bazel-out/bazel_env-opt/bin/path/to/pkg/name/bin - toolchains are staged in
bazel-out/bazel_env-opt/bin/path/to/pkg/name/toolchains
Run this target with bazel run for instructions on how to make the tools available on PATH
using direnv. This also prints a list of all tools and toolchains as
well as cleans up stale tools.
Parameters
*name | The name of the rule. |
tools | A dictionary mapping tool names to their targets or paths. The name is used as the If a target is provided, the corresponding executable is staged in the If a path is provided, Make variables provided by Default: {} |
toolchains | A dictionary mapping toolchain names to their targets. The name is used as the With Bazel 9.0.0-pre.20250311.1 and later, toolchain_type targets can be used directly. Default: {} |
watch_dirs | A dictionary mapping tool names to directories that will be monitored by Use the tool name "_common" for directories which are common to all tools. This attribute is fully optional. It allows you to provide a heuristic When changes are detected, a message will be displayed listing the changed Default: {} |
watch_files | A dictionary mapping tool names to specific files that will be monitored Use the tool name "_common" for files which are common to all tools. Like When changes are detected, a message will be displayed listing the changed Prefer to use this over the Default: {} |
kwargs | Additional arguments to pass to the main |