Skip to content

Commit

Permalink
Add documentation on labels
Browse files Browse the repository at this point in the history
Closes facebook#667.
  • Loading branch information
cbarrete committed Feb 2, 2025
1 parent 5982e0f commit 2aae289
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/concepts/labels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: labels
title: Labels
---

The term "label" is a little overloaded in Buck2. It can refer to:

- A target identifier composed of its name, cell and path.
- One or more tag-like strings attached to a test target.

For the first definition of label, the target label is determined by
where it's defined, as well as its `name` attribute. Labels are exposed
in the build API via the
[`Label`](https://buck2.build/docs/api/build/Label/) type, which can be
used in rule implementations and BXL scripts.

For the second definition of label, test rules expose a `label`
attribute, which is a list of strings. Specific labels can be targeted
when running `buck2 test` by adding the `--exclude`/`--include` flags.
See the [test execution
docs](https://buck2.build/docs/rule_authors/test_execution/) for more
information.
1 change: 1 addition & 0 deletions website/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const sidebars: SidebarsConfig = {
'concepts/buck_out',
'concepts/visibility',
'concepts/daemon',
'concepts/labels',
'concepts/isolation_dir',
'concepts/buckconfig',
'concepts/configurations',
Expand Down

0 comments on commit 2aae289

Please sign in to comment.