On Fri, 2015-10-30 at 09:53 -0700, daniel_sun wrote:
> Hi all,
>
> Could you tell me the following gradle code comply with the
> syntax of
> groovy? The 'task' can be a method, what about 'taskA' and
> '<<'? Thanks in
> advance.
>
> task taskA << {
> println "i'm task A"
> }
If I remember correctly, this syntax only works because Gradle applies
an AST transform to the code. The more tradition Groovy code that this
gets transformed to is:
task('taskA') << {
println "i'm task A"
}
which is pure Groovy.
Though I suspect I am now going to have to say Apache Groovy now.
> ----------- my experimental code, but failed with exceptions
> -----------------
> def task(t) {
> t()
> }
>
> task taskA << {
> println "i'm task A"
> }
> =================
> groovy.lang.MissingPropertyException: No such property: taskA for
> class:
> ConsoleScript8
>
> at ConsoleScript8.run(ConsoleScript8:5)
> ----------------------------
>
>
>
> --
> View this message in context: http://groovy.329449.n5.nabble.com/Abou
> t-the-syntax-of-groovy-tp5729026.html
> Sent from the Groovy Users mailing list archive at Nabble.com.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected]
41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected]
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
