Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.aspect.build/llms.txt

Use this file to discover all available pages before exploring further.

Documentation for @bazel_lib@v3.2.0 View source
Public API for expand template

Rule: expand_template_rule

Template expansion This performs a simple search over the template file for the keys in substitutions, and replaces them with the corresponding values. Values may also use location templates as documented in expand_locations as well as configuration variables such as $(BINDIR), $(TARGET_CPU), and $(COMPILATION_MODE) as documented in expand_variables.

Attributes

name
name
required
A unique name for this target.
data
list of labels
default:"[]"
List of targets for additional lookup information.
is_executable
boolean
default:"False"
Whether to mark the output file as executable.
out
label
default:"None"
Where to write the expanded file.If the template is a source file, then out defaults to be named the same as the template file and outputted to the same workspace-relative path. In this case there will be no pre-declared label for the output file. It can be referenced by the target label instead. This pattern is similar to copy_to_bin but with substitutions on the copy.Otherwise, out defaults to [name].txt.
stamp_substitutions
dictionary: String → String
default:"{}"
Mapping of strings to substitutions.There are overlaid on top of substitutions when stamping is enabled for the target.Substitutions can contain (execpath:target)and(execpath :target) and (rootpath :target) expansions, $(MAKEVAR) expansions and expansions when stamping is enabled for the target.
substitutions
dictionary: String → String
default:"{}"
Mapping of strings to substitutions.Substitutions can contain (execpath:target)and(execpath :target) and (rootpath :target) expansions, $(MAKEVAR) expansions and expansions when stamping is enabled for the target.
template
label
required
The template file to expand.
stamp
integer
default:"-1"
Whether to encode build information into the output. Possible values:
  • stamp = 1: Always stamp the build information into the output, even in —nostamp builds. This setting should be avoided, since it is non-deterministic. It potentially causes remote cache misses for the target and any downstream actions that depend on the result.
  • stamp = 0: Never stamp, instead replace build information by constant values. This gives good build result caching.
  • stamp = -1: Embedding of build information is controlled by the —[no]stamp flag. Stamped targets are not rebuilt unless their dependencies change.

Function: expand_template

Wrapper macro for expand_template_rule.

Parameters

name
name
required
name of resulting rule
template
name
required
the label of a template file, or a list of strings which are lines representing the content of the template.
kwargs
string_list
other named parameters to expand_template_rule.