Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loads for certain py/java rules #121

Merged
merged 13 commits into from
Dec 3, 2024
Merged

Conversation

ted-xie
Copy link
Contributor

@ted-xie ted-xie commented Nov 27, 2024

Bazel 8 removes native shell, python, and java rules. This PR makes rules_robolectric compatible with Bazel 8.

Bazel 8 removes native shell, python, and java rules. This PR makes
rules_robolectric compatible with Bazel 8.
@ted-xie
Copy link
Contributor Author

ted-xie commented Nov 27, 2024

Provided this PR gets merged, we (the Bazel team) would also need a release cut relatively quickly in order to unblock the next rules_android release, which will unblock the upcoming Bazel 8 release.

@ted-xie ted-xie changed the title Add loads certain py/java rules Add loads for certain py/java rules Nov 27, 2024
@ted-xie
Copy link
Contributor Author

ted-xie commented Nov 27, 2024

@Bencodes @Wyverald There ended up being some kind of java toolchain issue when I tried upgrading rules_java to 8.5.1 for the example app:

ERROR: /home/runner/.cache/bazel/_bazel_runner/faa3a579053c5258adca3d7c148553b6/external/rules_java_builtin/toolchains/BUILD:254:14: While resolving toolchains for target @@rules_java_builtin//toolchains:platformclasspath (b8277ad): No matching toolchains found for types @@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type.

Note that this only occured with WORKSPACE mode. I tried debugging this for a while but wasn't able to come up with anything concrete. I suspect it's something to do with the native Android rules in rules_android v0.1.1 interacting badly with the latest rules_java, but upgrading the Android rule dep in WORKSPACE was unsavory to say the least.

The only reason I wanted to upgrade rules_java in the first place was to get the rules_java version of http_jar(), but that involved pulling in a lot of complicated WORKSPACE setup and the aforementioned toolchain issue. The next best solution I could think of was to copy over the (fairly standalone) http_jar() rule into robolectric itself, which is also gross, but much less complicated than making WORKSPACE builds work.

@utzcoz
Copy link
Member

utzcoz commented Nov 28, 2024

@ted-xie Just require extra modifications for Buildfier.

@utzcoz
Copy link
Member

utzcoz commented Nov 28, 2024

@Bencodes Maybe you can release a new version based #95 and 4.14.1 release.

Copy link
Member

@utzcoz utzcoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@utzcoz utzcoz merged commit 5b7ff8e into robolectric:master Dec 3, 2024
19 checks passed
@utzcoz
Copy link
Member

utzcoz commented Dec 3, 2024

@@ -0,0 +1,200 @@
"""The http_jar repo rule, for downloading jars over HTTP.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ted-xie and I chatted about this one further and think that this is probably the least-hacky solution for the underlying issue.

We talked about some alternatives here like letting the workspace and module file diverge, and even patching rules_android. But both of these kind of have downsides that might cause more issues for our end users than just copying http_jar over in the short term.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

3 participants