On 14/02/2012, at 2:24 PM, Joern Huxhorn wrote:

> The Release Notes at 
> http://wiki.gradle.org/display/GRADLE/Gradle+1.0-milestone-8+Release+Notes 
> contain the following example:
> 
> signing {
>  required = { gradle.taskGraph.hasTask("uploadArchives") && 
> !version.endsWith("SNAPSHOT") }
> }

I just fixed that up to make it a little clearer, thanks. The hasTask() method 
requires an absolute path as you found out.

> This caused me quite a bit of confusion since in a multi-module project, the 
> task contained in taskGraph is something like ':foo:uploadArchives' so the 
> code above wouldn't work. (On a side note, I use the task uploadPublished 
> instead of uploadArchives.)
> 
> The only way I could find to achieve something like the functionality 
> intended above was
> signing {
>  required = { gradle.taskGraph.allTasks.any { it instanceof Upload } && 
> !version.endsWith("SNAPSHOT") }
> }
> 
> Or am I missing something and there is a more elegant way?

That will not allow you to `gradle install` (the install task is an Upload 
task) without signing which may not be what you want. Signing configuration is 
per project, and hasTask() accepts task objects. So you could do…

signing {
 required = { gradle.taskGraph.hasTask(uploadPublished) && 
!version.endsWith("SNAPSHOT") }
}

Actually… I think I'll update the cable to that.

Cheers.

-- 
Luke Daley
Principal Engineer, Gradleware 
http://gradleware.com


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to