Remove all existing cases of custom args for Task class ctors.

Review Request #846 - Created Aug. 7, 2014 and submitted

Information
Benjy Weinberger
pants
Reviewers
pants-reviews
jsirois
Tasks are instantiated in a managed way, in the execution engine.
So they must all have a set of known ctor args (currently context and workdir).

In some cases we allowed extra args, used only by tests. This change removes
those extra args and requires all Task classes to receive any extra information
via the context, even at test time.

This is for a couple of reasons:

1) Since the task cannot have extra args when run in the execution engine,
   it's more realistic not to allow tests to do so.

2) We want to be able to change the Task base class's ctor args in the
   future without having to modify dozens of subclasses. To do so, we'd
   like to change all Task ctors to *args, **kwargs style. This change
   is the first step towards that.

Note that we even disallow intermediate classes from having extra ctor args,
even if in theory that would be OK as long as all instantiable subclasses provide
those arguments. However it's simpler and more uniform, especially in the
*args, **kwargs style, not to allow this.

This change required adding a few more things into the Context class, which
is starting to get a bit unwieldy. I added a TODO to rethink it.

It also required moving the 'Workspace' concept out of the WhatChanged task and
into its own module, so that context can use it.
Ran all unit and integration tests locally. CI passed: https://travis-ci.org/pantsbuild/pants/builds/31944352
Tejal Desai
Benjy Weinberger
Benjy Weinberger
Review request changed

Status: Closed (submitted)

Loading...