On 7 Jun 2014, at 3:57 pm, Thomas Broyer <t.bro...@gmail.com> wrote:

> 
> 
> 
> On Sat, Jun 7, 2014 at 11:28 PM, Adam Murdoch <adam.murd...@gradleware.com> 
> wrote:
> 
> On 7 Jun 2014, at 9:41 am, Thomas Broyer <t.bro...@gmail.com> 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.
> 
> Sounds great! 
> 
> When do you think it'd be ready?
> I'm almost ready to submit a pull request for what I proposed; so it could 
> possibly be used in the mean time, if you think it's worth it.

There’s some stuff in master already (as of not very long ago). Each 
JavaCompile task has an associated JavaToolChain. Your plugin could then 
provide its own implementation.

At this stage, you still need to use internal stuff to implement a 
JavaToolChain. Over time we can open up some public APIs to make this easier.


--
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

Reply via email to