From 9fd2402321fcc11c10404c0ade7f088a50034645 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 16 Feb 2020 10:42:07 +0100 Subject: [PATCH] Move validation of `chromium/preferences_schema.json` to its own gulp task With the way that the `default_preferences.json` file is now generated at build time, the `gulp lint` task is now noticeably slower than before. This slowdown has been, and still is, somewhat annoying during the deployment of new ESLint rules. Hence this patch, which moves the `chromium/preferences_schema.json` validation from `gulp lint` and into a new `gulp lint-chromium` task instead. *Obviously* this new task is run as part of the `gulp npm-test` task, and thus through `npm test` on Node.js/Travis, such that it's still being tested as before. --- gulpfile.js | 73 ++++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 7a1ad9aa9..77a74a170 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1389,43 +1389,45 @@ gulp.task( }) ); +gulp.task("lint", function(done) { + console.log(); + console.log("### Linting JS files"); + + // Ensure that we lint the Firefox specific *.jsm files too. + var options = [ + "node_modules/eslint/bin/eslint", + "--ext", + ".js,.jsm", + ".", + "--report-unused-disable-directives", + ]; + var esLintProcess = startNode(options, { stdio: "inherit" }); + esLintProcess.on("close", function(code) { + if (code !== 0) { + done(new Error("ESLint failed.")); + return; + } + console.log("files checked, no errors found"); + done(); + }); +}); + gulp.task( - "lint", + "lint-chromium", gulp.series("default_preferences", function(done) { console.log(); - console.log("### Linting JS files"); + console.log("### Checking supplemental Chromium files"); - // Ensure that we lint the Firefox specific *.jsm files too. - var options = [ - "node_modules/eslint/bin/eslint", - "--ext", - ".js,.jsm", - ".", - "--report-unused-disable-directives", - ]; - var esLintProcess = startNode(options, { stdio: "inherit" }); - esLintProcess.on("close", function(code) { - if (code !== 0) { - done(new Error("ESLint failed.")); - return; - } - - console.log(); - console.log("### Checking supplemental files"); - - if ( - !checkChromePreferencesFile( - "extensions/chromium/preferences_schema.json", - "build/default_preferences.json" - ) - ) { - done(new Error("chromium/preferences_schema is not in sync.")); - return; - } - - console.log("files checked, no errors found"); - done(); - }); + if ( + !checkChromePreferencesFile( + "extensions/chromium/preferences_schema.json", + "build/default_preferences.json" + ) + ) { + done(new Error("chromium/preferences_schema is not in sync.")); + return; + } + done(); }) ); @@ -1838,5 +1840,8 @@ gulp.task("externaltest", function(done) { gulp.task( "npm-test", - gulp.series(gulp.parallel("lint", "externaltest"), "unittestcli") + gulp.series( + gulp.parallel("lint", "externaltest", "unittestcli"), + "lint-chromium" + ) );