Bug 1543519 - Add a build watcher. r=davidwalsh
authorJason Laster <jlaster@mozilla.com>
Thu, 11 Apr 2019 19:37:29 +0000
changeset 469086 180292b783d8528745c230035304b738471abb9c
parent 469085 38111dd15e5918deb47a449e4e4524d78b33424e
child 469087 dfe3306614fd22ab41a4a3e5b07609312ae32e79
push id35856
push usercsabou@mozilla.com
push dateFri, 12 Apr 2019 03:19:48 +0000
treeherdermozilla-central@940684cd1065 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidwalsh
bugs1543519
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1543519 - Add a build watcher. r=davidwalsh Differential Revision: https://phabricator.services.mozilla.com/D26998
devtools/client/debugger/bin/watch.js
devtools/client/debugger/package.json
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/bin/watch.js
@@ -0,0 +1,31 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
+
+var chokidar = require("chokidar");
+var shell = require("shelljs");
+var path = require("path");
+
+const geckoPath = path.join(__dirname, "../../../..");
+const srcPath = path.join(__dirname, "../src");
+function watch() {
+  console.log("Watching for src changes");
+  const watcher = chokidar.watch(srcPath);
+  let working = false;
+  watcher.on("change", filePath => {
+    const relPath = path.relative(srcPath, filePath);
+    console.log(`Updating ${relPath}`);
+    if (working) {
+      return;
+    }
+    working = true;
+    const start = new Date();
+
+    shell.exec(`cd ${geckoPath}; ./mach build faster; cd -;`, { silent: true });
+    working = false;
+    const end = Math.round((new Date() - start) / 1000);
+    console.log(`  Built in ${end}s`);
+  });
+}
+
+watch();
--- a/devtools/client/debugger/package.json
+++ b/devtools/client/debugger/package.json
@@ -30,17 +30,17 @@
     "mochih": "yarn mochi -- --headless --",
     "mochici": "mochii --mc ./firefox --ci --default-test-path devtools/client/debugger --headless --",
     "test": "TZ=Africa/Nairobi jest",
     "test:watch": "jest --watch",
     "test:coverage": "yarn test --coverage",
     "test:all": "yarn test; yarn lint; yarn flow",
     "firefox": "start-firefox --start --location https://firefox-devtools.github.io/debugger-examples/",
     "chrome": "start-chrome --location https://firefox-devtools.github.io/debugger-examples/",
-    "watch": "node bin/copy --watch --symlink",
+    "watch": "node bin/watch",
     "copy": "node bin/copy --assets",
     "flow-coverage": "flow-coverage-report --threshold 50 -i 'src/actions/*.js' -i 'src/reducers/*.js' -i 'src/utils/*.js' -i 'src/components/*.js' -i 'src/components/**/*.js' -t html -t text",
     "flow-utils": "flow-coverage-report -i 'src/utils/*.js' -i 'src/utils/**/*.js' -t text",
     "flow-redux": "flow-coverage-report  -i 'src/reducers/*.js' -i 'src/actions/*.js'  -t text",
     "flow-react": "flow-coverage-report -i 'src/components/**/*.js' -t text",
     "nom": "node bin/nom",
     "diff": "node bin/diff",
     "install": "prettier --write package.json"