bazelrc-preset.bzlAPI docs @1.4.0

@bazelrc-preset.bzl//:bazelrc-preset.bzl

Rule/Macro pair to produce a bazelrc preset file.

Typical usage:

load("@bazelrc-preset.bzl", "bazelrc_preset") bazelrc_preset( name = "preset", strict = False, # Change to True to opt-in to flags that are flipped in the upcoming major release )

Then run bazel run //tools:preset.update to create the preset file, and import that in your .bazelrc file.

See the project's README.md for more details.

Functions & Macros

bazelrc_preset

Creates a bazelrc preset file.

Parameters
*name

The name of the preset.

out_file

The file to write the preset to. If not provided, the preset will be written to {name}.bazelrc.

Default: None
kwargs

Additional named arguments to pass to the generate_preset rule.
Common attributes (those in https://bazel.build/reference/be/common-definitions#common-attributes)
are propagated to the generated write_source_file rule as well.

bazelrc_preset_test

Verify that the bazelrc preset file can be generated from the given inputs.

Parameters
*name
kwargs

Rules

generate_preset
AttributeTypeDescription
*namename

A unique name for this target.

doc_link_templatestring

A template for the link to the flag documentation.
Placeholders in the string will be replaced with the actual values:

  • {version}: The version of Bazel
  • {flag}: The flag name
Default: "https://registry.build/flag/bazel@{version}?filter={flag}"
extra_presetsstring

A json encoded string of presets to add to the preset generation matching the format of the FLAGS dictionary.

Default: ""
outlabel
Default: None
strictboolean

Whether to generate a strict preset, which includes all flags that are marked as "strict" in the registry.
Unlike the "strict" flag in bazelisk, this applies flags being flipped in the upcoming major release.

Default: False

@bazelrc-preset.bzl//:flags.bzl

Database of Bazel flags which apply across every Bazel use-case

@bazelrc-preset.bzl//private:parse.bzl

Functions & Macros

parse_version

Parses the given Bazel version string into a comparable value.

Parameters
*v

version string

@bazelrc-preset.bzl//private:util.bzl

Functions & Macros

le
Parameters
*v
lt
Parameters
*v
ne
Parameters
*v
ge
Parameters
*v
ge_same_major
Parameters
*v
gt
Parameters
*v