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

Fails to detect my current Bazel version #7

Closed
luispadron opened this issue Feb 5, 2025 · 4 comments · Fixed by #8
Closed

Fails to detect my current Bazel version #7

luispadron opened this issue Feb 5, 2025 · 4 comments · Fixed by #8

Comments

@luispadron
Copy link
Contributor

Using flags from Bazel 9.0.0-pre.20250121.1 because auto-detecting the Bazel version failed

Any way to get more info about what's failing here? Love this tool btw!

@vogelsgesang
Copy link
Contributor

vogelsgesang commented Feb 5, 2025

ok, I need to add more logging - the curse of people actually using the software... 🙂

Couple of points that come to my mind:

  • Do you have a WORKSPACE, WORKSPACE.bazel, MODULE.bazel or REPO.bazel?
  • If so, do you have a .bazeliskrc or .bazelversion file in the same folder as that file?
  • Could you share the contents of your .bazeliskrc / .bazelversion file?

@luispadron
Copy link
Contributor Author

  • Do you have a WORKSPACE, WORKSPACE.bazel, MODULE.bazel or REPO.bazel?

We have just a MODULE.bazel using Bazel 7.5.0

  • If so, do you have a .bazeliskrc or .bazelversion file in the same folder as that file?

We have both, here is the contents:

# .bazelversion
7.5.0

# .bazeliskrc
BAZELISK_WRAPPER_DIRECTORY=./Tools

@vogelsgesang
Copy link
Contributor

vogelsgesang commented Feb 5, 2025

We have both

Ah, so that's probably where the issue is. Could you temporarily delete the .bazeliskrc and check if the issue goes away? I.e. in VS-Code run the "Developer: Reload Window" command and open the bazelrc files. The issue should have disappeared with the .bazeliskrc gone.

The issue is this code snippet. As you can see, if we find a .bazeliskrc, we don't check for a .bazelversion anymore.

Let me know if want to get your hands dirty in Rust and prepare a pull request by yourself 🙂
The actual code change would only be a couple of lines. No test cases for that particular part, unfortunately, since I didn't figure out how to mock out file-system APIs in Rust, yet...

Besides the code change, this would also involve a bit of research into the logic used by bazelisk. E.g., what should happen if there are versions defined in both the .bazeliskrc and the .bazelversion? Which one should take precedence?

@luispadron
Copy link
Contributor Author

Yep deleting the .bazeliskrc allows it to find the right version! I'll try to PR something in a few

vogelsgesang pushed a commit that referenced this issue Feb 5, 2025
Bazelisk will prefer the `.bazeliskrc` Bazel version if the version is
defined there, otherwise it will use the one in `.bazelversion`.

Fixes #7
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 a pull request may close this issue.

2 participants