java compile with with ecj

44 views
Skip to first unread message

Johannes Abt

unread,
Oct 12, 2021, 12:26:07 PM10/12/21
to bazel-...@googlegroups.com

Hi!

 

I'd like to use the Eclipse Compiler in Bazel. However, this does not seem to be easy.

 

First, I tried to write a new java_toolchain by patching the toolchain "@bazel_tools//tools/jdk:toolchain_java11".

However, I could not find out how to persuade "@bazel_tools/tools/jdk:javabuilder" to accept my ecj.jar.

 

Now I'm think about updating VanillaJavaBuilder.  I could replace "ToolProvider.getSystemJavaCompiler()" (that always seems to return the same JavaCompiler class from the JDK) with a call to the Java Service Provider Interface to make it discover other compilers, too: my ecj.jar.

 

However, instead of (at least temporarily) forking VanillaJavaBuilder, I'd much prefer a way without forking. Any ideas?

 

Best regards

Johannes Abt

Reply all
Reply to author
Forward
0 new messages