vscode-bazel
vscode-bazel copied to clipboard
Extension adds MODULE.bazel and MODULE.bazel.lock in local repositories
Maybe this is expected behavior but I wanted to still check and confirm. Anytime I open a bzl file in a workspace within our repo which is a local_repository
, it ends up creating the MODULE.bazel and MODULE.bazel.lock. We haven't migrated to bzlmod and have --noenable_bzlmod
in the root workspace but these local repositories don't have it and there's no .bazelversion
file, so it ends up adding these 2 files every single time and we have to keep undoing it. Is this expected behavior and we need to setup .bazelrc
and .bazelversion
in each of our local repositories? Or is it unintended and actually a bug?
There's a slack thread about this here: https://bazelbuild.slack.com/archives/C014RARENH0/p1702897315236089
It's a tricky problem to solve. Out of interest, what situation do you have? Is the local_repository
valid on it's own or should it only be used from the root workspace?
Interesting, thanks for that link. In general, nearly all of our usecases for local_repository
are not self-contained i.e they're solely for the purpose of the main repository/workspace and they're rarely/never built on their own, so it seemed a like surprising change in workflow for us. We do have 1 local_repository
in our repo which is valid on its own because we mirror changes downstream as a ruleset for others to use.
I wonder if we could add these workspace repos to .bazelignore
at the root of the main workspace and the extension could respect that? That said, it seems like it's complex/tricky as you said due to a variety of usecases that need to be taken into account, so we could probably just add .bazelrc
files in all these local repos.