On 7 Jun 2014, at 9:41 am, Thomas Broyer <[email protected]> wrote:
> Hi,
>
> I'd like to work on GRADLE-3085 [1] and would like guidance on how to proceed:
>
> * how to configure the javax.tool.JavaCompiler to use in the DSL
> * how to implement it
> * how to test it
>
> Looking at the current code, I think Gradle could expose some kind of
> JavaCompilerProvider on the JavaCompile task or its CompileOptions:
>
> interface JavaCompilerProvider {
> javax.tool.JavaCompiler getJavaCompiler();
> }
I think what we want to do here is model the Java compiler as a toolchain,
similar to what we’re doing for the native C/C++ languages.
A toolchain is essentially just a factory for tools that do some work - the
java compiler in this instance. There would be a few different implementations
- one that uses the compiler from the current jdk, and one that uses an
installed jdk. There can then also be other implementations: one that uses
error_prone, one that uses the Eclipse compiler, one that uses the aspectj
compiler, and so on.
A project would have a set of available java toolchains, from which the build
author can select a particular implementation. Each JavaCompile task (and
GroovyCompile and ScalaCompile task for joint compilation) would have an
associated toolchain instance. There should also be a project level default
toolchain.
--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com
Join us for Gradle Summit 2014, June 12th and 13th in Santa Clara, CA:
http://www.gradlesummit.com