Introducing target aliases in BUILD files.

Review Request #3939 — Created May 27, 2016 and submitted — Latest diff uploaded

gmalmquist
pants
gmalmquist/aliased-targets
3513
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

Loading...