Ability to specify a CompilerConfiguration instance for GroovyCompile task?


(Andres Almiray) #1

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


(Andres Almiray) #2

bump


(Peter Niederwieser) #3

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.


(Peter Niederwieser) #4

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.


(Luke Daley) #5

Exposing --configscript seems the way forward.


(Andres Almiray) #6

Domo Arigato :slight_smile:


(Marcel Overdijk) #7

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


(Peter Niederwieser) #8

AFAIK it’s not yet supported.


(Marcel Overdijk) #9

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


(Peter Niederwieser) #10

Filed GRADLE-3057.