-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support providing Jars with alternative Java compiler implementations #24649
Conversation
a0a7725
to
389fea0
Compare
b8cd2e5
to
a4bce6d
Compare
a7ee201
to
2dadd52
Compare
21c1567
to
46f7ea3
Compare
e32f00b
to
a7ecc57
Compare
0aec92f
to
de6b54c
Compare
@bot-gradle test RFN |
I've triggered the following builds for you: |
6afaaba
to
6edac44
Compare
@bot-gradle test RFN |
I've triggered the following builds for you: |
Gradle 8.4 + this PR: https://github.com/jjohannes/gradle/tree/release-8.4-ecj-patch/gradle-bin |
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
...by forwarding all methods to the wrapped file manager. This gives it more robustness when running with custom compiler and file manager implementation. In particular, it avoids hitting the following issue with the Eclipse compiler: eclipse-jdt/eclipse.jdt.core#985 Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
This differs on different 'javac' versions. Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
JavaCompile.getCustomCompilerClasspath() was added. Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
304c96a
to
af51640
Compare
Change SummaryThis PR is 91.95% new code.
|
Is there any ETA when this will be merged? Will this feature make it into 8.6 release? |
@AceTheFace - It will not be included in 8.6. Some conceptual questions arose after discussing this that need further consideration. It is marked with the |
Sorry, we don't want to model things this way. We know that supporting other Java compilers would be a good thing to have, but we don't want to expose this as another configuration with arbitrary jars that we execute. How exactly this needs to be done is unclear, but we think it would be more closely tied to a Java toolchain that provides a different Java compiler. We'll leave the original issue open, but close this PR. |
:-( Problem is, that this functionality was available with Gradle 6.x and has been dropped with 7 - which now forces us to use unstable internal API, which might change in every release. So any official way to support this would highly be appreciated. |
Our problem is that there are no APIs (internal or public) at the moment to get the custom compiler used by the compile worker JVMs. And we need that to get acceptable compile performance in a (very) large project. I think no matter where this topic goes next, this PR contains a valuable technical solution to get the additional compiler Jar into the worker. So no matter how a public API surface may look one day, I think something like that has to be added in any case. @big-guy what would be the concrete next steps? There are folks from the community (@TheMrMilchmann, me and others) who are ready to invest time and resources to make this happen. What can we do? As I wrote already, an initial internal only API that allows us to get compiler Jars into the worker, would be very helpful already. Then we have a technical foundation to built upon (in custom plugins/builds). But without this addition, we cannot solve this without patching Gradle. |
See: gradle#24649 Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Context
Proposal to provide a solution for: #15942
The proposal is to allow the definition of a
customCompilerClasspath
of theJavaCompile
task. If thecustomCompilerClasspath
contains an implementation ofjavax.tools.JavaCompiler
that can be discovered through Java'sServiceLoader
it is used in place of the default JDK compiler (JavacTool) – "on top" of the selected Java toolchain.This is how you would configure it to use the Eclipse Compiler (ECJ):
Contributor Checklist
<subproject>/src/integTest
) to verify changes from a user perspective<subproject>/src/test
) to verify logic./gradlew sanityCheck
./gradlew <changed-subproject>:quickTest
Gradle Core Team Checklist