Skip to content

Commit 9be70bd

Browse files
segevfineraduh95
authored andcommitted
build: add the option to generate compile_commands.json in vcbuild.bat
Refs: nodejs/gyp-next#238
1 parent b77476d commit 9be70bd

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

configure.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,8 +2308,9 @@ def make_bin_override():
23082308

23092309
if options.compile_commands_json:
23102310
gyp_args += ['-f', 'compile_commands_json']
2311-
os.path.islink('./compile_commands.json') and os.unlink('./compile_commands.json')
2312-
os.symlink('./out/' + config['BUILDTYPE'] + '/compile_commands.json', './compile_commands.json')
2311+
if sys.platform != 'win32':
2312+
os.path.lexists('./compile_commands.json') and os.unlink('./compile_commands.json')
2313+
os.symlink('./out/' + config['BUILDTYPE'] + '/compile_commands.json', './compile_commands.json')
23132314

23142315
# pass the leftover non-whitespace positional arguments to GYP
23152316
gyp_args += [arg for arg in args if not str.isspace(arg)]
@@ -2319,4 +2320,7 @@ def make_bin_override():
23192320

23202321
print_verbose("running: \n " + " ".join(['python', 'tools/gyp_node.py'] + gyp_args))
23212322
run_gyp(gyp_args)
2323+
if options.compile_commands_json and sys.platform == 'win32':
2324+
os.path.isfile('./compile_commands.json') and os.unlink('./compile_commands.json')
2325+
shutil.copy2('./out/' + config['BUILDTYPE'] + '/compile_commands.json', './compile_commands.json')
23222326
info('configure completed successfully')

vcbuild.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ set openssl_no_asm=
6969
set no_shared_roheap=
7070
set doc=
7171
set extra_msbuild_args=
72+
set compile_commands=
7273
set exit_code=0
7374

7475
:next-arg
@@ -145,6 +146,7 @@ if /i "%1"=="openssl-no-asm" set openssl_no_asm=1&goto arg-ok
145146
if /i "%1"=="no-shared-roheap" set no_shared_roheap=1&goto arg-ok
146147
if /i "%1"=="doc" set doc=1&goto arg-ok
147148
if /i "%1"=="binlog" set extra_msbuild_args=/binaryLogger:out\%config%\node.binlog&goto arg-ok
149+
if /i "%1"=="compile-commands" set compile_commands=1&goto arg-ok
148150

149151
echo Error: invalid command line option `%1`.
150152
exit /b 1
@@ -203,6 +205,7 @@ if defined debug_nghttp2 set configure_flags=%configure_flags% --debug-nghttp
203205
if defined openssl_no_asm set configure_flags=%configure_flags% --openssl-no-asm
204206
if defined no_shared_roheap set configure_flags=%configure_flags% --disable-shared-readonly-heap
205207
if defined DEBUG_HELPER set configure_flags=%configure_flags% --verbose
208+
if defined compile_commands set configure_flags=%configure_flags% -C
206209

207210
if "%target_arch%"=="x86" (
208211
echo "32-bit Windows builds are not supported anymore."

0 commit comments

Comments
 (0)