-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Apply buildifier to MODULE.bazel. #19796
Conversation
@katre I think that's because the MODULE.bazel.lock file is now out of date (e.g. Starlark |
I had no idea this was needed. Added a NOTE to MODULE.bazel and an error message in bazel_bootstrap_distfile_test that might help someone (probably me) in the future. |
MODULE.bazel
Outdated
# NOTE: When editing this file, also update the lockfile. | ||
# bazel mod deps --lockfile_mode=update | ||
# bazel build //src/test/tools/bzlmod:update_default_lock_file | ||
# bazel-bin/src/test/tools/bzlmod/update_default_lock_file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this just be bazel run
instead of build
plus manual run? This may also only be needed when MODULE.tools
is changed - cc @meteorcloudy .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is only needed when MODULE.tools
is changed.
And you actually have to use bazel run //src/test/tools/bzlmod:update_default_lock_file
since it needs BUILD_WORKING_DIRECTORY
to be set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tried bazel run
:
$ bazel run //src/test/tools/bzlmod:update_default_lock_file
INFO: Analyzed target //src/test/tools/bzlmod:update_default_lock_file (0 packages loaded, 1 target configured).
INFO: Found 1 target...
Target //src/test/tools/bzlmod:update_default_lock_file up-to-date:
bazel-bin/src/test/tools/bzlmod/update_default_lock_file
INFO: Elapsed time: 0.381s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/src/test/tools/bzlmod/update_default_lock_file
Running: /usr/local/google/home/jcater/.cache/bazel/_bazel_jcater/a85a0dacd9e20e18c47928db0f1530e0/execroot/_main/bazel-out/k8-fastbuild/bin/src/bazel mod deps
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
WARNING: --enable_bzlmod is set, but no MODULE.bazel file was found at the workspace root. Bazel will create an empty MODULE.bazel file. Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. For more details, please refer to https://github.com/bazelbuild/bazel/issues/18958.
<root> (@_)
But it did update src/test/tools/bzlmod/MODULE.bazel.lock
.
When I split into bazel build .. && ...
:
bazel build //src/test/tools/bzlmod:update_default_lock_file && bazel-bin/src/test/tools/bzlmod/update_default_lock_file
INFO: Analyzed target //src/test/tools/bzlmod:update_default_lock_file (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //src/test/tools/bzlmod:update_default_lock_file up-to-date:
bazel-bin/src/test/tools/bzlmod/update_default_lock_file
INFO: Elapsed time: 0.343s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
No error, but src/test/tools/bzlmod/MODULE.bazel.lock
wasn't changed.
This is incredibly confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bash runfile libraries seems to fail with no error message when directly running the bash binary. @fmeum Am I using the runfiles library correctly? https://github.com/bazelbuild/bazel/blob/013683f6364dd15209aee83a71df58e3bfb4aff1/src/test/tools/bzlmod/update_default_lock_file.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are, this is a bug. I will submit a fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fix for this issue has been included in Bazel 7.0.0 RC2. Please test out the release candidate and report any issues as soon as possible. Thanks!
Pushed a few more commits to clarify messages and format more files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll try to make update_default_lock_file less confusing.
@katre Can you please resolve the conflicts? |
Resolved and pushed. |
Argh, import is breaking because this changes I'll try and fix this. |
When an `sh_binary` is run directly from `bazel-bin`, its path won't be contained in the manifest and will not match a `bazel-out` regex. Instead, make the path absolute and then match after the `bazel-bin` to extract the binaries repository name. Also improve the error message when `runfiles_current_repository` can find neither the runfiles manifest nor the runfiles directory. Work towards fixing #19796 (comment) Closes #19810. PiperOrigin-RevId: 574208158 Change-Id: I45d6b503e8f34e13177d57ca64c202640306cfb8
When an `sh_binary` is run directly from `bazel-bin`, its path won't be contained in the manifest and will not match a `bazel-out` regex. Instead, make the path absolute and then match after the `bazel-bin` to extract the binaries repository name. Also improve the error message when `runfiles_current_repository` can find neither the runfiles manifest nor the runfiles directory. Work towards fixing bazelbuild#19796 (comment) Closes bazelbuild#19810. PiperOrigin-RevId: 574208158 Change-Id: I45d6b503e8f34e13177d57ca64c202640306cfb8
…scripts (#19857) When an `sh_binary` is run directly from `bazel-bin`, its path won't be contained in the manifest and will not match a `bazel-out` regex. Instead, make the path absolute and then match after the `bazel-bin` to extract the binaries repository name. Also improve the error message when `runfiles_current_repository` can find neither the runfiles manifest nor the runfiles directory. Work towards fixing #19796 (comment) Closes #19810. Commit 58ce112 PiperOrigin-RevId: 574208158 Change-Id: I45d6b503e8f34e13177d57ca64c202640306cfb8 Co-authored-by: Fabian Meumertzheim <[email protected]>
Also add a note about how to update the lockfile.