./pants tailor [args]

Auto-generate BUILD file targets for new source files.

Config section: [tailor]

Basic options

check

--[no-]tailor-check
PANTS_TAILOR_CHECK
default: False

Do not write changes to disk, only write back what would change. Return code 0 means there would be no changes, and 1 means that there would be.


Advanced options

build_file_name

--tailor-build-file-name=<str>
PANTS_TAILOR_BUILD_FILE_NAME
default: BUILD

The name to use for generated BUILD files.

This must be compatible with [GLOBAL].build_patterns.


build_file_header

--tailor-build-file-header=<str>
PANTS_TAILOR_BUILD_FILE_HEADER
default: None

A header, e.g., a copyright notice, to add to the content of created BUILD files.


build_file_indent

--tailor-build-file-indent=<str>
PANTS_TAILOR_BUILD_FILE_INDENT
default:

The indent to use when auto-editing BUILD files.


alias_mapping

--tailor-alias-mapping="{'key1': val1, 'key2': val2, ...}"
PANTS_TAILOR_ALIAS_MAPPING
default: {}

A mapping from standard target type to custom type to use instead. The custom type can be a custom target type or a macro that offers compatible functionality to the one it replaces (see Macros). This means that the replacement target must provide at least the set of fields that the target being replaced had. Otherwise, the target will be regenerated when the tailor operation is run again.


ignore_paths

--tailor-ignore-paths="['<str>', '<str>', ...]"
PANTS_TAILOR_IGNORE_PATHS
default: []

Do not edit or create BUILD files at these paths.

Can use literal file names and/or globs, e.g. ['project/BUILD, 'ignore_me/**'].

This augments the option [GLOBAL].build_ignore, which tells Pants to also not read BUILD files at certain paths. In contrast, this option only tells Pants to not edit/create BUILD files at the specified paths.


ignore_adding_targets

--tailor-ignore-adding-targets="['<str>', '<str>', ...]"
PANTS_TAILOR_IGNORE_ADDING_TARGETS
default: []

Do not add these target definitions.

Expects a list of target addresses that would normally be added by tailor, e.g. ['project:tgt']. To find these names, you can run tailor --check, then combine the BUILD file path with the target's name. For example, if tailor would add the target bin to project/BUILD, then the address would be project:bin. If the BUILD file is at the root of your repository, use // for the path, e.g. //:bin.

Does not work with macros.


Deprecated options

None


Did this page help you?