2024-08-08 19:56:11 +00:00
|
|
|
"""'Presets' for bazelrc
|
|
|
|
|
|
|
|
See https://docs.aspect.build/guides/bazelrc
|
|
|
|
"""
|
2023-02-17 22:34:06 +00:00
|
|
|
|
|
|
|
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
|
|
|
|
|
|
|
|
ALL_PRESETS = [
|
|
|
|
"bazel6",
|
2024-01-04 16:16:59 +00:00
|
|
|
"bazel7",
|
2023-02-17 22:34:06 +00:00
|
|
|
"ci",
|
|
|
|
"convenience",
|
|
|
|
"correctness",
|
|
|
|
"debug",
|
2024-10-04 15:34:34 +00:00
|
|
|
"java",
|
2023-02-17 22:34:06 +00:00
|
|
|
"javascript",
|
|
|
|
"performance",
|
|
|
|
]
|
|
|
|
|
|
|
|
def write_aspect_bazelrc_presets(
|
|
|
|
name,
|
2023-02-22 20:17:00 +00:00
|
|
|
presets = ALL_PRESETS,
|
|
|
|
**kwargs):
|
2023-02-17 22:34:06 +00:00
|
|
|
"""Keeps your vendored copy of Aspect recommended `.bazelrc` presets up-to-date.
|
|
|
|
|
|
|
|
This macro uses a [write_source_files](https://docs.aspect.build/rules/aspect_bazel_lib/docs/write_source_files)
|
|
|
|
rule under the hood to keep your presets up-to-date.
|
|
|
|
|
|
|
|
By default all presets are vendored but this list can be customized using
|
2024-08-08 19:56:11 +00:00
|
|
|
the `presets` attribute.
|
2023-02-17 22:34:06 +00:00
|
|
|
|
|
|
|
Args:
|
|
|
|
name: a unique name for this target
|
|
|
|
presets: a list of preset names to keep up-to-date
|
2023-02-22 20:17:00 +00:00
|
|
|
**kwargs: Additional arguments to pass to `write_source_files`
|
2023-02-17 22:34:06 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
files = {}
|
|
|
|
for p in presets:
|
|
|
|
files["{}.bazelrc".format(p)] = "@aspect_bazel_lib//.aspect/bazelrc:{}.bazelrc".format(p)
|
|
|
|
|
|
|
|
write_source_files(
|
|
|
|
name = name,
|
|
|
|
files = files,
|
2023-02-22 20:17:00 +00:00
|
|
|
**kwargs
|
2023-02-17 22:34:06 +00:00
|
|
|
)
|