Skip to main content
Version: 2.15 (deprecated)

tailor


pants tailor [args]

Auto-generate BUILD file targets for new source files.

Each specific tailor implementation may be disabled through language-specific options, e.g. [python].tailor_pex_binary_targets and [shell-setup].tailor.

Backend: pants.core

Config section: [tailor]

Basic options

check

--[no-]tailor-check
PANTS_TAILOR_CHECK
pants.toml
[tailor]
check = <bool>
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

alias_mapping

--tailor-alias-mapping="{'key1': val1, 'key2': val2, ...}"
PANTS_TAILOR_ALIAS_MAPPING
pants.toml
[tailor.alias_mapping]
key1 = val1
key2 = val2
...
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 https://www.pantsbuild.org/v2.15/docs/macros).

build_file_header

--tailor-build-file-header=<str>
PANTS_TAILOR_BUILD_FILE_HEADER
pants.toml
[tailor]
build_file_header = <str>
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
pants.toml
[tailor]
build_file_indent = <str>
default:

The indent to use when auto-editing BUILD files.

build_file_name

--tailor-build-file-name=<str>
PANTS_TAILOR_BUILD_FILE_NAME
pants.toml
[tailor]
build_file_name = <str>
default: BUILD

The name to use for generated BUILD files.

This must be compatible with [GLOBAL].build_patterns.

ignore_adding_targets

--tailor-ignore-adding-targets="['<str>', '<str>', ...]"
PANTS_TAILOR_IGNORE_ADDING_TARGETS
pants.toml
[tailor]
ignore_adding_targets = [
'<str>',
'<str>',
...,
]
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.

ignore_paths

--tailor-ignore-paths="['<str>', '<str>', ...]"
PANTS_TAILOR_IGNORE_PATHS
pants.toml
[tailor]
ignore_paths = [
'<str>',
'<str>',
...,
]
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.

Deprecated options

None