Re-work REPL mutual exclusion.

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

Information
John Sirois
pants
jsirois/issues/2110/repl_base
2110, 2132
2762
2766
a0a1159...
Reviewers
pants-reviews
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/mutex_task_mixin.py             | 129 +++++++++++++++++++++++++++++++++++++++++++++
 src/python/pants/backend/core/tasks/repl_task_mixin.py              |  55 +++++++++++++++++++
 src/python/pants/backend/core/tasks/task.py                         |  28 ----------
 src/python/pants/backend/jvm/tasks/BUILD                            |   6 +--
 src/python/pants/backend/jvm/tasks/scala_repl.py                    |  53 +++++++++----------
 src/python/pants/backend/python/tasks/BUILD                         |   2 +-
 src/python/pants/backend/python/tasks/python_repl.py                |  70 ++++++++++++-------------
 src/python/pants/base/target.py                                     |  19 -------
 tests/python/pants_test/backend/core/tasks/BUILD                    |  57 ++++++++++++--------
 tests/python/pants_test/backend/core/tasks/test_mutex_task_mixin.py | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/python/pants_test/backend/python/tasks/BUILD                  |   1 +
 tests/python/pants_test/backend/python/tasks/test_python_repl.py    |  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:
  https://travis-ci.org/pantsbuild/pants/builds/78769440
John Sirois
John Sirois
John Sirois
John Sirois
Eric Ayers
John Sirois
John Sirois
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...