How Does Groovy Support Adding Configuration in Gradle Configuration Script Block -


in gradle documentation when use configurations block in build.gradle file closure passed delegates configurationcontainer object. truncated form of example usage given below:

configurations {   //adding configuration:   myconfiguration } 

i used calls inside closure being method calls on delegated object, here myconfiguration single word , know in groovy method no parameters must have parentheses can't method call. somehow putting single word in looks me should invalid groovy new configuration of myconfiguration added delegated configurationcontainer.

how working?

project.configurations(closure) calls configurationcontainer.configure(closure), creates , adds named items container, declared in closure. because configurationcontainer extends nameddomainobjectcontainer, every item added should have name. in provided code sample name declared, myconfiguration item created , added, default field values. in case 1 needs configure item (change properties), configuration follows:

   configurations {      myconfiguration {         transitive = false      }    } 

more info/insights https://gist.github.com/tlberglund/3132622.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -