bazelbuild / bazelbuild/rules_android
The custom `toolchain_android_only` java toolchain causes Android targets to build using a different jdk
- Dominant language
- Java
- Stars
- 203
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Description
While testing the pre-alpha branch we noticed that jdk17 is being used despite us setting jdk11 as the default JDK to use. I believe this is happening because pre-alpha defines it's own custom `default_java_toolchain` that gets selected instead of the one that we provide.
https://github.com/bazelbuild/rules_android/blob/ac60cc068ed234e830c7d7ffe170c50ff2ee1f1c/tools/jdk/BUILD#L3C1-L11
When passing `--toolchain_resolution_debug='@bazel_tools//tools/jdk:current_java_toolchain'` we see that our `default_java_toolchain` is selected:
```
(12:51:30) INFO: ToolchainResolution: Target platform @local_config_platform//:host: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/jdk:toolchain_type -> toolchain //:java11_for8_toolchain
```
But in the build failure for an Android target it's using JDK17
```
(12:51:46) ERROR: ...id:lib) external/remotejdk17_macos_aarch64/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' ...
```
Contributor guide
Assessment
This issue has not been assessed yet.