Skip to content

Upgrade rules_java and add rule loads#1271

Merged
jin merged 1 commit intobazel-contrib:masterfrom
ted-xie:load_java_rules
Oct 28, 2024
Merged

Upgrade rules_java and add rule loads#1271
jin merged 1 commit intobazel-contrib:masterfrom
ted-xie:load_java_rules

Conversation

@ted-xie
Copy link
Contributor

@ted-xie ted-xie commented Oct 24, 2024

  • Upgrade to the latest rules_java 8.1.0
  • Add loads for Java rules

NOTE: The loads and rules_java version unforutunately are tightly related. The paths for the bzl files for Java rules changed between rules_java 7 and 8.

* Upgrade to the latest rules_java 8.1.0
* Add loads for Java rules

NOTE: The loads and rules_java version unforutunately are tightly
related. The paths for the bzl files for Java rules changed between
rules_java 7 and 8.
@ted-xie
Copy link
Contributor Author

ted-xie commented Oct 24, 2024

For some more context on the rule loads: This PR is supposed to make rules_jvm_external work with Bazel 8, which removes all native Java rule loads.

Most users will be able to upgrade to Bazel 8 without manually adding all of these loads for Java rules. The exception is rule repository maintainers -- I'm not sure of the specifics, but it looks like rule reposotiries (rules_java, rules_android, etc) are special-cased, and autoloads from other rule repositories are disabled.

I was motivated to write this PR when trying to get rules_android to work with Bazel 8. Because I'm working inside a rule repo, it looks like transitive repo deps are not autoloaded -- for example, rules_jvm_external's use of java_library/java_import rules.

For more context on why rules_java 8.1.0: rules_java v8 changed where symbols such as java_binary and JavaInfo are loaded from. The old paths to various .bzl files seem to no longer exist, or at least are no longer visible.

@ted-xie
Copy link
Contributor Author

ted-xie commented Oct 24, 2024

/cc @comius

@jin jin merged commit 305848d into bazel-contrib:master Oct 28, 2024
@jin
Copy link
Collaborator

jin commented Oct 28, 2024

Wait, did you forget to update MODULE.bazel?

@ted-xie
Copy link
Contributor Author

ted-xie commented Oct 28, 2024

Ah, my main repository already had rules_java bumped to 7.12.2 so I forgot I had to update it in RJE too. I see you already updated RJE's MODULE.bazel in 3ea9649. I think that should be sufficient.

gergelyfabian added a commit to gergelyfabian/rules_jvm_external that referenced this pull request Dec 2, 2025
Autoload is disabled for rules_java by default on Bazel 9.
Many of these were already fixed in bazel-contrib#1271, but some more are still left.
gergelyfabian added a commit to gergelyfabian/rules_jvm_external that referenced this pull request Dec 2, 2025
Autoload is disabled for rules_java by default on Bazel 9.
Many of these were already fixed in bazel-contrib#1271, but some more are still left.
gergelyfabian added a commit to gergelyfabian/rules_jvm_external that referenced this pull request Dec 2, 2025
Autoload is disabled for rules_java by default on Bazel 9.
Many of these were already fixed in bazel-contrib#1271, but some more are still left.
gergelyfabian added a commit to gergelyfabian/rules_jvm_external that referenced this pull request Dec 2, 2025
Autoload is disabled for rules_java by default on Bazel 9.
Many of these were already fixed in bazel-contrib#1271, but some more are still left.
gergelyfabian added a commit to gergelyfabian/rules_jvm_external that referenced this pull request Dec 2, 2025
Autoload is disabled for rules_java by default on Bazel 9.
Many of these were already fixed in bazel-contrib#1271, but some more are still left.
gergelyfabian added a commit to gergelyfabian/rules_jvm_external that referenced this pull request Dec 2, 2025
Autoload is disabled for rules_java by default on Bazel 9.
Many of these were already fixed in bazel-contrib#1271, but some more are still left.
shs96c pushed a commit that referenced this pull request Dec 2, 2025
Autoload is disabled for rules_java by default on Bazel 9.
Many of these were already fixed in #1271, but some more are still left.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants