From 850390174677216eb9c85120b1e44386421f53ed Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Wed, 26 Jun 2019 21:09:32 +0300 Subject: [PATCH] build: downgrade `gulp-clang-format` to 1.0.23 (#31295) The `gulp format*` tasks have been broken since 5eb742621. These include the `gulp format:enforce` task, which is what runs on CI to enforce consistent code style. Here is what (I believe) happened: - I assume formatting was failing in 5eb742621 (moving `zone.js` into `angular/angular`). The reason must have been that [this glob pattern][1] matches `packages/zone.js/` (which is a directory) and passes it to `clang-format` claiming it is a file. - I further assume that in an attempt to fix the issue, `gulp-clang-format` was updated to the latest version (1.0.27) in 5eb742621. - `gulp format:enforce` stopped complaining, so everyone thought formatting was fine and moved on. - Formatting still wasn't fine, but the task completed successfully nevertheless :scream: - The reason is that angular/gulp-clang-format@55b697c5c (and subsequent commits) changed the way the `done()` callback was called, leaving it to `clang-format` to call it (while previously it was also called when the associated stream ended). - In the old version of `clang-format` that we are using (1.0.41), there is a bug (which has been fixed in angular/clang-format@4cce2c4ee): The callback is not called [unless the process exits with an error][2]. One can also see that the `gulp format:enforce` task is not completed in `gulp lint`. Example output from [build 374722][3]: ``` yarn gulp lint ... Starting 'format:enforce'... Starting 'validate-commit-messages'... ... Finished 'validate-commit-messages' after 833 ms Starting 'tools:build'... Finished 'tools:build' after 1.75 s Starting 'tslint'... Finished 'tslint' after 19 s Done in 21.82s. ``` Notice that all tasks have a corresponding "Finished X` log, except for `format:enforce`. For reference: The problem was originally reported by @ocombe on Slack ([discussion][4]). --- This commit fixes the issue by downgrading `gulp-clang-format` to 1.0.23. The linting failures due to formatting issues will be addressed in subsequent commits. [1]: https://github.com/angular/angular/blob/a8f3b317f/tools/gulp-tasks/format.js#L13 [2]: https://github.com/angular/clang-format/blob/b8c7df0b7/index.js#L95 [3]: https://circleci.com/gh/angular/angular/374722 [4]: https://angular-team.slack.com/archives/C042EU9T5/p1561480241191000 PR Close #31295 --- package.json | 2 +- yarn.lock | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index dc4db79c5a..97231fedba 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "firefox-profile": "1.0.3", "glob": "7.1.2", "gulp": "3.9.1", - "gulp-clang-format": "1.0.27", + "gulp-clang-format": "1.0.23", "gulp-connect": "5.0.0", "gulp-conventional-changelog": "^2.0.3", "gulp-filter": "^5.1.0", diff --git a/yarn.lock b/yarn.lock index a4bb03d8f9..c4df17ddbe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5034,17 +5034,18 @@ gtoken@^2.3.0: mime "^2.2.0" pify "^4.0.0" -gulp-clang-format@1.0.27: - version "1.0.27" - resolved "https://registry.yarnpkg.com/gulp-clang-format/-/gulp-clang-format-1.0.27.tgz#c89716c26745703356c4ff3f2b0964393c73969e" - integrity sha512-Jj4PGuNXKdqVCh9fijvL7wdzma5TQRJz1vv8FjOjnSkfq3s/mvbdE/jq+5HG1c/q+jcYkXTEGkYT3CrdnJOLaQ== +gulp-clang-format@1.0.23: + version "1.0.23" + resolved "https://registry.yarnpkg.com/gulp-clang-format/-/gulp-clang-format-1.0.23.tgz#fe258586b83998491e632fc0c4fc0ecdfa10c89f" + integrity sha1-/iWFhrg5mEkeYy/AxPwOzfoQyJ8= dependencies: clang-format "^1.0.32" - fancy-log "^1.3.2" gulp-diff "^1.0.0" - plugin-error "^1.0.1" + gulp-util "^3.0.4" + pkginfo "^0.3.0" stream-combiner2 "^1.1.1" - through2 "^2.0.3" + stream-equal "0.1.6" + through2 "^0.6.3" gulp-connect@5.0.0: version "5.0.0" @@ -5113,7 +5114,7 @@ gulp-tslint@8.1.2: map-stream "~0.0.7" through "~2.3.8" -gulp-util@^3.0.0, gulp-util@^3.0.6, gulp-util@~3.0.8: +gulp-util@^3.0.0, gulp-util@^3.0.4, gulp-util@^3.0.6, gulp-util@~3.0.8: version "3.0.8" resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" integrity sha1-AFTh50RQLifATBh8PsxQXdVLu08= @@ -8576,7 +8577,7 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= -pkginfo@0.3.x: +pkginfo@0.3.x, pkginfo@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.3.1.tgz#5b29f6a81f70717142e09e765bbeab97b4f81e21" integrity sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE= @@ -10383,6 +10384,11 @@ stream-each@^1.1.0: end-of-stream "^1.1.0" stream-shift "^1.0.0" +stream-equal@0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/stream-equal/-/stream-equal-0.1.6.tgz#cc522fab38516012e4d4ee47513b147b72359019" + integrity sha1-zFIvqzhRYBLk1O5HUTsUe3I1kBk= + stream-events@^1.0.1, stream-events@^1.0.3: version "1.0.5" resolved "https://registry.yarnpkg.com/stream-events/-/stream-events-1.0.5.tgz#bbc898ec4df33a4902d892333d47da9bf1c406d5" @@ -10752,7 +10758,7 @@ through2@2.0.1: readable-stream "~2.0.0" xtend "~4.0.0" -through2@^0.6.1: +through2@^0.6.1, through2@^0.6.3: version "0.6.5" resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48" integrity sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=