2021-11-08 14:40:36 +00:00
|
|
|
"params_file public API"
|
|
|
|
|
|
|
|
load("//lib/private:params_file.bzl", _params_file = "params_file")
|
|
|
|
|
|
|
|
def params_file(
|
|
|
|
name,
|
|
|
|
out,
|
|
|
|
args = [],
|
|
|
|
data = [],
|
|
|
|
newline = "auto",
|
|
|
|
**kwargs):
|
|
|
|
"""Generates a UTF-8 encoded params file from a list of arguments.
|
|
|
|
|
|
|
|
Handles variable substitutions for args.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
name: Name of the rule.
|
|
|
|
out: Path of the output file, relative to this package.
|
|
|
|
args: Arguments to concatenate into a params file.
|
|
|
|
|
|
|
|
Subject to 'Make variable' substitution. See https://docs.bazel.build/versions/main/be/make-variables.html.
|
|
|
|
|
2021-11-10 14:34:00 +00:00
|
|
|
<ol>
|
|
|
|
<li> Subject to predefined source/output path variables substitutions.
|
2021-11-08 14:40:36 +00:00
|
|
|
|
|
|
|
The predefined variables `execpath`, `execpaths`, `rootpath`, `rootpaths`, `location`, and `locations` take
|
|
|
|
label parameters (e.g. `$(execpath //foo:bar)`) and substitute the file paths denoted by that label.
|
|
|
|
|
|
|
|
See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_label_variables for more info.
|
|
|
|
|
2021-11-10 14:34:00 +00:00
|
|
|
NB: This $(location) substition returns the manifest file path which differs from the `*_binary` & `*_test`
|
2021-11-08 14:40:36 +00:00
|
|
|
args and genrule bazel substitions. This will be fixed in a future major release.
|
|
|
|
See docs string of `expand_location_into_runfiles` macro in `internal/common/expand_into_runfiles.bzl`
|
2021-11-10 14:34:00 +00:00
|
|
|
for more info.</li>
|
2021-11-08 14:40:36 +00:00
|
|
|
|
2021-11-10 14:34:00 +00:00
|
|
|
<li>Subject to predefined variables & custom variable substitutions.
|
2021-11-08 14:40:36 +00:00
|
|
|
|
2021-11-10 14:34:00 +00:00
|
|
|
Predefined "Make" variables such as `$(COMPILATION_MODE)` and `$(TARGET_CPU)` are expanded.
|
2021-11-08 14:40:36 +00:00
|
|
|
See https://docs.bazel.build/versions/main/be/make-variables.html#predefined_variables.
|
|
|
|
|
2021-11-10 14:34:00 +00:00
|
|
|
Custom variables are also expanded including variables set through the Bazel CLI with `--define=SOME_VAR=SOME_VALUE`.
|
2021-11-08 14:40:36 +00:00
|
|
|
See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables.
|
|
|
|
|
2021-11-10 14:34:00 +00:00
|
|
|
Predefined genrule variables are not supported in this context.</li>
|
|
|
|
</ol>
|
2021-11-08 14:40:36 +00:00
|
|
|
|
2021-11-10 14:34:00 +00:00
|
|
|
data: Data for `$(location)` expansions in args.
|
|
|
|
newline: Line endings to use. One of [`"auto"`, `"unix"`, `"windows"`].
|
2021-11-08 14:40:36 +00:00
|
|
|
|
2021-11-10 14:34:00 +00:00
|
|
|
<ul>
|
|
|
|
<li>`"auto"` for platform-determined</li>
|
|
|
|
<li>`"unix"` for LF</li>
|
|
|
|
<li>`"windows"` for CRLF</li>
|
|
|
|
</ul>
|
2021-11-08 14:40:36 +00:00
|
|
|
**kwargs: undocumented named arguments
|
|
|
|
"""
|
|
|
|
_params_file(
|
|
|
|
name = name,
|
|
|
|
out = out,
|
|
|
|
args = args,
|
|
|
|
data = data,
|
|
|
|
newline = newline or "auto",
|
|
|
|
**kwargs
|
|
|
|
)
|