gradle/gradle — pull request #285 by melix (2014-06-21 17:09:37+00:00)
Title: Add support for Groovy configuration script

Since Groovy 2.1, groovy supports the "configscript" option which gives the user the ability to tweak the `CompilerConfiguration` instance before files are compiled. This can be interesting to add compilation customizers for example.

This reproduces the same behavior in Gradle, by adding a `configurationScript` option to `GroovyCompileOptions`.

One could for example enable static compilation by default by doing this:

build.gradle
----
```
tasks.withType(GroovyCompile) {
groovyOptions.configurationScript = file('src/config/compilerconfig.groovy')
}
```

compilerconfig.groovy
----
```
import groovy.transform.CompileStatic
withConfig(configuration) {
ast(CompileStatic)
}
```