From d3d932a750cc00afe08f402d9cd2f64edff9e4e6 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Wed, 15 Jan 2025 10:17:03 -0800 Subject: [PATCH] Add way to make debug build Also, add logging. You can do this with ``` DEBUG=* npm build ``` or windows ``` set DEBUG=* npm build ``` --- build/build.js | 4 ++-- build/execute.js | 3 +++ package-lock.json | 1 + package.json | 1 + third_party/dawn | 2 +- third_party/depot_tools | 2 +- 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build/build.js b/build/build.js index e62c72a..0ab865e 100644 --- a/build/build.js +++ b/build/build.js @@ -3,7 +3,7 @@ import fs from 'node:fs'; import {execute} from './execute.js'; import {addElemIf, appendPathIfItExists, prependPathIfItExists} from './utils.js'; - + //const __dirname = dirname(fileURLToPath(import.meta.url)); const cwd = process.cwd(); const depotToolsPath = path.join(cwd, 'third_party', 'depot_tools'); @@ -32,7 +32,7 @@ async function buildDawnNode() { ...addElemIf(!isWin, '-GNinja'), '-DDAWN_BUILD_NODE_BINDINGS=1', '-DDAWN_USE_X11=OFF', - '-DCMAKE_BUILD_TYPE=Release', + `-DCMAKE_BUILD_TYPE=${process.env.CMAKE_BUILD_TYPE ?? 'Release'}`, ...addElemIf(isWin, '-DCMAKE_SYSTEM_VERSION=10.0.26100.0'), ...addElemIf(isMac, '-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'), ]); diff --git a/build/execute.js b/build/execute.js index bde4a05..bdeb0bf 100644 --- a/build/execute.js +++ b/build/execute.js @@ -1,7 +1,10 @@ import {spawn} from 'child_process'; +import DEBUG from 'debug'; +const debug = DEBUG('execute'); export function execute(cmd, args, options) { return new Promise((resolve, reject) => { + debug(`${cmd} ${args.join(' ')}`); const proc = spawn(cmd, args, {...options || {}, shell: true, stdio: 'inherit'}); proc.on('close', function(code) { const result = {exitCode: code}; diff --git a/package-lock.json b/package-lock.json index 8a57782..8344e3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.2.1", "license": "MIT", "devDependencies": { + "debug": "^4.4.0", "mocha": "^11.0.1" } }, diff --git a/package.json b/package.json index 0c32f5e..af25ea6 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "index.js" ], "devDependencies": { + "debug": "^4.4.0", "mocha": "^11.0.1" } } diff --git a/third_party/dawn b/third_party/dawn index cf1b10b..8dfcfd1 160000 --- a/third_party/dawn +++ b/third_party/dawn @@ -1 +1 @@ -Subproject commit cf1b10b81c4305dc9daca07422aad494f8351ef4 +Subproject commit 8dfcfd16ab65d1cab205bb189ee09a22f41ca7c6 diff --git a/third_party/depot_tools b/third_party/depot_tools index 24d9ad6..1dd73cd 160000 --- a/third_party/depot_tools +++ b/third_party/depot_tools @@ -1 +1 @@ -Subproject commit 24d9ad69facfe9f73b542e434f47881a5caa1db4 +Subproject commit 1dd73cd467bb8526d6fdebfadf9a379a9e50bf34