Skip to content

Commit 49e13f1

Browse files
bsheedy-workDawn LUCI CQ
authored andcommitted
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 <[email protected]> Commit-Queue: Kai Ninomiya <[email protected]> Auto-Submit: Brian Sheedy <[email protected]>
1 parent fe41c8b commit 49e13f1

File tree

2 files changed

+20
-75
lines changed

2 files changed

+20
-75
lines changed

DEPS

Lines changed: 13 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ vars = {
2626
# https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja
2727
'dawn_ninja_version': 'version:[email protected]',
2828
'dawn_go_version': 'version:[email protected]',
29-
30-
'node_darwin_arm64_sha': '864780996d3be6c9aca03f371a4bd672728f0a75',
31-
'node_darwin_x64_sha': '85ccc2202fd4f1615a443248c01a866ae227ba78',
32-
'node_linux_x64_sha': '46795170ff5df9831955f163f6966abde581c8af',
33-
'node_win_x64_sha': '2cb36010af52bc5e2a2d1e3675c10361c80d8f8d',
29+
'dawn_node_version': 'version:[email protected]',
3430

3531
# GN variable required by //testing that will be output in the gclient_args.gni
3632
'generate_location_tags': False,
@@ -394,6 +390,18 @@ deps = {
394390
'condition': 'dawn_node',
395391
},
396392

393+
# Node binaries, when dawn_node or dawn_wasm is enabled
394+
'third_party/node': {
395+
'packages': [
396+
{
397+
'package': 'infra/3pp/tools/nodejs/${{platform}}',
398+
'version': Var('dawn_node_version'),
399+
},
400+
],
401+
'condition': 'dawn_node or dawn_wasm',
402+
'dep_type': 'cipd',
403+
},
404+
397405
# Upstream webgpu.h headers for testing purposes
398406
'third_party/webgpu-headers/src': {
399407
'url': '{chromium_git}/external/github.com/webgpu-native/webgpu-headers@53a87a3d8cb4c32ec026978ce003020741df6f53',
@@ -633,59 +641,6 @@ hooks = [
633641
'-o', 'build/util/LASTCHANGE'],
634642
},
635643

636-
# Node binaries, when dawn_node or dawn_wasm is enabled
637-
{
638-
'name': 'node_linux',
639-
'pattern': '.',
640-
'condition': '(dawn_node or dawn_wasm) and host_os == "linux"',
641-
'action': [ 'python3',
642-
'third_party/depot_tools/download_from_google_storage.py',
643-
'--no_resume',
644-
'--extract',
645-
'--bucket', 'chromium-nodejs/20.11.0',
646-
Var('node_linux_x64_sha'),
647-
'-o', 'third_party/node/node-linux-x64.tar.gz',
648-
],
649-
},
650-
{
651-
'name': 'node_mac_x64',
652-
'pattern': '.',
653-
'condition': '(dawn_node or dawn_wasm) and host_os == "mac" and host_cpu == "x64"',
654-
'action': [ 'python3',
655-
'third_party/depot_tools/download_from_google_storage.py',
656-
'--no_resume',
657-
'--extract',
658-
'--bucket', 'chromium-nodejs/20.11.0',
659-
Var('node_darwin_x64_sha'),
660-
'-o', 'third_party/node/node-darwin-x64.tar.gz',
661-
],
662-
},
663-
{
664-
'name': 'node_mac_arm64',
665-
'pattern': '.',
666-
'condition': '(dawn_node or dawn_wasm) and host_os == "mac" and host_cpu == "arm64"',
667-
'action': [ 'python3',
668-
'third_party/depot_tools/download_from_google_storage.py',
669-
'--no_resume',
670-
'--extract',
671-
'--bucket', 'chromium-nodejs/20.11.0',
672-
Var('node_darwin_arm64_sha'),
673-
'-o', 'third_party/node/node-darwin-arm64.tar.gz',
674-
],
675-
},
676-
{
677-
'name': 'node_win',
678-
'pattern': '.',
679-
'condition': '(dawn_node or dawn_wasm) and host_os == "win"',
680-
'action': [ 'python3',
681-
'third_party/depot_tools/download_from_google_storage.py',
682-
'--no_resume',
683-
'--bucket', 'chromium-nodejs/20.11.0',
684-
Var('node_win_x64_sha'),
685-
'-o', 'third_party/node/node.exe',
686-
],
687-
},
688-
689644
# Activate emsdk for WebAssembly builds
690645
{
691646
'name': 'activate_emsdk',

scripts/dawn_node_cts/node_helpers.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
"""Helper code for running isolated versions of NodeJS."""
2828

29-
import glob
3029
import functools
3130
import os
3231

@@ -42,16 +41,12 @@ def get_node_path() -> str:
4241
Returns:
4342
A filepath to the standalone node executable.
4443
"""
45-
paths = glob.glob(os.path.join('*', 'bin', 'node'), root_dir=NODE_DIR)
46-
if not paths:
44+
path = os.path.join(NODE_DIR, 'bin', 'node')
45+
if not os.path.exists(path):
4746
raise RuntimeError(
4847
f'Unable to find the node binary under {NODE_DIR}. Is the '
4948
f'dawn_node gclient variable set?')
50-
if len(paths) > 1:
51-
raise RuntimeError(
52-
f'Found multiple node binaries when one is expected. Found: '
53-
f'{", ".join(paths)}')
54-
return os.path.join(NODE_DIR, paths[0])
49+
return path
5550

5651

5752
@functools.cache
@@ -62,20 +57,15 @@ def get_npm_command() -> list[str]:
6257
A list of strings that will run "npm" when run as a command for a
6358
subprocess.
6459
"""
65-
paths = glob.glob(os.path.join('*', 'lib', 'node_modules', 'npm', 'bin',
66-
'npm-cli.js'),
67-
root_dir=NODE_DIR)
68-
if not paths:
60+
path = os.path.join(NODE_DIR, 'lib', 'node_modules', 'npm', 'bin',
61+
'npm-cli.js')
62+
if not os.path.exists(path):
6963
raise RuntimeError(
7064
f'Unable to find the npm-cli.js file under {NODE_DIR}. Is the '
7165
f'dawn_node gclient variable set?')
72-
if len(paths) > 1:
73-
raise RuntimeError(
74-
f'Found multiple npm-cli.js files when one is expected. Found: '
75-
f'{", ".join(paths)}')
7666
cmd = [
7767
get_node_path(),
78-
os.path.join(NODE_DIR, paths[0]),
68+
os.path.join(NODE_DIR, path),
7969
]
8070
return cmd
8171

0 commit comments

Comments
 (0)