diff options
| author | ruki <[email protected]> | 2024-09-10 00:57:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-09-10 00:57:14 +0800 |
| commit | 13c9b7cca83101cdcdd48ae80cee816c800648a4 (patch) | |
| tree | 433fe7bd78f00fcccf00b93b4891bafd87741c8f /xmake/modules | |
| parent | 76ab87b7b73464b7e062d97b5eb2d34e934394a5 (diff) | |
improve clang.tidy ##5583
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/check/checkers/clang/tidy.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/xmake/modules/private/check/checkers/clang/tidy.lua b/xmake/modules/private/check/checkers/clang/tidy.lua index ff7bda432..d047bc541 100644 --- a/xmake/modules/private/check/checkers/clang/tidy.lua +++ b/xmake/modules/private/check/checkers/clang/tidy.lua @@ -120,7 +120,21 @@ function _check(clang_tidy, opt) opt = opt or {} -- generate compile_commands.json first - local filepath = option.get("compdb") or "compile_commands.json" + local filepath = option.get("compdb") + if not filepath then + -- @see https://github.com/xmake-io/xmake/issues/5583#issuecomment-2337696628 + local outputdir + local extraconf = project.extraconf("target.rules", "plugin.compile_commands.autoupdate") + if extraconf then + outputdir = extraconf.outputdir + end + if outputdir then + filepath = path.join(outputdir, "compile_commands.json") + end + end + if not filepath then + filepath = "compile_commands.json" + end if not os.isfile(filepath) then local outputdir = os.tmpfile() .. ".dir" local filename = path.filename(filepath) |
