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

Can't find compatibility_proxy #256

Open
grepwood opened this issue Dec 30, 2024 · 2 comments
Open

Can't find compatibility_proxy #256

grepwood opened this issue Dec 30, 2024 · 2 comments

Comments

@grepwood
Copy link

Hi,

I'm trying to upgrade from rules_java 5.0.0 to 8.6.3. After patching all the downloads that go outside the company and cutting out JDK 8 support, I couldn't launch even the simplest query. Here's what I did:

bazel query --query_file=query/all_targets.query --output label

And what I get is:

checking cached actions
ERROR: Failed to load Starlark extension '@compatibility_proxy//:proxy.bzl'.
Cycle in the workspace file detected. This indicates that a repository is used prior to being defined.
The following chain of repostiroy dependencies lead to the missing definition.
 - @compatibility_proxy
This could either mean you have to add the '@compatibility_proxy' repository with a statement like 'http_archive' in your WORKSPACE file (note that transitive dependencies are not added automatically), or move an existing definition earlier in your WORKSPACE file.
ERROR: Error computing the main repository mapping: cycles detected during computation of main repo mapping
  checking cached actions

I've checked and it's only rules_java that requires this, and even more so it defines it too. What did I miss from the release notes? Nothing in the notes for this release (https://github.com/bazelbuild/rules_java/releases/tag/8.6.3) warned me about this :( How can I fix this? Btw I'm on Bazel 6.5.0.

@knarukulla
Copy link

i am also running into this, tried multiple rules_java versions.

@comius
Copy link
Collaborator

comius commented Jan 7, 2025

This looks like a missing setup in the WORKSPACE mode. The setup calls detect Bazel version and create @compatibility_proxy repository. This makes it possible to use single rules_java version for Bazels starting at 6.x.x up to 8.x.x.

Following the instructions for a particular release should fix it, for example: https://github.com/bazelbuild/rules_java/releases/tag/8.6.3

Without a setup call, rules_java can't detect Bazel version and don't work. Setup calls became a necessity for several repositories, where the Starlarkfied rules that used to be part of Bazel were moved to (rules_python, rules_android, possibly protobuf).

This requirement creates some problems where previously there were no setup calls. Those problems are inherent to the design of WORKSPACE files and Bazel team can't do much about them. Alternative is bzlmod - where there are no such design issues. bzlmod is mature, being quickly adopted by other users and it heavily reduces maintenance burden (for example version upgrades are mostly seamless). I advice migrating to bzlmod - initial time effort might be the same as upgrading a single repository version in WORKSPACE, but after initial investment you won't have to worry about those upgrades anymore.

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

No branches or pull requests

3 participants