Introducing target aliases in BUILD files.

Review Request #3939 - Created May 27, 2016 and submitted

Information
Garrett Malmquist
pants
gmalmquist/aliased-targets
3513
Reviewers
pants-reviews
benjyw, jsirois, nhoward_tw, patricklaw, stuhood, zundel
This introduces a new object for use in build files: `alias()`.

It can be used like so: `alias('foo', ':bar')` to allow referencing
`':bar'` by the name `':foo'`. This provides both practical and
aesthetic benefits. Aesthetically, it cleans up common constructs:

Eg, in a maven repo:
```
target(name='foobar',
  dependencies=[
    'foobar/src/main/java:lib',
  ],
)
```
becomes simply:
```
alias('foobar', 'foobar/src/main/java:lib')
```

Aliases also behave slightly differently than normal wrapper
targets. The substitution task which processes target aliases
injects alias's dependencies directly into their dependees. This
means that intransitive targets can be referred to via aliases
without breaking their dependencies.

We've been using this extensively at Square as an internal plugin
for a while now, but it seems likely that other folks could benefit
from it.

Added passing tests.

Build went green: https://travis-ci.org/pantsbuild/pants/builds/135101452

Issues

  • 0
  • 5
  • 1
  • 6
Description From Last Updated
Eric Ayers
Eric Ayers
Benjy Weinberger
Nick Howard (Twitter)
Nick Howard (Twitter)
Benjy Weinberger
Garrett Malmquist
Garrett Malmquist
Review request changed

Status: Closed (submitted)

Change Summary:

In b0836bf07dced36fd9a7872ce3c6d2a1f59bb774. Thanks Eric, Nick, and Benjy for the reviews (and Stu for the v2 engine fix)!

Loading...