diff options
| author | ruki <[email protected]> | 2023-03-13 21:50:08 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-03-13 21:50:08 +0800 |
| commit | 7df711288a8556f8d805a4a030c55a37fa1e647c (patch) | |
| tree | 665d3cbaedb295d65cfb1f56c1f83a44e196c13f | |
| parent | f7402903d2c94766c490c42809f46ac8577c6d22 (diff) | |
| parent | 72372705bd1ae9de84e70adf53f461e92c0a17a1 (diff) | |
Merge pull request #3503 from shaqtsui/dev
plugin.compile_commands.autoupdate support lsp option
| -rw-r--r-- | xmake/rules/plugin/compile_commands/xmake.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/rules/plugin/compile_commands/xmake.lua b/xmake/rules/plugin/compile_commands/xmake.lua index f32468959..57514a768 100644 --- a/xmake/rules/plugin/compile_commands/xmake.lua +++ b/xmake/rules/plugin/compile_commands/xmake.lua @@ -43,6 +43,7 @@ rule("plugin.compile_commands.autoupdate") local lockfile = io.openlock(tmpfile .. ".lock") if lockfile:trylock() then local outputdir + local lsp local sourcefiles = {} for _, target in pairs(project.targets()) do table.join2(sourcefiles, target:sourcefiles(), target:headerfiles()) @@ -50,13 +51,16 @@ rule("plugin.compile_commands.autoupdate") if extraconf and extraconf.outputdir then outputdir = extraconf.outputdir end + if extraconf and extraconf.lsp then + lsp = extraconf.lsp + end end table.sort(sourcefiles) depend.on_changed(function () -- we use task instead of os.exec("xmake") to avoid the project lock local filename = "compile_commands.json" local filepath = outputdir and path.join(outputdir, filename) or filename - task.run("project", {kind = "compile_commands", outputdir = outputdir}) + task.run("project", {kind = "compile_commands", outputdir = outputdir, lsp = lsp}) print("compile_commands.json updated!") end, {dependfile = dependfile, files = project.allfiles(), |
