Skip to content

Commit 2334d5c

Browse files
authored
build,tools,node-api: fix building node-api tests for Windows Debug
PR-URL: nodejs#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 1728203 commit 2334d5c

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

tools/build_addons.py

+8-6
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ for /d %%F in (test\addons\??_*) do (
583583
if %errorlevel% neq 0 exit /b %errorlevel%
584584
:: building addons
585585
setlocal
586-
python "%~dp0tools\build_addons.py" "%~dp0test\addons"
586+
python "%~dp0tools\build_addons.py" "%~dp0test\addons" --config %config%
587587
if errorlevel 1 exit /b 1
588588
endlocal
589589

@@ -600,7 +600,7 @@ for /d %%F in (test\js-native-api\??_*) do (
600600
)
601601
:: building js-native-api
602602
setlocal
603-
python "%~dp0tools\build_addons.py" "%~dp0test\js-native-api"
603+
python "%~dp0tools\build_addons.py" "%~dp0test\js-native-api" --config %config%
604604
if errorlevel 1 exit /b 1
605605
endlocal
606606
goto build-node-api-tests
@@ -618,7 +618,7 @@ for /d %%F in (test\node-api\??_*) do (
618618
)
619619
:: building node-api
620620
setlocal
621-
python "%~dp0tools\build_addons.py" "%~dp0test\node-api"
621+
python "%~dp0tools\build_addons.py" "%~dp0test\node-api" --config %config%
622622
if errorlevel 1 exit /b 1
623623
endlocal
624624
goto run-tests

0 commit comments

Comments
 (0)