create compile_commands.json in builddir

assuming that nothing breaks for existing users of the
compile_commands.json file, since they assume BUILDDIR=SRCDIR, so
nothing will change in those cases.

For building in a different directory than the source, the
compile_commands.json file is the only thing that regularly clobbers my
otherwise pristine SRCROOT

Change-Id: I344afa0bc7bb3eaa1eb888cd3558d3602090af5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143571
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
This commit is contained in:
Christian Lohmaier 2022-11-30 11:30:23 +01:00
parent 59d868b9ed
commit df092b591a
2 changed files with 2 additions and 3 deletions

View file

@ -35,8 +35,7 @@
"files.associations": {
"*.patch.[0-9]": "diff"
},
// FIXME: arguably the generator should place it in the builddir, not srcdir
"C_Cpp.default.compileCommands": "${workspaceFolder:srcdir}/compile_commands.json",
"C_Cpp.default.compileCommands": "@BUILDDIR@/compile_commands.json",
// only used if the file doesn't match anything in the compile_commands.json - aka externals
// libxml includes just added as example/for reference
"C_Cpp.default.includePath": [

View file

@ -549,7 +549,7 @@ class VimIntegrationGenerator(IdeIntegrationGenerator):
entry = {'directory': lib.location, 'file': filePath, 'command': self.generateCommand(lib, filePath)}
entries.append(entry)
global_list.extend(entries)
with open('compile_commands.json', 'w') as export_file:
with open(os.path.join(self.gbuildparser.builddir, 'compile_commands.json'), 'w') as export_file:
json.dump(global_list, export_file)
def generateCommand(self, lib, file):