Ability to specify a CompilerConfiguration instance for GroovyCompile task?

Is it possible to specify a CompilerConfiguration (see http://groovy.codehaus.org/api/org/codehaus/groovy/control/CompilerConfiguration.html) on a GroovyCompile task? I’m mostly interesed in having access to addCompilerCustomizer() It would be great if thise feature could be specified globally (for all GroovyCompile tasks in the project) and overriden locally by SourceSet.

Cheers, Andres


Gradle doesn’t have any specific support for ‘CompilerConfiguration’. Given that Gradle itself may use a different Groovy version, and that compilation typically happens in a separate VM, it’s not quite clear to me how this should be implemented. Maybe something to discuss at the Groovy developer meeting in London this week.

Actually, Groovy 2.1 introduced a ‘–configscript’ option, and it should be relatively straightforward to support that. What’s really missing is a generic way to pass command-line options to the Groovy compiler.

Exposing --configscript seems the way forward.

Domo Arigato :slight_smile:

What is the status of this? I’m in the need to specify the -configscript in my Gradle build.

AFAIK it’s not yet supported.

OK thanks, is there any JIRA issue we can follow to track this?

Filed GRADLE-3057.