Bazel有多个不同的工具链来支持Java代码的编译。它们可以使用命令行参数进行配置:
--java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
--java_toolchain=@bazel_tools//tools/jdk:java_toolchain11基于GitHub问题或提交注释中的一些提示,我能够发现“香草”工具链更简单,并且似乎更适合更新/最新的JDK版本。它似乎错过了ErrorProne编译器。但是,我还不清楚通过使用普通的工具链和普通的工具链,我还会错过哪些其他特性。
文档显示,这一领域很稀疏。这两种工具链之间是否有很好的比较,即哪种工具链触发了Bazel中的哪种行为?
发布于 2020-10-20 15:22:35
我找到了一些提示掩埋在Bazel源代码中。
# The 'vanilla' toolchain is an unsupported alternative to the default.
#
# It does not provider any of the following features:
# * Error Prone
# * Strict Java Deps
# * Header Compilation
# * Reduced Classpath Optimization
#
# It uses the version of javac from the `--host_javabase` instead of the
# embedded javac, which may not be source- or bug-compatible with the embedded
# javac.
#
# However it does allow using a wider range of `--host_javabase`s, including
# versions newer than the current embedded JDK.我不知道这是不是完整的故事。但是看起来普通的工具链有一些明显的缺点,特别是缺少头编译。
https://stackoverflow.com/questions/64433212
复制相似问题