Actually, this behavior change might be related to this (from the milestone
2 release notes):

DSL Improvements

You can now specify the *source files* for a task through the DSL.
Previously this was only possible by using the @SkipWhenEmpty annotation on
a custom task class. The source files of a task are treated as input files.
In addition, the task is skipped if the set of source files is declared and
empty.

It looks like Gradle is considering the deploy tasks source files to be
declared and empty (hence the "as it has no source files" as the reason for
skipping).  However, it looks like Steve is not declaring any source files
until the doFirst.  I suspect that doing the "from ..." in a configuration
closure and setting the "into ..." in the doFirst will work.  If so, I think
this might be a bug in milestone 1 that even if from() is not called, the
source files are considered declared (but empty).  Or, I'm miss-reading the
release notes!


On Tue, Apr 19, 2011 at 3:51 PM, Spencer Allain <[email protected]>wrote:

> Since that is a task of type Sync, I'm surprised it ever worked, but I'm
> guessing that it was like the JavaExec task recently identified to always
> assume it was out-of-date, and that behavior was fixed in milestone-2.
> Since no inputs or outputs are defined in the configuration phase, it seems
> that it should attempt to skip it.
>
> You could simulate that behavior again by doing something like
> deploy {
>   onlyIf { true }
> }
>
> This should also work as well:
>
> deploy.onlyIf { true }
>
> Although, Adam will likely dig into the source and provide a better
> solution later :-)
>
> -Spencer
>
> --- On *Tue, 4/19/11, Steve Appling <[email protected]>* wrote:
>
>
> From: Steve Appling <[email protected]>
> Subject: [gradle-user] milestone 2 broke a task
> To: [email protected]
> Date: Tuesday, April 19, 2011, 11:43 AM
>
>
> One of our tasks no longer works with milestone 2.  Is anyone aware of an
> intentional change that would have broken this, or is this a bug.
> We have:
> task deploy(description: 'Deploys the war to the webserver', type: Sync,
> dependsOn:[war])
> deploy.doFirst {
>    println "Deploying $war.baseName to ${getDeployLoc().canonicalPath}"
>    from zipTree(war.archivePath)
>    into getDeployLoc()
> }
>
> getDeployLoc is a helper method that needs to be only run if the deploy
> task is run, so we don't want to call it during the configuration phase.
>
> This worked fine in milestone 1, but in milestone 2 I get "Skipping task
> ':deploy' as it has no source files."
>
> --
> Steve Appling
> Automated Logic Research Team
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

-- 
John Murph
Automated Logic Research Team

Reply via email to