Skip to content

Conversation

rdesgroppes
Copy link

@rdesgroppes rdesgroppes commented Sep 30, 2025

This change aims at making buildtools/buildifier more modular and easier to consume by enabling use of prebuilt binaries without having to pull in unnecessary dependencies - while strengthening upstream as the authoritative home for runner script templates.

Today, buildifier/BUILD.bazel exposes two different sets of rules:

  • exports for runner script templates (runner.bash.template, runner.bat.template) as well as README.md,
  • go build & sh test rules which require external repos (rules_go, rules_shell) even for consumers who don't need to build the buildifier binary.

It is worth noticing there are two distinct community efforts on runner scripts, the present/upstream bazelbuild/buildtools and the derived keith/buildifier-prebuilt (Bazel Central Registry module). These drift apart over time, leading to unsynchronized contents (factory.bzl, runner.bash.template) and efforts, e.g. on Windows support:

Intended benefits of this change:

  • decoupling: by moving go_binary and sh_test targets into buildifier/cmd, the top-level buildifier/BUILD.bazel no longer requires rules_go nor rules_shell,
  • flexibility: users can either build binaries from source (via //buildifier/cmd) or configure rules to use prebuilt binaries (e.g. via rules_multitool) while still consuming the same upstream runner script templates,
  • backward compatibility: aliases keep earlier //buildifier:buildifier* labels working by delegating to the corresponding //buildifier/cmd:buildifier*.

@rdesgroppes rdesgroppes force-pushed the export-buildifier-scripts-without-build-deps branch from 7028e17 to f376c5b Compare September 30, 2025 10:14
@rdesgroppes rdesgroppes marked this pull request as draft September 30, 2025 10:15
@rdesgroppes rdesgroppes force-pushed the export-buildifier-scripts-without-build-deps branch from f376c5b to 8914e45 Compare September 30, 2025 10:30
@rdesgroppes rdesgroppes marked this pull request as ready for review September 30, 2025 10:37
This change aims at making `buildtools/buildifier` more modular and
easier to consume by enabling use of prebuilt binaries without pulling
in unnecessary dependencies - while strengthening upstream as the
authoritative home for runner script templates.

Today, `buildifier/BUILD.bazel` exposes two different sets of rules:
- exports for runner script templates (`runner.bash.template`,
  `runner.bat.template`) as well as `README.md`,
- `go` build & `sh` test rules which require external repos (`rules_go`,
  `rules_shell`) even for consumers who don't need to build the
  `buildifier` binary.

It is worth noticing there are two distinct community efforts on runner
scripts, the present/upstream `bazelbuild/buildtools` and the derived
`keith/buildifier-prebuilt` (Bazel Central Registry module).
These drift apart over time, leading to unsynchronized contents
(`factory.bzl`, `runner.bash.template`) and efforts, e.g. on Windows
support:
- bazelbuild#1230
- keith/buildifier-prebuilt#89 (open for a year)

Intended benefits of this change:
- decoupling: by moving `go_binary` and `sh_test` targets into
  `buildifier/cmd`, the top-level `buildifier/BUILD.bazel` no longer
  requires `rules_go` nor `rules_shell`,
- flexibility: users can either build binaries from source (via
  `//buildifier/cmd`) or configure rules to use prebuilt binaries (e.g.
  via `multitool`) while still consuming the same upstream runner script
  templates,
- backward compatibility: aliases keep `//buildifier:buildifier*`
  working by delegating to `//buildifier/cmd:buildifier*`.
@rdesgroppes rdesgroppes force-pushed the export-buildifier-scripts-without-build-deps branch from 8914e45 to e72e822 Compare October 7, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant