bazelbuild / buildtools

A bazel BUILD file formatter and editor
Apache License 2.0
1.01k stars 415 forks source link

MODULE.bazel should be a marker of the root of the repo #1236

Closed charlesoconor closed 8 months ago

charlesoconor commented 8 months ago

When converting over to bzlmod and not having a WORKSPACE file in the root of the repo anymore

buildifier 'print label' //python/...:%py_library

Will return only the label name. e.g //:some_target instead of //nested:some_target or where ever it should be relative to root.

charlesoconor commented 8 months ago

It looks like I mucked up the integration test with this since there is a test_dir/MODULE.bazel, so it's changing the labels to be relative to that. e.g //to_fix.bzl instead of //test_dir/to_fix.bzl.

I might be missing an understanding of how MODULE.bazel files would work since just starting my migration over to bzlmod.

charlesoconor commented 8 months ago

Looks like this is the same idea. https://github.com/bazelbuild/buildtools/pull/1222