Repository navigation
chore(bazel): upgrade buildifier_prebuilt from 8.2.0.2 to 10.2.0 - #12154
Merged
Merged
Conversation
This moves buildifier from 8.2.0 to 10.2.0. It formats the repo exactly as before, but its new default make-location lint flags all 114 "$(location ...)"/"$(locations ...)" uses in 28 BUILD and .bzl files and has no automatic fix. Exclude it from both buildifier targets: replacing those uses means choosing $(execpath ...) or $(rootpath ...) for each one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the buildifier upgrade.
No open issues 🎉
What changed in this PR
Upgrades the repository’s Bazel formatter and linter while preserving existing $(location) usage and keeping check and autofix targets aligned.
Changes:
- Bumps
buildifier_prebuiltfrom 8.2.0.2 to 10.2.0. - Disables the new
make-locationwarning through a shared warning configuration, deferring location-expression migration until each use can be checked.
| File | Description |
|---|---|
MODULE.bazel |
Upgrades the development-only buildifier_prebuilt dependency. |
bazel/BUILD.bazel |
Applies the shared make-location exclusion to both buildifier targets and documents its rationale. |
Review effort: Balanced
The vscode-bazel extension that .vscode/extensions.json recommends lints open BUILD and .bzl files by running @buildifier_prebuilt//:buildifier (set in .vscode/settings.json) with buildifier's default warnings. The lint_warnings attribute of //bazel:buildifier and //bazel:buildifier.check didn't reach it, so editors would flag the 114 make-location findings that CI ignores. Buildifier loads a .buildifier.json from its working directory or a directory above it, and command-line flags override it. Both rule targets run buildifier from the workspace root, and with this upgrade the binary target runs it from the directory that `bazel run` was started in. So a .buildifier.json at the repository root configures every buildifier run inside the checkout. Set the exclusion there and drop lint_warnings from the two targets. Use the "warnings" key rather than "warningsList". A --warnings flag replaces "warnings", but buildifier appends "warningsList" to the flag's value, which fails when the flag names categories without a +/- prefix, such as --warnings=all. Co-Authored-By: Claude Opus 5.5 <[email protected]>
rzakrzyk
approved these changes
Nov 18, 2026
dominikayyildiz
approved these changes
Nov 18, 2026
basvandijk
added a commit
that referenced
this pull request
Nov 18, 2026
master changed the lines around this PR's aspect_bazel_lib bump: bazel_skylib 1.9.2 (#12150), rules_shell 0.10.0 (#12152) and buildifier_prebuilt 10.2.0 (#12154). The resolution takes those three versions from master and keeps this PR's aspect_bazel_lib 2.22.5 with its comment and single_version_override. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AleDema
pushed a commit
to AleDema/ic
that referenced
this pull request
Nov 18, 2026
…#12155) Upgrades `aspect_bazel_lib` from 2.19.3 to [2.22.5](https://github.com/bazel-contrib/bazel-lib/releases/tag/v2.22.5), its latest release. 2.x is the last `aspect_bazel_lib` line: from 3.0 on the module is published as `bazel_lib`, which is already in our graph at 3.2.2 (through `llvm`, `rules_qemu`, `rules_distroless`, `rules_foreign_cc`, `tar.bzl` and `yq.bzl`). The bump comes with a small patch to `aspect_bazel_lib`'s `MODULE.bazel`. Without it, `aspect_bazel_lib`'s own toolchains would take over the toolchain types that it now aliases from `bazel_lib` and `tar.bzl` (since 2.21.1 and 2.22.0). Then hermetic-llvm would assemble its toolchain with `aspect_bazel_lib`'s tools instead of `bazel_lib`'s, and every C/C++/Rust build would break as soon as `bazel_lib` >= 3.8.0 enters the graph (details below). With the patch, the build graph of the release artifacts resolves the same toolchains as on master, and the release artifacts are byte-identical. ## Changes - **`MODULE.bazel`**: version bump, plus a `single_version_override` that applies the patch below and pins 2.22.5. The pin is needed because Bazel applies a patch to a module's `MODULE.bazel` to every version of the module that it visits during resolution, and `rules_oci` 2.0.0 asks for 2.7.2, where the patch doesn't apply. - The pin also holds `aspect_bazel_lib` at 2.22.5 when another module asks for a newer version, and Bazel doesn't warn about that. The comment above the override says so and points to `bazel mod explain aspect_bazel_lib --verbose`, which marks the requests that the pin overrides, e.g. `[email protected] # (was 2.7.2, cause single_version_override)` under `rules_oci` 2.0.0. Nothing asks for more than 2.22.5 today. In our graph, `rules_oci` 2.0.0 asks for 2.7.2 and `jq.bzl` 0.1.0 for 2.8.1. Among the latest releases of our direct dependencies, the highest request is 2.21.1 (`rules_oci` 2.3.5). - BCR's `aspect_bazel_lib/2.22.5` carries only its usual release patches (version stamp, Go dev dependencies). - 2.22.5 adds a dependency on `bazel_lib` 3.0.0 and asks for `tar.bzl` 0.5.1, `bazel_skylib` 1.8.1 and `stardoc` 0.7.1. We already resolve `bazel_lib` 3.2.2, `tar.bzl` 0.10.4, `bazel_skylib` 1.9.0 and `stardoc` 0.7.2, so no other module's resolved version changes. - **`bazel/aspect_bazel_lib_aliased_toolchains.patch`** (new): removes 5 of the 9 `register_toolchains` entries from `aspect_bazel_lib`'s `MODULE.bazel`, those of the five toolchain types that 2.21.1 and 2.22.0 turned into aliases (`copy_directory`, `copy_to_directory`, `coreutils`, `expand_template` and `tar`). jq, yq, zstd and bats are still `aspect_bazel_lib`'s own toolchain types and keep their registrations. The patch applies to the BCR source with no offset or fuzz. ## Why the patch [bazel-contrib/bazel-lib#1153](bazel-contrib/bazel-lib#1153) (2.21.1) turned the `tar` toolchain type into an alias of `tar.bzl`'s. [bazel-contrib/bazel-lib#1216](bazel-contrib/bazel-lib#1216) (2.22.0) turned the `copy_directory`, `copy_to_directory`, `coreutils` and `expand_template` toolchain types into aliases of `bazel_lib`'s, so that rules from both modules create identical actions. But `aspect_bazel_lib` still registers its own toolchains for all five. It is a direct dependency of the root module, while `bazel_lib` and `tar.bzl` are transitive ones, so its registrations come first and win for every rule that requests one of the shared types. With only the version bump, `bazel cquery` shows two switches: - **Release artifacts:** hermetic-llvm assembles its resource directory, crt objects and the libc++/libc++abi/libunwind/glibc search directories with `bazel_lib`'s `copy_file` and `copy_to_directory`. These 22 `CopyFile` and 86 `CopyToDirectory` actions (across configurations) are the only users of these toolchains in the build graph of the release artifacts. They would switch from `bazel_lib` 3.2.2's tools to `aspect_bazel_lib`'s, e.g. from uutils coreutils 0.5.0 to 0.1.0. - **Test and Rosetta images:** the `tar.bzl` and `rules_distroless` targets would switch from `tar.bzl`'s bsdtar (hermeticbuild/bsdtar-prebuilt v3.8.1-3) to `aspect_bazel_lib`'s (aspect-build/bsdtar-prebuilt v3.8.1). These are `//rs/tests:{sh,awk,ca_certificates,dpkg_status,passwd,ubuntu_packages_tar}` and the `passwd` layers in `//rs/rosetta-api/{icp,icrc1}` and `//rs/tests/httpbin-rs`. For `sh`, `awk` and the `passwd` targets, `tar.bzl`'s `tar` writes the `mtree` with `bazel_lib`'s `expand_template`, and those actions would switch to `aspect_bazel_lib`'s `expand_template` binary as well. That alone would be harmless today. But `bazel_lib` 3.8.0 ([bazel-contrib/bazel-lib#1310](bazel-contrib/bazel-lib#1310)) passes `copy_to_directory`'s arguments in a params file, which `aspect_bazel_lib`'s binary doesn't accept. So once any module brings in `bazel_lib` >= 3.8.0, every one of those `CopyToDirectory` actions fails, and with them every C/C++/Rust build. This is [bazel-contrib/bazel-lib#1312](bazel-contrib/bazel-lib#1312). The latest releases of our direct dependencies ask for at most `bazel_lib` 3.2.2, so this would only bite later. Upstream fixed dfinity#1312 on its 2.x branch with [bazel-contrib/bazel-lib#1313](bazel-contrib/bazel-lib#1313), merged on 2026-11-14. No release has it yet: 2.22.5 is still the latest 2.x release. dfinity#1313 removes only the `copy_directory`, `copy_to_directory` and `coreutils` registrations, which covers the switch in the release artifacts but not the one in the images. This patch also removes the `expand_template` and `bsd_tar` registrations. That keeps the image targets above on the toolchains they use on master, and all five aliased types resolve the same way. With the patch, each aliased type resolves to the toolchains of the module that defines it: - The build graph of the release artifacts resolves exactly the toolchains it does on master. - The `tar.bzl` and `rules_distroless` targets above keep `tar.bzl`'s bsdtar and `bazel_lib`'s `expand_template`, as on master. - `rules_oci` 2.0.0's `oci_image` and `oci_load`, and our `expand_template`, ask for `aspect_bazel_lib`'s alias types. So they now get `tar.bzl`'s bsdtar and `bazel_lib`'s coreutils (0.5.0) and `expand_template`. On master they get `aspect_bazel_lib`'s bsdtar 3.7.9 and coreutils 0.0.27. - Both sets of toolchains provide the same fields (`tarinfo.binary`, `coreutils_info.bin`, `expand_template_info.bin`, `copy_to_directory_info.bin`). The `expand_template`, `copy_directory` and `copy_to_directory` Go tools of `aspect_bazel_lib` 2.22.5 and `bazel_lib` 3.2.2 are built from the same `main.go` files. Only their shared helper package differs: `bazel_lib`'s also tries reflink copies on Linux. The outputs are byte-identical (see Verification). ## Upstream changes that touch our setup - Toolchain aliases: `tar` ([dfinity#1153](bazel-contrib/bazel-lib#1153), 2.21.1), and `copy_directory`, `copy_to_directory`, `coreutils` and `expand_template` ([dfinity#1216](bazel-contrib/bazel-lib#1216), 2.22.0). See above. - `aspect_bazel_lib`'s own bsdtar moves from 3.7.9 to 3.8.1 ([dfinity#1126](bazel-contrib/bazel-lib#1126), 2.20.0), and its coreutils from 0.0.27 to 0.1.0 ([dfinity#1136](bazel-contrib/bazel-lib#1136), 2.21.0). With the patch, nothing in our build uses these two any more. - `expand_template` now adds the runfiles of its `data` to its own ([dfinity#1171](bazel-contrib/bazel-lib#1171), 2.21.2). Our two `expand_template` targets, `//rs/rosetta-api/{icp,icrc1}:stamped`, have no `data`. - `copy_directory`, `copy_to_directory`, `copy_file` and `copy_to_bin` now forward to `bazel_lib`'s implementations ([dfinity#1229](bazel-contrib/bazel-lib#1229), [dfinity#1233](bazel-contrib/bazel-lib#1233), 2.22.4 and 2.22.5). We don't use them directly, only through `rules_oci`. - Not relevant for us: jq stays 1.7, and zstd stays 1.5.6 (the same binaries from a new URL). yq moves to 4.45.2, but nothing in our build uses `aspect_bazel_lib`'s yq toolchain. ## Verification All in the dev container: - `bazel mod graph`: compared with master, only `aspect_bazel_lib` changes (2.19.3 → 2.22.5). There are no new warnings; the existing `rules_qemu` `use_repo` warning is unchanged. - **After merging master**: dfinity#12150, dfinity#12152 and dfinity#12154 changed the `bazel_skylib`, `rules_shell` and `buildifier_prebuilt` lines around this PR's `aspect_bazel_lib` bump. The merge keeps master's versions of those three and this PR's `aspect_bazel_lib` 2.22.5 with its comment and override. Against master, `bazel mod graph` still changes only `aspect_bazel_lib`. `bazel mod explain aspect_bazel_lib --verbose` lists only the root module and `rules_oci` 2.0.0 (asking for 2.7.2), so no module asks for a newer version that the pin would override. `bazel build //... --nobuild` analyzes all 3389 targets, and `bazel run //:buildifier` changes nothing. - `bazel build //... --nobuild`: all 3387 targets analyze. - Linter job: `//pre-commit:{shfmt-check,ruff-check,buf-check,DFINITY-capitalization-check,do-not-merge-check,buildifier-check,gazelle-check,buf-breaking-check}` pass. `buildifier-fix`, `shfmt-fix`, `ruff-fix` and `//:gazelle` leave the tree clean. - Toolchain resolution: for the release targets below, `bazel cquery 'deps(...)'` returns the same 110,935 configured targets as on master, with the same toolchain targets. `aspect_bazel_lib` isn't among them. Without the patch, the `coreutils` and `copy_to_directory` toolchains switch to `aspect_bazel_lib`'s, as described above. - **Release artifacts are byte-identical.** I built `//publish/binaries:bundle`, `//publish/canisters:bundle` and the unstamped IC-OS bundles that `ci/container/build-ic.sh --icos` builds (GuestOS prod disk and update, GuestOS recovery update, HostOS prod update, SetupOS prod). All 133 output files have the same SHA-256 as a build of master at c712eb2. No sandboxed action ran: apart from 26 actions that run unsandboxed (`local`), every action was a cache hit. - **The targets that use `aspect_bazel_lib`, or its toolchains through `rules_oci`, produce byte-identical outputs.** I built these 21 targets, which cover every kind of use, with 2.19.3 and with this PR in the same output base. Both builds produce the same 77 files, and the 4 OCI layout directories have the same structure and file modes: - `//rs/tests:{sh,awk}` (`tar`) - `//rs/tests:{ca_certificates,dpkg_status,passwd,ubuntu_packages_tar}` (`rules_distroless`) - the OCI images and `oci_load` tarballs `//rs/tests:{ubuntu_test_runtime_image_src,ubuntu_test_runtime.tar,static-file-server.tar,minica.tar}`, `//rs/tests/httpbin-rs:{httpbin_image_src,httpbin.tar}`, `//rs/rosetta-api/icp:{rosetta_image,rosetta_image.tar}` and `//rs/rosetta-api/icrc1:{ic_icrc_rosetta_image,icrc_rosetta_image.tar}` - `//rs/tests:colocate_uvm_config_image`, which packs the test-runtime image tarball - the Rosetta push scripts `//rs/rosetta-api/icp:push_rosetta_image` and `//rs/rosetta-api/icrc1:push_ic_icrc_rosetta_image` - their `:stamped` tag files, built both unstamped and with `--stamp --embed_label=...` (which `rosetta-release.yml` passes); with stamping, `expand_template` runs its toolchain's binary, now `bazel_lib`'s - I also diffed the `bazel aquery` action keys of everything these targets depend on, master against this PR. 58 of the 8,363 actions change, all of them `rules_oci` actions whose tools are now `bazel_lib`'s and `tar.bzl`'s: the 10 `OCIDescriptor` (`oci_image`) and 6 `OCITarball` (`oci_load`) actions, the 3 `CopyToDirectory` actions that lay out pulled base images, and the template and runfiles actions of their scripts. The images, tarballs and scripts they produce are among the identical files above. - Not built locally: the other `oci_load` tarballs of pulled images and the other UVM config images under `//rs/tests` (e.g. `bitcoind.tar`, `jaeger.tar`, `vector-with-log-fetcher.tar`, `ckbtc_uvm_config_image`). They use the same rules as `static-file-server.tar`, `minica.tar` and `colocate_uvm_config_image`. - Not run locally: the 476 tests that depend on these targets are all system tests under `//rs/tests`. CI runs them, along with the full build and test suite. The second commit changes only comments: the patch header and the `MODULE.bazel` comment above the override. After it, I re-ran: - The new patch applies with `patch -F0` (no offset or fuzz) to the `MODULE.bazel` that the BCR serves for 2.22.5. The result has the same SHA-256 as with the first commit's patch, and so does the `aspect_bazel_lib` `MODULE.bazel` that Bazel fetched. - `bazel mod graph` (depth 1 and full): the same output as before the commit, with no new warnings. `bazel mod explain aspect_bazel_lib --verbose` shows `[email protected] # (was 2.7.2, cause single_version_override)` under `rules_oci` 2.0.0. - I checked the pin's effect on newer requests in a scratch workspace whose root module asks for `aspect_bazel_lib` 2.7.2 and depends on `jq.bzl` 0.1.0, which asks for 2.8.1. With `single_version_override(version = "2.7.2")`, Bazel resolves 2.7.2 without a warning, and `mod explain --verbose` shows `(was 2.8.1, cause single_version_override)`. Without the override, it resolves 2.8.1 and warns that the root module asks for 2.7.2. - `bazel build //... --nobuild`: all 3387 targets analyze. The Linter-job checks pass, and the autofixes plus `//:buildifier` leave the tree clean. - `bazel cquery 'deps(...)'` returns the same 110,935 configured targets for the release targets, and the same 53,045 for the targets that use the module, as before the commit. `bazel aquery`: all 8,363 action keys in the deps of the 21 targets above are unchanged. So I didn't rebuild the release artifacts for this commit. ## Follow-ups - dfinity#12157 (`rules_oci` 2.3.5, which needs `aspect_bazel_lib` >= 2.21.1) is stacked on this PR, so it lands after it. - Once an `aspect_bazel_lib` 2.x release includes bazel-contrib/bazel-lib#1313, this patch no longer applies (its hunk fails against the 2.x branch). Then reduce it to the `expand_template` and `bsd_tar` registrations, as the TODO in the patch says, and keep the version pin. Dropping the patch instead would make the `tar` and `expand_template` types resolve to `aspect_bazel_lib`'s bsdtar and `expand_template`, including for the `tar.bzl` and `rules_distroless` targets above. - Possibly move our three direct uses of `aspect_bazel_lib` (`expand_template` in the two Rosetta packages, `tar` in `//rs/tests`) to `bazel_lib` and `tar.bzl`, its 3.x successors. `rules_oci` 2.x still depends on `aspect_bazel_lib`, though. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrades
buildifier_prebuiltfrom 8.2.0.2 to 10.2.0, its latest release. This moves buildifier itself from 8.2.0 to 10.2.0; buildtools has no 9.x release. Buildifier 10.2.0 formats our files exactly like 8.2.0, so no file is reformatted. It does add a default lint warning that would fail the CI Linter job. This PR turns that warning off in a new.buildifier.jsonat the repository root. Every buildifier run inside the checkout reads that file, so CI, the pre-commit targets and the VS Code integration all lint with the same warnings.Changes
MODULE.bazel: version bump. BCR'sbuildifier_prebuilt/10.2.0has no patches. Its newbazel_features1.45.0 requirement is already met by the 1.50.0 we resolve. Its other requirements (bazel_skylib1.3.0,platforms0.0.11,rules_shell0.6.1) are at or below what we already use. Inbazel mod graph, onlybuildifier_prebuiltitself changes..buildifier.json(new):{"warnings": "-make-location"}removesmake-locationfrom buildifier's default warnings (see below). Buildifier loads this file by itself. It looks in its working directory and the directories above it, and command-line flags override what the file sets. So the file applies to://bazel:buildifier(aliased as//:buildifierand//pre-commit:buildifier-fix) and//bazel:buildifier.check(aliased as//pre-commit:buildifier-check). Their runner changes to the workspace root before it runs buildifier..vscode/settings.jsonpointsbazel.buildifier.executableat@buildifier_prebuilt//:buildifier. The recommendedbazelbuild.vscode-bazelextension lints open BUILD and.bzlfiles withbazel run @buildifier_prebuilt//:buildifier -- --format=json --mode=check --path=<file> --lint=warn. It runs that from the VS Code workspace folder and passes no--warnings. In 10.2.0 that target runs buildifier from the directorybazel runwas started in (see below), so buildifier finds the file. Alint_warningsattribute on our two targets wouldn't reach this integration.It uses the
warningskey, notwarningsList. A--warningsflag replaceswarnings, but buildifier appendswarningsListto the flag's value. That fails when the flag lists categories without a+or-prefix, as--warnings=alldoes.bazel/BUILD.bazel: a comment next to the twobuildifiertargets. It says where their lint warnings are set, why there and not withlint_warnings, and whymake-locationis off, since JSON can't hold that comment.Upstream changes that touch our setup
New default lint warning
make-location. It was added for BUILD files in v10.0.1 (bazel-contrib/buildtools#1484) and extended to.bzlfiles in v10.2.0 (#1526). It flags every string that contains$(locationor$(locations, and buildifier can't fix it automatically. With only the version bump,//pre-commit:buildifier-checkreports 114 of these in 28 files, and nothing else.$(location)as a synonym for either$(execpath)or$(rootpath), depending on the attribute being expanded. Our uses are in genrule commands, rules_rustrustc_env/build_script_env, testenv, binaryargs, and strings that macros pass on to other rules. Each one needs its own check. A wrong choice still analyzes fine and only fails when the action or test runs..buildifier.json. Until then, the exclusion also hides new uses.The 28 files, with their number of findings and their code owners
bazel/canbench.bzlbazel/canisters.bzlbazel/defs.bzlbazel/download.bzlbazel/fuzz_testing.bzlbazel/inject_version_into_wasm_tests/BUILD.bazelbazel/mainnet-icos-images.bzlbazel/prost.bzlic-os/bootloader/BUILD.bazelic-os/components/conformance_tests/defs.bzlic-os/defs.bzlic-os/dev-tools/bare_metal_deployment/tools.bzlic-os/setupos/defs.bzlrs/bitcoin/ckbtc/minter/BUILD.bazelrs/ethereum/cketh/minter/BUILD.bazelrs/ledger_suite/icp/index/BUILD.bazelrs/ledger_suite/icrc1/index-ng/BUILD.bazelrs/nervous_system/patch_canister_did/defs.bzlrs/nervous_system/tools/sync-with-released-nervous-system-wasms/BUILD.bazelrs/nns/handlers/lifeline/impl/BUILD.bazelrs/nns/test_utils/golden_nns_state/BUILD.bazelrs/pocket_ic_server/BUILD.bazelrs/registry/admin/BUILD.bazelrs/tests/system_tests.bzlrs/universal_canister/impl/BUILD.bazelthird_party/BUILD.miracl-core.bazelthird_party/BUILD.pebble-challtestsrv.bazelthird_party/BUILD.pebble.bazelallowed-symbol-load-locations, the other new default warning (bazel-contrib/buildtools#1318, v8.5.1). It only checks symbols listed in a custom tables file. We don't passadd_tables, so it never fires.positional-argswas rewritten (bazel-contrib/buildtools#1393, v8.5.1). It now followsload()s to decide whether a called function is a rule or macro, and also checks nested calls. It finds nothing in our BUILD files.Formatter changes don't change any of our files:
bazel run //:buildifierwith 10.2.0 leaves the tree unchanged. They cover:visibility()arguments in.bzlfiles (#1452); we have novisibility()calls*.BUILD.bazelfiles (#1433), plusREPO.bazelandVENDOR.bazel; we have none of these filesThe runner script that
bazel runexecutes for our twobuildifiertargets changed in two ways. Neither changes the set of files buildifier checks..gitexclusion is now afind -pruneinstead of a! -pathfilter (keith/buildifier-prebuilt#127, #174).findnow hands the files to buildifier with-exec ... {} +instead of piping them toxargs, and also collects*.starfiles (#168). We have no*.starfiles, and a failing check still makes the target exit non-zero (see the probe below).The
@buildifier_prebuilt//:buildifierbinary target, which the VS Code integration runs, is now a bash script (keith/buildifier-prebuilt#162, 8.5.1.3).bazel runstarted buildifier in the target's runfiles tree.$BUILD_WORKING_DIRECTORY, the directorybazel runwas started in, and thenexecs buildifier with the same arguments.--pathset to the file's path relative to the workspace. So the working directory doesn't change which file gets checked. It does decide which.buildifier.jsonbuildifier finds.The exec platform of the
buildifierrule and of the binary target (keith/buildifier-prebuilt#124, 8.2.1; #146, 8.5.1.3).exec_compatible_with = HOST_CONSTRAINTS, and the binary target didn't constrain it.@bazel_tools//tools/test:default_test_toolchain_typeinstead, which ties the exec platform to the target platform.--host_platformand--platformsare both//:linux-glibc-2.31, so it still picks the host's binary (buildifier_linux_amd64in the dev container).Verification
All in the dev container:
bazel mod graph: onlybuildifier_prebuiltchanges (8.2.0.2 to 10.2.0).bazel_featuresstays at 1.50.0. The only warning is the existingrules_qemuuse_repoone.bazel run //pre-commit:buildifier-check:make-locationfindings in 28 files and no formatting diff.buildifier.jsonremoved, fails again with the same 114 findings, so the file is what turns the warning offbazel run //:buildifierwith 10.2.0 changes no files.--warnings(ARGS=('-mode=fix' '-v=false' '-lint=fix')andARGS=('-mode=diff' '-v=false' '-lint=warn')). Both contain\( -path './.git/*' \) -prune -o.bazel run @buildifier_prebuilt//:buildifier -- --format=json --mode=check --path=<file> --lint=warn < <file>) onrs/pocket_ic_server/BUILD.bazelandic-os/defs.bzl:.buildifier.jsonremoved: 38 and 17make-locationwarningsrs/: no warnings, so buildifier also finds the file from a subdirectory--warnings=all: 38make-locationand 25unsorted-dict-itemswarnings, so a--warningsflag still overrides the fileload()and a$(location)incmd:buildifier-checkfailed with a diff and aloadwarning, and nomake-locationwarning.buildifier-fixfixed both problems.buildifier-checkthen passed.ci-pr-only.yml):shfmt-check,ruff-check,buf-check,DFINITY-capitalization-check,do-not-merge-check,buildifier-check,gazelle-checkandbuf-breaking-check.buildifier-fix,shfmt-fix,ruff-fix,:rustfmtand:gazelle) leave the working tree unchanged.bazel build //... --nobuild: all 3387 targets analyze.buildifier_prebuiltis a dev dependency.bazel cquery 'deps(//ic-os/guestos/envs/prod:bundle-update + //publish/binaries:bundle)'returns 107,118 configured targets, and none of them comes from it. That output includes resolved toolchains, such as the Rust and Python ones..buildifier.json.bazel-test-arm64inci-main.yml, builds three//publish/binariestargets,//rs/...and//packages/..., and none of them uses the buildifier targets. On Linux, CI covers the full build and tests.🤖 Generated with Claude Code