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

Add buildlabel function #3110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

izissise
Copy link
Contributor

This function facilitates the creation
and modification of labels in bulk or for obtaining the full label.

It also enables referencing other packages and subrepos relatively from the current one using '../' resolution.

Examples:

  • buildlabel(target=genrule(name="xxx", ...)) -> ["///subrepo//pkg:xxx"]
  • buildlabel([":a", ":b"], out="file") -> ["///subrepo//pkg:a|file", "///subrepo//pkg:b|out"]
  • buildlabel(["subdir", "../uppkg"], target="build") -> ["///subrepo//pkg/subdir:build", "///subrepo//uppkg:build"]
  • vis("*") -> ["PUBLIC"]
  • vis("//anotherpkg/...") -> ["/////anotherpkg/..."]

More examples can be found in the test file.

This function facilitates the creation
and modification of labels in bulk or for obtaining the full label.

It also enables referencing other packages and subrepos relatively
from the current one using '../' resolution.

Examples:
- `buildlabel(target=genrule(name="xxx", ...))` -> `["///subrepo//pkg:xxx"]`
- `buildlabel([":a", ":b"], out="file")` -> `["///subrepo//pkg:a|file", "///subrepo//pkg:b|out"]`
- `buildlabel(["subdir", "../uppkg"], target="build")` -> `["///subrepo//pkg/subdir:build", "///subrepo//uppkg:build"]`
- `vis("*")` -> `["PUBLIC"]`
- `vis("//anotherpkg/...")` -> `["/////anotherpkg/..."]`

More examples can be found in the test file.
@izissise izissise changed the title Add 'buildlabel' function. Add buildlabel function Mar 16, 2024
@izissise
Copy link
Contributor Author

What would be really nice is the addition of a python type label that would be returned by build_rule this would clearly separate normal strings and label ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant