Add support for config selectors in dep addresses.

Review Request #3025 - Created Oct. 23, 2015 and submitted

Information
John Sirois
pants
jsirois/issues/2418/config_selectors
2418, 2439
3023
a66af20...
Reviewers
pants-reviews
ity, patricklaw, stuhood
This allows for modelling many variants of a target through a single
target with many configurations.  When the set of applicable
configuratons for a dependee has more than one element, the required
configuration can be specified by "sub-addressing" into a target's
(named) configurations.

This change adds an example of this:
```
./pants run src/python/pants/engine/exp/examples:viz -- \
  tests/python/pants_test/engine/exp/examples/scheduler_inputs \
  compile \
  src/java/codegen/selector:selected
```

As well as an example of what happens when more than one configuration
applies (a failing example):
```
./pants run src/python/pants/engine/exp/examples:viz -- \
  tests/python/pants_test/engine/exp/examples/scheduler_inputs \
  compile \
  src/java/codegen/selector:conflict
...
pants.engine.exp.scheduler.ConflictingProducersError: Collected the
following plans for generating "Sources(u'.java')" from
Target(address=src/thrift/codegen/selector)
  ApacheThriftPlanner
  ScroogePlanner

FAILURE:
/home/jsirois/dev/3rdparty/jsirois-pants3/build-support/pants_dev_deps.venv/bin/python2.7
pants.engine.exp.examples.visualizer:main
tests/python/pants_test/engine/exp/examples/scheduler_inputs compile
src/java/codegen/selector:conflict ... exited non-zero (1)
```

 src/python/pants/engine/exp/BUILD                                                                        |   1 +
 src/python/pants/engine/exp/addressable.py                                                               |  29 ++++++
 src/python/pants/engine/exp/examples/planners.py                                                         | 246 +++++++++++++++++++++++++++++++++++++++-----------
 src/python/pants/engine/exp/examples/visualizer.py                                                       |   2 +-
 src/python/pants/engine/exp/graph.py                                                                     |   5 +-
 src/python/pants/engine/exp/scheduler.py                                                                 |  67 +++++++++++---
 tests/python/pants_test/engine/exp/examples/scheduler_inputs/src/java/codegen/selector/BLD.json          |  25 +++++
 tests/python/pants_test/engine/exp/examples/scheduler_inputs/src/java/codegen/selector/Selector.java     |   1 +
 tests/python/pants_test/engine/exp/examples/scheduler_inputs/src/thrift/BLD.json                         |  80 ++++++++++++++--
 tests/python/pants_test/engine/exp/examples/scheduler_inputs/src/thrift/codegen/selector/BLD.json        |   8 ++
 tests/python/pants_test/engine/exp/examples/scheduler_inputs/src/thrift/codegen/selector/selector.thrift |   1 +
 tests/python/pants_test/engine/exp/test_engine.py                                                        |   4 +-
 tests/python/pants_test/engine/exp/test_scheduler.py                                                     |   8 +-
 13 files changed, 396 insertions(+), 81 deletions(-)

Locally, ran the src/java/codegen/selector:selected case which
yielded the attached plan graph.

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/86967611

Files


John Sirois
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...