Look up Java toolchains by their actual toolchain type (#402) With `BAZEL_INCOMPATIBLE_TOOLCHAIN_TYPES_IN_RULES`, the `@bazel_tools//tools/jdk` toolchain types become aliases (#392), and a toolchain can only be looked up via an alias if the rule requested that alias. rules_java now looks up toolchains by the actual types, so rules that request `@rules_java//toolchains:toolchain_type` work. Bazel's own `java_common.compile` actions are covered by bazelbuild/bazel#33044. Closes #402 COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/402 from fmeum:real-toolchain-type-lookups 0abf3e616ecce3f26dc5f5181d9be6393fbda3cb PiperOrigin-RevId: 1034484957 Change-Id: I7767ec6b0e1397ae0272c2a9e8df7d64d0d9ee27
Java Rules for Bazel https://bazel.build.
Documentation
For a quickstart tutorial, see https://bazel.build/start/java
The fastest way to try this in an empty project is to click the green “Use this template” button on https://github.com/bazel-starters/java.
For slightly more advanced usage, like setting up toolchains or writing your own java-like rules, see https://bazel.build/docs/bazel-and-java
Core Java rules
Add a load like:
load("@rules_java//java:java_library.bzl", "java_library")
to your BUILD / BUILD.bazel / *.bzl files
For detailed docs on the core rules, see https://bazel.build/reference/be/java