-
Notifications
You must be signed in to change notification settings - Fork 458
Closed
Description
Angular development now requires a buildifier check: https://github.com/angular/angular/blob/ef534c0cc16b4fd3a4c721f814e5530d63cd6642/.circleci/config.yml#L31
Here are notes from setting this up and the problems we are running into
/cc @mhevery
This doesn't work well for a few reasons:
- developers need to install buildifier on their machines, but it needs to match the version of buildifier run on the CI
- when a change is not formatted, it's hard to both fail the CI, and indicate what changes buildifier expects because
--mode=diffexits 0 even if there's a delta, and it doesn't repeat file names - windows developers don't have the
findcommand indicated here - developers shouldn't need to think about running buildifier
Here's how I'd like it to work:
- In
WORKSPACEadd agit_repositorypointing here. Thetagorcommitensures all developers and CI get the same buildifier version. - Now I can
bazel run @com_github_bazelbuild_buildtools//buildifierbut it uses the runfiles directory, it shouldcdback to the workspace root - I'd like to have a shorter command for developers, it should be possible to add a simple build rule in my project so I can just
bazel run :buildifier(similar to how Gazelle is setup) - The buildifier rule could also have an implicit output so we could
bazel run :buildifier.checkon CI --mode=diffshould exit non-zero if there's a delta, workaround is to run diff followed by check--mode=diffneeds to echo filenames, otherwise you just get anonymous patches like https://circleci.com/gh/angular/angular/26772- We should document this setup, along with a git pre-commit hook so all changes to BUILD files get fixed without any effort
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels