--- On Fri, 4/9/10, Adam Murdoch <[email protected]> wrote:
What sorts of things do you use doFirst/doLast for that you wouldn't
use tasks for?
Consider the case where there are 3 multi-project builds; call them A, B, and 
C; where there are knowledge relationships that can only be one-way (and they 
have to be that way for reasons that cannot be solved via software).

A knows only about itself and it's subprojects.
B knows about A where some of B's subprojects are enhanced versions of A's 
subprojects and modifies the A subproject task behaviors as necessary.
C knows about B and A, and likewise it's subprojects modify the behaviors of 
some A and B subprojects.

To a developer, A, A+B and A+B+C all produce the "same" final product, and it 
is desirable to utilize the same Tasks to accomplish the "same" build 
steps/outputs.

When just configurations will be changing, it is easier, because B is the 
master project for A+B, and C is the master project for A+B+C, and subproject 
injection will happen in the order desired (well, it does require A and B to 
check first that a configuration variable to be assigned doesn't already have a 
value, but that is an idiom that can be enforced without A and B really knowing 
why it might already be set).

When execution behavior needs to be modified, doFirst can be done with new 
tasks and wiring them up with all the correct dependencies (which will have to 
deal with getting the inputs/outputs proxied correctly for a simply 
pre-execution step).

Trying to do that with doLast isn't always feasible without requiring a new 
task be invoked at build time, which adds complexity to the developer 
attempting to compile, test, and deploy their software depending upon which 
variant they are currently working upon.  There is probably some way to wire up 
the tasks by renaming the old task, etc., but that's adding a different kind of 
complexity.

Minimizing the need for doFirst and doLast by having more powerful declarative 
tasks is valuable, but I'd hate to see that functionality removed completely.

-Spencer



      

Reply via email to