Skip to content

Commit cc8eb54

Browse files
devversionandrewseguin
authored andcommitted
build: use formatting tool from shared dev-infra package (#19592)
Removes our custom script/buildifier configuration. We will be using the `ng-dev format` command that has builtin support for buildifier (e.g with configured rules). Also it allows us to format changed files The motiviation is that we don't need to maintain multiple buildifier configurations if there is one canonical one now available in the shared dev-infra package.
1 parent 7c59b35 commit cc8eb54

File tree

6 files changed

+14
-29
lines changed

6 files changed

+14
-29
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ var_20: &only_on_pull_requests_filter
141141
# -----------------------------
142142
# Container version of CircleCI
143143
# -----------------------------
144-
version: 2
144+
version: 2.1
145145

146146
# -----------------------------------------------------------------------------------------
147147
# Job definitions. Jobs which are defined just here, will not run automatically. Each job
@@ -309,7 +309,7 @@ jobs:
309309
bazel build //:entry_points_manifest
310310
yarn check-entry-point-setup $(bazel info bazel-bin)/entry_points_manifest.json
311311
312-
- run: ./scripts/circleci/lint-bazel-files.sh
312+
- run: yarn ng-dev format changed --check << pipeline.git.base_revision >>
313313
- run: yarn ownerslint
314314
- run: yarn stylelint
315315
- run: yarn tslint

.ng-dev/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import {format} from './format';
12
import {github} from './github';
23
import {merge} from './merge';
34

45
module.exports = {
56
github,
67
merge,
8+
format,
79
};

.ng-dev/format.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {FormatConfig} from '@angular/dev-infra-private/format/config';
2+
3+
/**
4+
* Configuration for the ng-dev format command. We currently only use the buildifier
5+
* formatter that is responsible for formatting Bazel build and `.bzl` files.
6+
*/
7+
export const format: FormatConfig = {
8+
buildifier: true,
9+
};

package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
"scripts": {
1616
"postinstall": "node tools/postinstall/apply-patches.js && ngcc --properties module main --create-ivy-entry-points && node tools/postinstall/update-ngcc-main-fields.js",
1717
"build": "node ./scripts/build-packages-dist.js",
18-
"bazel:buildifier": "find . -type f \\( -name \"*.bzl\" -or -name WORKSPACE -or -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs buildifier -v --warnings=attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,constant-glob,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,git-repository,http-archive,integer-division,load,load-on-top,native-build,native-package,output-group,package-name,package-on-top,redefined-variable,repository-name,same-origin-load,string-iteration,unused-variable,unsorted-dict-items,out-of-order-load",
19-
"bazel:format-lint": "yarn -s bazel:buildifier --lint=warn --mode=check",
2018
"dev-app": "ibazel run //src/dev-app:devserver",
2119
"test": "node ./scripts/run-component-tests.js",
2220
"test-local": "yarn -s test --local",
@@ -33,9 +31,7 @@
3331
"check-rollup-globals": "ts-node --project scripts/tsconfig.json scripts/check-rollup-globals.ts",
3432
"changelog": "ts-node --project tools/release/tsconfig.json tools/release/changelog.ts",
3533
"preinstall": "node ./tools/npm/check-npm.js",
36-
"format:ts": "git-clang-format HEAD $(git diff HEAD --name-only | grep -v \"\\.d\\.ts\")",
37-
"format:bazel": "yarn -s bazel:buildifier --lint=fix --mode=fix",
38-
"format": "yarn -s format:ts && yarn -s format:bazel",
34+
"format": "yarn ng-dev format changed",
3935
"cherry-pick-patch": "ts-node --project tools/cherry-pick-patch/tsconfig.json tools/cherry-pick-patch/cherry-pick-patch.ts",
4036
"ownerslint": "ts-node --project scripts/tsconfig.json scripts/ownerslint.ts",
4137
"tslint": "tslint -c tslint.json --project ./tsconfig.json",
@@ -111,7 +107,6 @@
111107
"axe-webdriverjs": "^1.1.1",
112108
"browser-sync": "^2.26.7",
113109
"chalk": "^2.4.2",
114-
"clang-format": "^1.2.4",
115110
"codelyzer": "^6.0.0-next.1",
116111
"conventional-changelog": "^3.0.5",
117112
"dgeni": "^0.4.11",

scripts/circleci/lint-bazel-files.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

yarn.lock

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,15 +3034,6 @@ cjson@^0.3.1:
30343034
dependencies:
30353035
json-parse-helpfulerror "^1.0.3"
30363036

3037-
clang-format@^1.2.4:
3038-
version "1.2.4"
3039-
resolved "https://registry.yarnpkg.com/clang-format/-/clang-format-1.2.4.tgz#4bb4b0a98180428deb093cf20982e9fc1af20b6c"
3040-
integrity sha512-sw+nrGUp3hvmANd1qF8vZPuezSYQAiXgGBiEtkXTtJnnu6b00fCqkkDIsnRKrNgg4nv6NYZE92ejvOMIXZoejw==
3041-
dependencies:
3042-
async "^1.5.2"
3043-
glob "^7.0.0"
3044-
resolve "^1.1.6"
3045-
30463037
class-utils@^0.3.5:
30473038
version "0.3.6"
30483039
resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463"

0 commit comments

Comments
 (0)