build: add symlink to compile_commands.json file if needed

Usually lsp servers needs the `compile_commands.json` file in the root
directory.

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/49260
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
Juan José 2023-08-24 09:02:04 -05:00 committed by GitHub
parent b0f423390f
commit 5ff1ead6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2116,6 +2116,8 @@ else:
if options.compile_commands_json:
gyp_args += ['-f', 'compile_commands_json']
os.path.islink('./compile_commands.json') and os.unlink('./compile_commands.json')
os.symlink('./out/' + config['BUILDTYPE'] + '/compile_commands.json', './compile_commands.json')
# override the variable `python` defined in common.gypi
if bin_override is not None: