build,tools,node-api: fix building node-api tests for Windows Debug

PR-URL: https://github.com/nodejs/node/pull/52632
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Cheng Zhao <zcbenz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
Vladimir Morozov 2024-04-26 04:36:13 -07:00 committed by GitHub
parent 172820342b
commit 2334d5cda8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 9 deletions

View File

@ -38,7 +38,7 @@ def rebuild_addons(args):
# Copy node.lib.
if args.is_win:
node_lib_dir = os.path.join(headers_dir, 'Release')
node_lib_dir = os.path.join(headers_dir, args.config)
os.makedirs(node_lib_dir)
shutil.copy2(os.path.join(args.out_dir, 'node.lib'),
os.path.join(node_lib_dir, 'node.lib'))
@ -89,17 +89,17 @@ def rebuild_addons(args):
executor.map(node_gyp_rebuild, test_dirs)
def get_default_out_dir(args):
default_out_dir = os.path.join('out', 'Release')
default_out_dir = os.path.join('out', args.config)
if not args.is_win:
# POSIX platforms only have one out dir.
return default_out_dir
# On Windows depending on the args of GYP and configure script, the out dir
# could be 'out/Release' or just 'Release'.
# could be 'out/Release', 'out/Debug' or just 'Release' or 'Debug'.
if os.path.exists(default_out_dir):
return default_out_dir
if os.path.exists('Release'):
return 'Release'
raise RuntimeError('Can not find out dir, did you run configure?')
if os.path.exists(args.config):
return args.config
raise RuntimeError('Cannot find out dir, did you run build?')
def main():
if sys.platform == 'cygwin':
@ -124,6 +124,8 @@ def main():
default='deps/npm/node_modules/node-gyp/bin/node-gyp.js')
parser.add_argument('--is-win', help='build for Windows target',
action='store_true', default=(sys.platform == 'win32'))
parser.add_argument('--config', help='build config (Release or Debug)',
default='Release')
args, unknown_args = parser.parse_known_args()
if not args.out_dir:

View File

@ -583,7 +583,7 @@ for /d %%F in (test\addons\??_*) do (
if %errorlevel% neq 0 exit /b %errorlevel%
:: building addons
setlocal
python "%~dp0tools\build_addons.py" "%~dp0test\addons"
python "%~dp0tools\build_addons.py" "%~dp0test\addons" --config %config%
if errorlevel 1 exit /b 1
endlocal
@ -600,7 +600,7 @@ for /d %%F in (test\js-native-api\??_*) do (
)
:: building js-native-api
setlocal
python "%~dp0tools\build_addons.py" "%~dp0test\js-native-api"
python "%~dp0tools\build_addons.py" "%~dp0test\js-native-api" --config %config%
if errorlevel 1 exit /b 1
endlocal
goto build-node-api-tests
@ -618,7 +618,7 @@ for /d %%F in (test\node-api\??_*) do (
)
:: building node-api
setlocal
python "%~dp0tools\build_addons.py" "%~dp0test\node-api"
python "%~dp0tools\build_addons.py" "%~dp0test\node-api" --config %config%
if errorlevel 1 exit /b 1
endlocal
goto run-tests