Thank you very much for such a detailled explanation.
John Murph wrote:
>
> I mentioned in my previous post that I changed your code from an
> "execution
> closure" to a "configuration closure". That is what the "<<" does.
>
> Finally, to fully understand the error you are seeing, you need one more
> piece of information. The "<<" is just shorthand for doLast.
>
Understood. I'm slowly piecing it together. Going back to the documentation,
this would be identical then:
tasks.add(name: 'copy', type: Copy).configure {
...
}.doLast {
...
}
About the "<<"; in my opinion shortcuts are always things that have a
certain risc. Replacing ".doLast" with " <<" saves 4 characters, but "<<"
does (in a generic sense) not really symbolize "last". It more resembles
"previous", "rewind" or "redirect in". At least that is how I was reading
it. So I'm not sure saving 4 characters is worth the less obvious notation.
A better symbol would have been ">|", but I understand that Groovy puts
syntactical restrictions on Gradle's domain language. Knowing this, I will
be using the more explicit methods instead.
BTW, I would expect "execute" instead of "doLast". "doLast" is more like an
event thing, instead of the main body of the action.
John Murph wrote:
>
> As to why uploadArchives doesn't need the configuration to be set, this is
> part of what the Java plugin does for you. I don't remember for sure, but
> I
> think it just finds all configurations and makes an upload<config name>
> task
> for each one, associating the task with the configuration automatically.
> The archives configuration is a default configuration to which the result
> of
> all "Jar" and "Zip" and "Tar" type tasks are automatically added. Those
> two
> automatic actions are fairly mundane, but the combination result is a bit
> "magical."
>
My two posts back message showed code I took from the Upload task; it
explicitly sets the correct configuration.
Slowly removing the syntactic sugar (<< becomes doLast) makes my build
script more easily readble IMHO. But the whole configurations thing is
indeed something mystical. I pieced what I have now together with some copy
and pasting from google.
John Murph wrote:
>
> As for the user guide, we
> have discussed the need for an improved "beginners guide" before, but it's
> one thing to say it's needed, and another altogether to write it.
>
I understand, although writing posts like the ones you did for me, also
takes time :-)
What I would suggest Gradle needs, is a conceptual overview. What are these
configurations? And the stuff about tasks having a configuration moment and
an execution moment. But I can imagine it is hard to explain in a document.
Maybe each task also should describe what it does from an configuration and
execution point of view. So zip: setups up x, y z, adds the jar to
configuration.archives, generates zip file. ANT also describes the tasks in
such a way.
--
View this message in context:
http://old.nabble.com/difference-between-uploadArchives-and-custom-task-tp26920056p26932321.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email