Closed andponlin-canva closed 2 weeks ago
CC @mtoader
Driving today, but i'll try to make it better at opting in here.
@andponlin-canva posted a PR disabling this.
I will think through on a better opt-in (most likely it will be an explicit flag in projectview if i can't find a reliable way to querying default values of flags).
@mtoader ; Thank you for that. I'll wait for your PR to merge then remove it from my side.
Unfortunately finding out if BzlMod is enabled is a bit tricky. Before your logic runs there is a bazel info
executed. I wonder if the Bazel authors would consider adding an indicator into that command's output to support this?
The only other way I know of is to do this in Starlark;
BZLMOD_ENABLED = "@@" in str(Label("//:unused"))
@mtoader ; Thank you for that. I'll wait for your PR to merge then remove it from my side.
Unfortunately finding out if BzlMod is enabled is a bit tricky. Before your logic runs there is a
bazel info
executed. I wonder if the Bazel authors would consider adding an indicator into that command's output to support this?The only other way I know of is to do this in Starlark;
BZLMOD_ENABLED = "@@" in str(Label("//:unused"))
I was also looking at running bazel info --announce_rc
but not sure how that would work w.r.t. inheritance. Also that would require me writing a parser for some unstructured bazel output.
I also wanted to add a hidden flag that would disable it (just for basic troubleshooting). https://github.com/bazelbuild/intellij/pull/6706
When comes to bzlmod, we can even ask the bazel team to provide flag, or even check if bazel fails with "Bzlmod has to be enabled" error and recover silently
I also wanted to add a hidden flag that would disable it (just for basic troubleshooting). https://github.com/bazelbuild/intellij/pull/6706
When comes to bzlmod, we can even ask the bazel team to provide flag, or even check if bazel fails with "Bzlmod has to be enabled" error and recover silently
A flag in bazel would help but that would be in the future. I would need something now.
Will try to see if i can use bazel query and maybe an expression like the one suggested above. And will definitely add a flag.
Oh, the flag is intended only to unblock users for whom it would fail for an unknown, unexpected reason.
We of course need to detect it (or precisely handle this failure and recover)
Registry flag is already there btw
I meant a project view flag (or section). However, in meantime I randomly realized this exists:
➜ bazel info starlark-semantics
INFO: Invocation ID: a07b1705-e4c4-4d8d-af60-81566aa4b02b
StarlarkSemantics{enable_bzlmod=false, incompatible_use_plus_in_repo_names=true}
that thing should only show enable_bzlmod=false if the flag is actively disabled in bazel 7+.
Description of the bug:
A recent change
0cd1de2aed660ffdda5f1f376d87dfea06c907e7
onmaster
runs a commandbazel mod
which fails for repositories which have--noenable_bzlmod
turned on (are usingWORKSPACE
) but are using a version of Bazel >=7.1.0
.The error from the tool is;
Can you please update
ExternalWorkspaceDataProvider#isEnabled
to always returnfalse
until there is a means to verify that the project has BzlMod configured before executing thebazel mod
command?Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Take a sample project that is not configured for BzlMod. Edit the
.bazelrc
file to contain;Ensure you are using Bazel >=
7.1.0
, open the project with a build of the Intelli-J plugin frommaster
and sync.Which Intellij IDE are you using? Please provide the specific version.
2024.1
What programming languages and tools are you using? Please provide specific versions.
What Bazel plugin version are you using?
7.3.1
Have you found anything relevant by searching the web?
Any other information, logs, or outputs that you want to share?