Am Mo, 4.05.2009, 08:24, schrieb Hans Dockter:

Hi,

well, next time I have to do my homeworks better.



> Hi Rene,
>
>
> On May 4, 2009, at 12:07 AM, Rene Groeschke wrote:
>
>
>> Hello,
>> well in my Opinion the old syntax >> createTask("blablubb") <<  was a bit
>> more self-explanatory, since it makes it clear that this is a
>> configuration phase operation and you are creating something and not
>> just assigning.
>
> When we were discussing our new DSL a couple of months ago, we got a
> lot of feedback, that we should not describe operations (e.g. createX) but
> should rather declare (e.g. task X). We do the same now with
> configurations:
>
>
> configurations { newConf }
>
>
>> Another "pro" for the old syntax is, that I just get used to
>> "createTask" ;-)
>>
>
> We expect our early adopters to be flexible ;)
>
>
>>
>> Does this new syntax in the trunk replace the old syntax, or is it a
>> kind of short cut DSL additional to the existing syntax?
>
> createTask will be deprecated and eventually removed. It will be replaced
> by the new DSL syntax as well as by API methods of the tasks container
> (see the end of Adam's mail).
>
>
> - Hans
>
>
>>
>> regards, René Gröschke
>>
>>
>>
>> Am 03.05.2009 um 11:05 schrieb Adam Murdoch:
>>
>>
>>> Hi,
>>>
>>>
>>> I'd like to get some feedback on the new task definition DSL I've
>>> added to trunk.
>>>
>>> The changes replace the createTask() method with a keyword style
>>> syntax for use in build scripts, and a groovy-ish API for use
>>> elsewhere.
>>>
>>> The new syntax is:
>>>
>>>
>>> task <task-name> [(option...)] [ { action } ]
>>>
>>> Some examples:
>>>
>>>
>>> task aTask  // was createTask('aTask')
>>>
>>> task aTask { do stuff } // was createTask('aTask') { do stuff }
>>>
>>> task aTask(type: Copy, dependsOn: someOtherTask) // was
>>> createTask('aTask', type: Copy, dependsOn: someOtherTask)
>>>
>>> task aTask(dependsOn: anotherTask) { do stuff } // you can figure this
>>> one out
>>>
>>> More examples in the user guide at
>>> http://gradle.org/userguide/latest/tutorial_using_tasks.html
>>>
>>>
>>> One thing to note is that this syntax works only for statements. It
>>> does not work for expressions. That is, you can't do:
>>>
>>> Task someVar = task aTask
>>>
>>>
>>> For one thing, this isn't actually valid groovy. It would have to
>>> look like:
>>>
>>> Task someVar = task(aTask)
>>>
>>>
>>> which defeats the purpose, I think. It also looks a lot like a call to
>>> the Project.task() method, which is confusing, I think:
>>>
>>> Task someVar = task('anExistingTask')
>>>
>>>
>>> or worse:
>>>
>>> taskName = 'anExistingTask' Task someVar = task(taskName) { configure
>>> the task }
>>>
>>> For both these reasons, I've limited the syntax to statements.
>>>
>>>
>>> For defining a task in an expression, or in classes outside the
>>> build script, you can use the API on TaskContainer:
>>>
>>> tasks.add(name: 'aTask') // replaces createTask('aTask')
>>> tasks.add(name: 'aTask') { do something }
>>> tasks.add(name: 'aTask', type: Copy)
>>>
>>>
>>> Finally, Project.createTask() will be deprecated in the 0.6
>>> release, and removed some time after the release.
>>>
>>> Comments?
>>>
>>>
>>>
>>> Adam
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>>  To unsubscribe from this list, please visit:
>>>
>>>
>>> http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>
> --
> Hans Dockter
> Gradle Project lead
> http://www.gradle.org
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>
> http://xircles.codehaus.org/manage_email
>
>
>
>



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

    http://xircles.codehaus.org/manage_email


Reply via email to