Re-work REPL mutual exclusion.

Review Request #2765 - Created Sept. 4, 2015 and submitted

John Sirois
2110, 2132
kwlzn, patricklaw, stuhood, zundel
The old method required modifying Target which was untenable for
plugins.  A new approach is taken by introducing a MutexTaskMixin that
supports forming groups of tasks that all provide the same mutually
exclusive service.  The functionality is the same as that provided by
the previous pairing of `Target.lang_discriminator` and
`Task.require_homogeneous_targets`, but with a more flexible version of
`Target.lang_discriminator` that allows any installed tasks with a
shared MutexTaskMixin to form a mutual exclusion group in an
uncoordinated manner (save from mixing in the shared base mutex mixin).

The `ReplTaskMixin` serves as the realization of this concept and both
`PythonRepl` and `ScalaRepl` tasks and tests are retrofitted to use it.

This paves the way for the node contrib plugin to provide its own
`NodeRepl` in a follow-up RB.

 src/python/pants/backend/core/tasks/BUILD                           |  21 ++++++++
 src/python/pants/backend/core/tasks/             | 129 +++++++++++++++++++++++++++++++++++++++++++++
 src/python/pants/backend/core/tasks/              |  55 +++++++++++++++++++
 src/python/pants/backend/core/tasks/                         |  28 ----------
 src/python/pants/backend/jvm/tasks/BUILD                            |   6 +--
 src/python/pants/backend/jvm/tasks/                    |  53 +++++++++----------
 src/python/pants/backend/python/tasks/BUILD                         |   2 +-
 src/python/pants/backend/python/tasks/                |  70 ++++++++++++-------------
 src/python/pants/base/                                     |  19 -------
 tests/python/pants_test/backend/core/tasks/BUILD                    |  57 ++++++++++++--------
 tests/python/pants_test/backend/core/tasks/ | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/python/pants_test/backend/python/tasks/BUILD                  |   1 +
 tests/python/pants_test/backend/python/tasks/    |  31 +++++++++--
 13 files changed, 468 insertions(+), 146 deletions(-)
I manually verified the fail-fast behavior on conflicting REPLs works
just like it did before and also verified python and scala REPLs worked
on various targets.  New unit tests seal this behavior in as well in
MutexTaskMixin as well as an old test method in PythonReplTest.

CI went green here:
John Sirois
John Sirois
John Sirois
John Sirois
Eric Ayers
John Sirois
John Sirois
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)