please icon indicating copy to clipboard operation
please copied to clipboard

Add buildlabel function

Open izissise opened this issue 1 year ago • 1 comments

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 avatar Mar 16 '24 17:03 izissise

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.

izissise avatar Mar 16 '24 17:03 izissise