'Make a Bazel Kotlin target use a local JDK

I've downloaded the source code for OpenJDK 17, edited P11KeyStore.java as a workaround for a problem I'm facing, and compiled the modified JDK. Now I need to build a Kotlin target using Bazel, and I need it to pick up the change to P11KeyStore.java. I'm not sure whether that means using the custom JDK at compile time or at runtime, but in any case I need to make "bazel build" and/or "bazel run" use it.

Does anyone know of a way to do this with Bazel 5.0.0? I've already tried setting JAVA_HOME and passing --extra_toolchains=@local_jdk//:all to Bazel, which is supposed to do what I want but for a Java target. It seemed to have no effect on my build.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source