# Ask some questions about the block scripts execut?

**URL:** <https://discuss.gradle.org/t/ask-some-questions-about-the-block-scripts-execut/16651>\
**Category:** Help/Discuss\
**Created:** [April 17, 2016, 3:01am UTC](https://discuss.gradle.org/t/ask-some-questions-about-the-block-scripts-execut/16651 "2016-04-17T03:01:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwind](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@jwind](https://discuss.gradle.org/u/jwind)\
**Post date:** [April 17, 2016, 3:01am UTC](https://discuss.gradle.org/t/ask-some-questions-about-the-block-scripts-execut/16651/1 "2016-04-17T03:01:23Z")

</div>

1.i can’t understand which task(\*) method invoked when i write the block script “task myTask(type: SomeType) { configure closure }”.is it groovy syntax?

2.ext{ } has the same doubt，is it Project object block script? and in Project api don’t find ext.

please help me answer the questions.and i want to know some source code execute details.

---

<div class="post-metadata">

**Author:** ![sterling](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/sterling/32/5395_2.png) [@sterling](https://discuss.gradle.org/u/sterling)\
**Post date:** [April 17, 2016, 4:11am UTC](https://discuss.gradle.org/t/ask-some-questions-about-the-block-scripts-execut/16651/2 "2016-04-17T04:11:16Z")

</div>

It’s not purely Groovy, there’s an extra AST transform that takes

`task myTask(type: SomeType)`

and turns it into (so you don’t have to use quotes):

`task("myTask", type: SomeType)`

But ignoring that, the mapping is:

`task myTask` -\> `Project.task(String)`

`task myTask {}` -\> `Project.task(String, Closure)`

`task myTask (type: SomeType)` -\> `Project.task(Map, String)`

`task myTask (type: SomeType) {}` -\> `Project.task(Map, String, Closure)`

The last two take advantage of a Groovy feature (which give you something like named parameters). You can see an example [here](http://mrhaki.blogspot.com/2009/09/groovy-goodness-named-parameters-are.html).

`ext` is a built-in extension called [`ExtraPropertiesExtension`](https://docs.gradle.org/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html). A lot of types have this extension built-in. `ext` and property look-up in general are described in the DSL guide for [`Project`](https://docs.gradle.org/current/dsl/org.gradle.api.Project.html). It relies on some of the dynamic properties of Groovy (`methodMissing` or `propertyMissing` methods) to look-up things properly.
