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

Extension adds MODULE.bazel and MODULE.bazel.lock in local repositories #383

Open
smocherla-brex opened this issue Apr 17, 2024 · 2 comments
Labels
type: bug Something isn't working

Comments

@smocherla-brex
Copy link

smocherla-brex commented Apr 17, 2024

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?

@cameron-martin
Copy link
Collaborator

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?

@cameron-martin cameron-martin added the type: bug Something isn't working label Apr 17, 2024
@smocherla-brex
Copy link
Author

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.

@cameron-martin cameron-martin changed the title Extension adds MODULE.bazel and MODULE.bazel in local repositories Extension adds MODULE.bazel and MODULE.bazel.lock in local repositories May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants