[npm] Fix `npm run build` and `npm start`.
Our scripting relied on (seemingly) unsupported (direct) use of various
wrapper scripts in our `DEPS`ed `depot_tools`. With this change, we're
now independent of these wrapper scripts and invoke the python scripts
directly.
Also update the `package.json` scripts to use the `DEPS`ed `vpython3`
instead of relying on having some global `depot_tools` in your PATH.
And finally properly terminate `npm start` when the build step fails,
and fix the spinner when using `npm run build` in watch(only) mode.
Bug: none
Change-Id: I820a0479088c0021d6e0f39c8a79df9e6a18db15
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6486632
Reviewed-by: Nikolay Vitkov <[email protected]>
Auto-Submit: Benedikt Meurer <[email protected]>
diff --git a/scripts/devtools_build.mjs b/scripts/devtools_build.mjs
index 9062fa3..e6b794e 100644
--- a/scripts/devtools_build.mjs
+++ b/scripts/devtools_build.mjs
@@ -9,9 +9,10 @@
import util from 'node:util';
import {
- autoninjaExecutablePath,
- gnExecutablePath,
+ autoninjaPyPath,
+ gnPyPath,
rootPath,
+ vpython3ExecutablePath,
} from './devtools_paths.js';
const execFile = util.promisify(childProcess.execFile);
@@ -220,8 +221,8 @@
if (!outDirStat?.isDirectory()) {
// Use GN to (optionally create and) initialize the |outDir|.
try {
- const gnExe = gnExecutablePath();
- const gnArgs = ['-q', 'gen', outDir];
+ const gnExe = vpython3ExecutablePath();
+ const gnArgs = [gnPyPath(), '-q', 'gen', outDir];
await execFile(gnExe, gnArgs);
} catch (cause) {
throw new BuildError(BuildStep.GN, {cause, outDir, target});
@@ -242,8 +243,8 @@
// since we might be running in a full Chromium checkout and certainly don't
// want to build all of Chromium first.
try {
- const autoninjaExe = autoninjaExecutablePath();
- const autoninjaArgs = ['-C', outDir, 'devtools_all_files'];
+ const autoninjaExe = vpython3ExecutablePath();
+ const autoninjaArgs = [autoninjaPyPath(), '-C', outDir, 'devtools_all_files'];
await execFile(autoninjaExe, autoninjaArgs, {signal});
} catch (cause) {
if (cause.name === 'AbortError') {