Fetch third_party/node via CIPD Switches from using a GCS hook for third_party/node to a CIPD dependency. This is specifically being added to unblock some work related to running WebGPU CTS tests on all platforms in the gn_v2 recipe, but should also be a quality of life improvement for managing this dependency. The requested version remains unchanged, but should be easy to change in the future. The version that is currently used is >2 years old at this point. NOTE: Due to this switch, the paths on Linux and Mac have changed slightly since there is no longer an intermediate directory between //third_party/node/ and the actual package contents. However, because of caching on the bots, the old GCS-fetched data may persist for up to a week after this lands. As such, it is possible that failures will start occurring at a later point if the old paths are still used somewhere. If this occurs, it is likely better to fix the problematic paths instead of reverting this. Similarly, the GCS-fetched data will likely remain in local checkouts. This is not expected to cause any issues, but users can delete the contents of third_party/node/ and re-run "gclient sync" to remove it if desired. "gclient sync -D" does not appear to clean this up automatically. Bug: 441328362 Change-Id: I6fb587804a49cb63db3aa95bc23a16d763b89a33 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/262334 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org> Auto-Submit: Brian Sheedy <bsheedy@google.com>
diff --git a/DEPS b/DEPS index 9ab6635..72cb294 100644 --- a/DEPS +++ b/DEPS
@@ -26,11 +26,7 @@ # https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja 'dawn_ninja_version': 'version:3@1.12.1.chromium.4', 'dawn_go_version': 'version:2@1.21.3', - - 'node_darwin_arm64_sha': '864780996d3be6c9aca03f371a4bd672728f0a75', - 'node_darwin_x64_sha': '85ccc2202fd4f1615a443248c01a866ae227ba78', - 'node_linux_x64_sha': '46795170ff5df9831955f163f6966abde581c8af', - 'node_win_x64_sha': '2cb36010af52bc5e2a2d1e3675c10361c80d8f8d', + 'dawn_node_version': 'version:2@20.11.0', # GN variable required by //testing that will be output in the gclient_args.gni 'generate_location_tags': False, @@ -394,6 +390,18 @@ 'condition': 'dawn_node', }, + # Node binaries, when dawn_node or dawn_wasm is enabled + 'third_party/node': { + 'packages': [ + { + 'package': 'infra/3pp/tools/nodejs/${{platform}}', + 'version': Var('dawn_node_version'), + }, + ], + 'condition': 'dawn_node or dawn_wasm', + 'dep_type': 'cipd', + }, + # Upstream webgpu.h headers for testing purposes 'third_party/webgpu-headers/src': { 'url': '{chromium_git}/external/github.com/webgpu-native/webgpu-headers@53a87a3d8cb4c32ec026978ce003020741df6f53', @@ -633,59 +641,6 @@ '-o', 'build/util/LASTCHANGE'], }, - # Node binaries, when dawn_node or dawn_wasm is enabled - { - 'name': 'node_linux', - 'pattern': '.', - 'condition': '(dawn_node or dawn_wasm) and host_os == "linux"', - 'action': [ 'python3', - 'third_party/depot_tools/download_from_google_storage.py', - '--no_resume', - '--extract', - '--bucket', 'chromium-nodejs/20.11.0', - Var('node_linux_x64_sha'), - '-o', 'third_party/node/node-linux-x64.tar.gz', - ], - }, - { - 'name': 'node_mac_x64', - 'pattern': '.', - 'condition': '(dawn_node or dawn_wasm) and host_os == "mac" and host_cpu == "x64"', - 'action': [ 'python3', - 'third_party/depot_tools/download_from_google_storage.py', - '--no_resume', - '--extract', - '--bucket', 'chromium-nodejs/20.11.0', - Var('node_darwin_x64_sha'), - '-o', 'third_party/node/node-darwin-x64.tar.gz', - ], - }, - { - 'name': 'node_mac_arm64', - 'pattern': '.', - 'condition': '(dawn_node or dawn_wasm) and host_os == "mac" and host_cpu == "arm64"', - 'action': [ 'python3', - 'third_party/depot_tools/download_from_google_storage.py', - '--no_resume', - '--extract', - '--bucket', 'chromium-nodejs/20.11.0', - Var('node_darwin_arm64_sha'), - '-o', 'third_party/node/node-darwin-arm64.tar.gz', - ], - }, - { - 'name': 'node_win', - 'pattern': '.', - 'condition': '(dawn_node or dawn_wasm) and host_os == "win"', - 'action': [ 'python3', - 'third_party/depot_tools/download_from_google_storage.py', - '--no_resume', - '--bucket', 'chromium-nodejs/20.11.0', - Var('node_win_x64_sha'), - '-o', 'third_party/node/node.exe', - ], - }, - # Activate emsdk for WebAssembly builds { 'name': 'activate_emsdk',
diff --git a/scripts/dawn_node_cts/node_helpers.py b/scripts/dawn_node_cts/node_helpers.py index 0c83320..88a1b5a 100644 --- a/scripts/dawn_node_cts/node_helpers.py +++ b/scripts/dawn_node_cts/node_helpers.py
@@ -26,7 +26,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Helper code for running isolated versions of NodeJS.""" -import glob import functools import os @@ -42,16 +41,12 @@ Returns: A filepath to the standalone node executable. """ - paths = glob.glob(os.path.join('*', 'bin', 'node'), root_dir=NODE_DIR) - if not paths: + path = os.path.join(NODE_DIR, 'bin', 'node') + if not os.path.exists(path): raise RuntimeError( f'Unable to find the node binary under {NODE_DIR}. Is the ' f'dawn_node gclient variable set?') - if len(paths) > 1: - raise RuntimeError( - f'Found multiple node binaries when one is expected. Found: ' - f'{", ".join(paths)}') - return os.path.join(NODE_DIR, paths[0]) + return path @functools.cache @@ -62,20 +57,15 @@ A list of strings that will run "npm" when run as a command for a subprocess. """ - paths = glob.glob(os.path.join('*', 'lib', 'node_modules', 'npm', 'bin', - 'npm-cli.js'), - root_dir=NODE_DIR) - if not paths: + path = os.path.join(NODE_DIR, 'lib', 'node_modules', 'npm', 'bin', + 'npm-cli.js') + if not os.path.exists(path): raise RuntimeError( f'Unable to find the npm-cli.js file under {NODE_DIR}. Is the ' f'dawn_node gclient variable set?') - if len(paths) > 1: - raise RuntimeError( - f'Found multiple npm-cli.js files when one is expected. Found: ' - f'{", ".join(paths)}') cmd = [ get_node_path(), - os.path.join(NODE_DIR, paths[0]), + os.path.join(NODE_DIR, path), ] return cmd