Skip to content

Commit 293ee9d

Browse files
committed
tools: cache V8 on test-shared workflow
1 parent 7215ea4 commit 293ee9d

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

configure.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,13 @@
10901090
help='do not use V8 includes from the bundled deps folder. ' +
10911091
'(This mode is not officially supported for regular applications)')
10921092

1093+
parser.add_argument('--external-v8',
1094+
action='store',
1095+
dest='external_v8_path',
1096+
default=False,
1097+
help='Path to shared V8. ' +
1098+
'(This mode is not officially supported for regular applications)')
1099+
10931100
parser.add_argument('--verbose',
10941101
action='store_true',
10951102
dest='verbose',
@@ -2068,6 +2075,11 @@ def configure_v8(o, configs):
20682075
raise Exception('--enable-d8 is incompatible with --without-bundled-v8.')
20692076
if options.without_bundled_v8 and options.enable_v8windbg:
20702077
raise Exception('--enable-v8windbg is incompatible with --without-bundled-v8.')
2078+
if options.external_v8_path:
2079+
if not options.without_bundled_v8:
2080+
raise Exception('--external-v8 requires --without-bundled-v8.')
2081+
output['libraries'] += [f"-L{options.external_v8_path}/lib", '-lv8']
2082+
output['include_dirs'] += [f"-L{options.external_v8_path}/include"]
20712083
if options.static_zoslib_gyp:
20722084
o['variables']['static_zoslib_gyp'] = options.static_zoslib_gyp
20732085
if flavor != 'linux' and options.v8_enable_hugepage:

shell.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
withTemporal
2828
;
2929
},
30+
cachedV8 ? pkgs.callPackage ./tools/nix/v8.nix { },
3031

3132
# dev tools (not needed to build Node.js, useful to maintain it)
3233
ncu-path ? null, # Provide this if you want to use a local version of NCU
@@ -83,6 +84,10 @@ pkgs.mkShell {
8384
)
8485
]
8586
++ extraConfigFlags
87+
++ pkgs.lib.optionals (cachedV8 != null) [
88+
"--without-bundled-v8"
89+
"--external-v8=${cachedV8}"
90+
]
8691
++ pkgs.lib.optional (!withAmaro) "--without-amaro"
8792
++ pkgs.lib.optional (!withLief) "--without-lief"
8893
++ pkgs.lib.optional withQuic "--experimental-quic"

tools/nix/v8.nix

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
lib,
3+
nodejs-slim_latest,
4+
}:
5+
6+
(nodejs-slim_latest.overrideAttrs (old: {
7+
prePatch = (old.prePatch or "") + ''
8+
cp ${../../common.gypi} common.gypi
9+
cp ${../../node.gypi} node.gypi
10+
cp ${../../node.gyp} node.gyp
11+
cp -r ${../../deps/v8} deps/v8
12+
cp -r ${../../src} src
13+
cp -r ${../../tools/gyp} tools/gyp
14+
cp -r ${../../tools/make-v8.sh} tools/make-v8.sh
15+
cp -r ${../../tools/v8_gypfiles} tools/v8_gypfiles
16+
'';
17+
doCheck = false;
18+
})).libv8

0 commit comments

Comments
 (0)