params_file public API

Macros and Functions


Generates a UTF-8 encoded params file from a list of arguments.

Handles variable substitutions for args.

Example usage (generated)

load("@aspect_bazel_lib//lib:params_file.bzl", "params_file")

    # Name of the rule.
    name = "",
    # Path of the output file, relative to this package.
    out = "",


Name of the rule.


Path of the output file, relative to this package.


Arguments to concatenate into a params file.

Subject to 'Make variable' substitution. See

  1. Subject to predefined source/output path variables substitutions.

    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 for more info.

    NB: This $(location) substition returns the manifest file path which differs from the *_binary & *_test 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 for more info.

  2. Subject to predefined variables & custom variable substitutions.

    Predefined "Make" variables such as $(COMPILATION_MODE) and $(TARGET_CPU) are expanded. See

    Custom variables are also expanded including variables set through the Bazel CLI with --define=SOME_VAR=SOME_VALUE. See

    Predefined genrule variables are not supported in this context.


Data for $(location) expansions in args.


Line endings to use. One of ["auto", "unix", "windows"].

  • `"auto"` for platform-determined
  • `"unix"` for LF
  • `"windows"` for CRLF


undocumented named arguments