Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs re: target tag usage #7360

Merged
merged 5 commits into from Mar 13, 2019
Merged
Changes from 3 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -48,6 +48,7 @@ A target definition in a `BUILD` file looks something like
':base'
],
sources=globs('*.java', exclude=[['Base.java']]),
tags={'common'},
)
### type
@@ -104,6 +105,28 @@ You can also recursively glob over files in all subdirectories of the BUILD file
However this is discouraged as it tends to lead to coarse-grained dependencies, and Pants's
advantages come into play when you have many fine-grained dependencies.
### tags
Tags are a set of strings used to describe or categorize targets. They can be consumed by subsystems during a build to allow for features such as filtering task targets (ex. skip linting targets with a particular tag) or focused testing (ex. running only unit tests by excluding targets with a `integration` tag).
Tags can be configured for targets in three ways:
- Directly in the `BUILD` file (as above)
This conversation was marked as resolved by codealchemy

This comment has been minimized.

Copy link
@baroquebobcat

baroquebobcat Mar 11, 2019

Contributor

I think the example target declaration is far enough away that this could use a little more verbiage pointing at it. Maybe

Suggested change
- Directly in the `BUILD` file (as above)
- Directly in the `BUILD` file (`tags={'common'}` in the example above)
- In `pants.ini`:
```ini
[target-tag-assignments]
tag_targets_mappings: {
'tag1': ['path/to/target:', 'path/to/another/target:bar'],
'tag2': ['path/to/another/target:bar']
}
```

- In a `JSON` file, [[referenced from the `pants.ini` or command line|pants('src/docs:options')]], for example:

```bash
./pants list src/python/pants/base:exceptions --target-tag-assignments-tag-targets-mappings=@/path/to/target_tag_definitions.json
```

`BUILD.*` files
---------------

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.