build: migrate bazel related formatting/linting to ng-dev format (#36842)

Migrates away from inline searching for files and running buildifier
directly, instead using ng-dev for formatting.  Additionally, provides
a deprecation message for any usages of the previous commands.

PR Close #36842
This commit is contained in:
Joey Perrott 2020-04-28 12:32:06 -07:00 committed by Alex Rickabaugh
parent 2cb5f59acc
commit 297dab845d
4 changed files with 7 additions and 13 deletions

View File

@ -272,12 +272,6 @@ jobs:
- custom_attach_workspace
- init_environment
- run: 'yarn bazel:format -mode=check ||
(echo "BUILD files not formatted. Please run ''yarn bazel:format''" ; exit 1)'
# Run the skylark linter to check our Bazel rules
- run: 'yarn bazel:lint ||
(echo -e "\n.bzl files have lint errors. Please run ''yarn bazel:lint-fix''"; exit 1)'
- run: yarn -s tslint
- run: yarn -s ng-dev format changed $CI_GIT_BASE_REVISION --check
- run: yarn -s ts-circular-deps:check

View File

@ -45,8 +45,8 @@
]
},
"format": {
"matchers": {
"jsTs": [
"clang-format": {
"matchers": [
"dev-infra/**/*.{js,ts}",
"packages/**/*.{js,ts}",
"!packages/zone.js",
@ -66,6 +66,7 @@
"!**/built/**",
"!shims_for_IE.js"
]
}
},
"buildifier": true
}
}

View File

@ -62,7 +62,6 @@ export function buildFormatParser(localYargs: yargs.Argv) {
console.warn(` yarn ng-dev format --help`);
console.warn();
console.warn(`For more on the rationale and effects of this deprecation visit:`);
// TODO(josephperrott): Update this PR to the correct URL.
console.warn(` https://github.com/angular/angular/pull/36842#issue-410321447`);
});
}

View File

@ -16,9 +16,9 @@
"url": "https://github.com/angular/angular.git"
},
"scripts": {
"bazel:format": "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,positional-args,redefined-variable,repository-name,same-origin-load,string-iteration,unused-variable",
"bazel:lint": "yarn bazel:format --lint=warn",
"bazel:lint-fix": "yarn bazel:format --lint=fix",
"bazel:format": "yarn -s ng-dev format deprecation-warning bazel:format",
"bazel:lint": "yarn -s ng-dev format deprecation-warning bazel:lint",
"bazel:lint-fix": "yarn -s ng-dev format deprecation-warning bazel:lint-fix",
"preinstall": "node tools/yarn/check-yarn.js",
"postinstall": "node scripts/webdriver-manager-update.js && node --preserve-symlinks --preserve-symlinks-main ./tools/postinstall-patches.js",
"check-env": "gulp check-env",