On Mon, Mar 21, 2011 at 9:23 PM, Steve Ebersole <[email protected]> wrote:
> I need a way to always run a bit of code either after compilation So far this can only be achieved with an action. We have plans for special finalizer tasks that would have the same effect (being executed as part of the execution of another task, but after this other task). Then you could use the task API for configuring it the way you want. > or before > jar'ing. Before jar'ing can be achieved with another task. > Ideally I do not want to define a Task, because I do not really want > builders to be able to run this "bit of code" itself. > Why is that important? > > I tried to implement this as an Action attached to the compileJava task > using > doLast(), but my experience was that my Action was not performed if the > compile task was deemed up-to-date. You can enhance the up-to-date checking via the task API. Have a look at the inputs and outputs property of Task. That way you can add the inputs and outputs of the added action. > Is the same true of doFirst()? > Yes. > > Is there a way to define an Action that always gets run? > No. You can only disable incremental build checking for the whole task right now. This show the weaknesses of the action model (versus initializer and finalizer tasks). Hans -- Hans Dockter Founder, Gradle http://www.gradle.org, http://twitter.com/gradleware CEO, Gradleware - Gradle Training, Support, Consulting http://www.gradleware.com
