From a53a559f5ad61dfce21d36a857504cc4e23ffac3 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Thu, 13 Sep 2018 09:18:28 -0700 Subject: [PATCH] ci: use locally built skylint and buildifier (#25917) PR Close #25917 --- .circleci/config.yml | 9 ++++----- package.json | 1 + tools/ngcontainer/Dockerfile | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 712c9a14ee..0786abfc35 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,19 +42,18 @@ version: 2 jobs: lint: <<: *job_defaults + resource_class: xlarge steps: - checkout: <<: *post_checkout + - run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc # 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=check $(find . -type f \( -name "*.bzl" -or -name BUILD.bazel -or -name BUILD \)) || + - run: 'yarn buildifier -mode=check || (echo "BUILD files not formatted. Please run ''yarn buildifier''" ; exit 1)' # Run the skylark linter to check our Bazel rules - # deprecated-api is disabled because we use actions.new_file(genfiles_dir) - # which has no replacement, see https://github.com/bazelbuild/bazel/issues/4858 - - run: 'find . -type f -name "*.bzl" | - xargs java -jar /usr/local/bin/Skylint_deploy.jar --disable-checks=deprecated-api || + - run: 'yarn skylint || (echo -e "\n.bzl files have lint errors. Please run ''yarn skylint''"; exit 1)' - restore_cache: diff --git a/package.json b/package.json index 287785f3a7..170551525b 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ }, "scripts": { "preskylint": "bazel build --noshow_progress @io_bazel//src/tools/skylark/java/com/google/devtools/skylark/skylint:Skylint", + "//": "deprecated-api is disabled because we use actions.new_file(genfiles_dir) which has no replacement, see https://github.com/bazelbuild/bazel/issues/4858", "skylint": "find . -type f -name \"*.bzl\" ! -path \"*/node_modules/*\" ! -path \"./dist/*\" | xargs $(bazel info bazel-bin)/external/io_bazel/src/tools/skylark/java/com/google/devtools/skylark/skylint/Skylint --disable-checks=deprecated-api", "prebuildifier": "bazel build --noshow_progress @com_github_bazelbuild_buildtools//buildifier", "buildifier": "find . -type f \\( -name \"*.bzl\" -or -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/*/buildifier", diff --git a/tools/ngcontainer/Dockerfile b/tools/ngcontainer/Dockerfile index 6b3c4bb322..a3aca664c6 100644 --- a/tools/ngcontainer/Dockerfile +++ b/tools/ngcontainer/Dockerfile @@ -23,6 +23,7 @@ RUN echo "deb http://deb.debian.org/debian stretch main contrib" > /etc/apt/sour ### # Buildifier +# TODO(alexeagle): remove this when all users use their locally built buildifier # BUILD file formatter # 'bazel clean --expunge' conserves size of the image RUN git clone https://github.com/bazelbuild/buildtools.git \ @@ -34,6 +35,7 @@ RUN git clone https://github.com/bazelbuild/buildtools.git \ ### # Skylint +# TODO(alexeagle): remove this when all users use their locally built skylint # .bzl file linter # Follows readme at https://github.com/bazelbuild/bazel/blob/master/site/docs/skylark/skylint.md#building-the-linter # 'bazel clean --expunge' conserves size of the image