ci: print the buildifier command when BUILD lint fails (#20882)

PR Close #20882
This commit is contained in:
Alex Eagle 2017-12-07 19:17:13 -08:00 committed by Jason Aden
parent 13e663c232
commit 77a1f9f2e8
3 changed files with 28 additions and 2 deletions

View File

@ -11,7 +11,11 @@
anchor_1: &job_defaults
working_directory: ~/ng
docker:
## IMPORTANT
# If you change this, also change the version of com_github_bazelbuild_buildtools
# in the /WORKSPACE file
- image: angular/ngcontainer:0.0.7
## IMPORTANT
# After checkout, rebase on top of master.
# Similar to travis behavior, but not quite the same.
@ -28,8 +32,8 @@ jobs:
<<: *post_checkout
# Check BUILD.bazel formatting before we have a node_modules directory
# Then we don't need any exclude pattern to avoid checking those files
- run: buildifier -mode=diff $(find . -iname BUILD.bazel -type f)
- run: buildifier -mode=check $(find . -iname BUILD.bazel -type f)
- run: 'buildifier -mode=check $(find . -type f \( -name BUILD.bazel -or -name BUILD \)) ||
(echo "BUILD files not formatted. Please run ''yarn buildifier''" ; exit 1)'
- restore_cache:
key: angular-{{ .Branch }}-{{ checksum "yarn.lock" }}

View File

@ -31,3 +31,24 @@ local_repository(
name = "rxjs",
path = "node_modules/rxjs/src",
)
git_repository(
name = "com_github_bazelbuild_buildtools",
remote = "https://github.com/bazelbuild/buildtools.git",
# Note, this commit matches the version of buildifier in angular/ngcontainer
# If you change this, also check if it matches the version in the angular/ngcontainer
# version in /.circleci/config.yml
commit = "b3b620e8bcff18ed3378cd3f35ebeb7016d71f71",
)
http_archive(
name = "io_bazel_rules_go",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.7.1/rules_go-0.7.1.tar.gz",
sha256 = "341d5eacef704415386974bc82a1783a8b7ffbff2ab6ba02375e1ca20d9b031c",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()

View File

@ -16,6 +16,7 @@
"url": "https://github.com/angular/angular.git"
},
"scripts": {
"buildifier": "bazel build @com_github_bazelbuild_buildtools//buildifier && find . -type f \\( -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/buildifier",
"preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/')\"",
"postinstall": "webdriver-manager update --gecko false",
"check-env": "gulp check-env"