Skip to content

Commit 20bb165

Browse files
vmorozmarco-ippolito
authored andcommitted
build,tools,node-api: fix building node-api tests for Windows Debug
PR-URL: #52632 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Cheng Zhao <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 7e6d923 commit 20bb165

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

tools/build_addons.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def rebuild_addons(args):
3838

3939
# Copy node.lib.
4040
if args.is_win:
41-
node_lib_dir = os.path.join(headers_dir, 'Release')
41+
node_lib_dir = os.path.join(headers_dir, args.config)
4242
os.makedirs(node_lib_dir)
4343
shutil.copy2(os.path.join(args.out_dir, 'node.lib'),
4444
os.path.join(node_lib_dir, 'node.lib'))
@@ -89,17 +89,17 @@ def node_gyp_rebuild(test_dir):
8989
executor.map(node_gyp_rebuild, test_dirs)
9090

9191
def get_default_out_dir(args):
92-
default_out_dir = os.path.join('out', 'Release')
92+
default_out_dir = os.path.join('out', args.config)
9393
if not args.is_win:
9494
# POSIX platforms only have one out dir.
9595
return default_out_dir
9696
# On Windows depending on the args of GYP and configure script, the out dir
97-
# could be 'out/Release' or just 'Release'.
97+
# could be 'out/Release', 'out/Debug' or just 'Release' or 'Debug'.
9898
if os.path.exists(default_out_dir):
9999
return default_out_dir
100-
if os.path.exists('Release'):
101-
return 'Release'
102-
raise RuntimeError('Can not find out dir, did you run configure?')
100+
if os.path.exists(args.config):
101+
return args.config
102+
raise RuntimeError('Cannot find out dir, did you run build?')
103103

104104
def main():
105105
if sys.platform == 'cygwin':
@@ -124,6 +124,8 @@ def main():
124124
default='deps/npm/node_modules/node-gyp/bin/node-gyp.js')
125125
parser.add_argument('--is-win', help='build for Windows target',
126126
action='store_true', default=(sys.platform == 'win32'))
127+
parser.add_argument('--config', help='build config (Release or Debug)',
128+
default='Release')
127129
args, unknown_args = parser.parse_known_args()
128130

129131
if not args.out_dir:

vcbuild.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ for /d %%F in (test\addons\??_*) do (
607607
if %errorlevel% neq 0 exit /b %errorlevel%
608608
:: building addons
609609
setlocal
610-
python "%~dp0tools\build_addons.py" "%~dp0test\addons"
610+
python "%~dp0tools\build_addons.py" "%~dp0test\addons" --config %config%
611611
if errorlevel 1 exit /b 1
612612
endlocal
613613

@@ -624,7 +624,7 @@ for /d %%F in (test\js-native-api\??_*) do (
624624
)
625625
:: building js-native-api
626626
setlocal
627-
python "%~dp0tools\build_addons.py" "%~dp0test\js-native-api"
627+
python "%~dp0tools\build_addons.py" "%~dp0test\js-native-api" --config %config%
628628
if errorlevel 1 exit /b 1
629629
endlocal
630630
goto build-node-api-tests
@@ -642,7 +642,7 @@ for /d %%F in (test\node-api\??_*) do (
642642
)
643643
:: building node-api
644644
setlocal
645-
python "%~dp0tools\build_addons.py" "%~dp0test\node-api"
645+
python "%~dp0tools\build_addons.py" "%~dp0test\node-api" --config %config%
646646
if errorlevel 1 exit /b 1
647647
endlocal
648648
goto run-tests

0 commit comments

Comments
 (0)