-
Notifications
You must be signed in to change notification settings - Fork 44
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
AOT is not aware of the active Java toolchain #1005
Comments
For Truffle users, this may surface as:
... emitted from the |
cc / @melix @graemerocher |
There's unfortunately no API in Gradle to figure out if we should use toolchains or not. I think we can workaround by adding one configurable to these tasks. However, your use case is interesting: how do you make a difference between GraalVM and a regular JDK? In Micronaut we've explicitly removed toolchain detection because it's impossible to make the difference so it causes a lot more pain to users than the other way around. |
@melix in our case it would be best to have full control, to be able to set a It would also cover all use cases of our style to provide some sort of tasks.someAotTask {
javac.configure {
// runs in the context of a `JavaCompile` task, maybe?
javaCompiler = myCompilerFromToolchains
}
} We are of course happy to work with whatever we can get though :) |
Expected Behavior
Running
prepareNativeOptimizations
orprepareJitOptimizations
should use the same Java toolchain assigned tojavaCompile
, to avoid issues related to pinned JDKsActual Behaviour
AbstractMicronautAotCliTask
usesgetExecOperations().javaexec(...)
without awareness of toolchains; there is no way to assign thejavaLauncher
orjavaCompiler
for aAbstractMicronautAotCliTask
, and so the user has a choice: disable toolchains and rely onJAVA_HOME
, or live with the toolchain the task selects.In my case, I need GraalVM so that I can pre-optimize my app which uses Truffle. Truffle needs a GraalVM JDK, or a
javac
/java
run enabled with-XX:+EnableJVMCI
and--upgrade-module-path
. I tried this approach, but was unable to resolve the JAR needed for the GraalVM compiler since Gradle runs the AOT task configuration quite early in the build graph.Ultimately, the user should have the ability to control the toolchain for the AOT tasks.
Steps To Reproduce
See above
Environment Information
Example Application
No response
Version
4.4.0
The text was updated successfully, but these errors were encountered: