Cut the dependency on ijar when not stripping the bootclasspath

Rule deps are fetched eagerly, even if unused, so we need to actually cut the edge to ijar when not stripping for bazel bootstrapping to succeed.

Unfortunately, with the way Bazel integration tests are set up, there's no way to test this with Bazel without making a release. I manually verified that `bazel query deps()` reports the right results and the targets build correctly.

```
$ bazel query 'deps(//toolchains:platformclasspath, 1)'
//:license
//toolchains:DumpPlatformClassPath.java
//toolchains:current_java_runtime
//toolchains:ijar
//toolchains:incompatible_language_version_bootclasspath_enabled
//toolchains:language_version_bootstrap_runtime
//toolchains:platformclasspath
//toolchains:utf8_environment
@bazel_tools//tools/allowlists/function_transition_allowlist:function_transition_allowlist
@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type

$ bazel query 'deps(//toolchains:platformclasspath_unstripped, 1)'
//:license
//toolchains:DumpPlatformClassPath.java
//toolchains:current_java_runtime
//toolchains:incompatible_language_version_bootclasspath_enabled
//toolchains:language_version_bootstrap_runtime
//toolchains:platformclasspath_unstripped
//toolchains:utf8_environment
@bazel_tools//tools/allowlists/function_transition_allowlist:function_transition_allowlist
@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type
```

(ignore-relnotes)

PiperOrigin-RevId: 828368783
Change-Id: Ie29eea882ad41e4efa8f1dd752679a221a239ae1
1 file changed
tree: b669790e4f7075cdec9b644df5b97700a91f9d58
  1. .bazel_checkout/
  2. .bazelci/
  3. .bcr/
  4. .github/
  5. distro/
  6. examples/
  7. java/
  8. test/
  9. third_party/
  10. toolchains/
  11. .bazelignore
  12. .bazelrc
  13. .gitignore
  14. AUTHORS
  15. BUILD
  16. CODEOWNERS
  17. CONTRIBUTING.md
  18. LICENSE
  19. MODULE.bazel
  20. README.md
  21. renovate.json
  22. WORKSPACE
  23. WORKSPACE.bzlmod
README.md

rules_java

  • Postsubmit Build status
  • Postsubmit + Current Bazel Incompatible Flags Build status

Java Rules for Bazel https://bazel.build.

Documentation

For a quickstart tutorial, see https://bazel.build/start/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