Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmake check clang.tidy doesn't follow non-default path to the compile_commands.json #5583

Closed
yh-sb opened this issue Sep 7, 2024 · 4 comments
Labels
Milestone

Comments

@yh-sb
Copy link
Contributor

yh-sb commented Sep 7, 2024

Xmake Version

2.9.4

Operating System Version and Architecture

Windows 11 23H2 22631.4037

Describe Bug

Whet custom location to compile_commands.json is set (build/compile_commands.json), xmake check clang.tidy can't find it and creates new compile_commands.json each time:

clang-tidy -p C:\Users\Y\AppData\Local\Temp\.xmake\240907\_B4E95247014C4A708F2AA4B170AA47A0.dir\compile_commands.json ....

Expected Behavior

xmake check clang.tidy should use compile_commands.json created by xmake during the config or build steps.

Project Configuration

add_rules("mode.debug", "mode.release", "plugin.compile_commands.autoupdate", {outputdir = "build"})
set_targetdir("$(buildir)")

target("app")
    add_files(
        "main.cpp"
    )

Additional Information and Error Logs

Here is xmake lua code that checks compile_commands.json by hardcoded path:

if not os.isfile(filepath) then

@yh-sb yh-sb added the bug label Sep 7, 2024
@yh-sb yh-sb changed the title xmake check clang.tidy doesn't respect path to the compile_commands.json xmake check clang.tidy doesn't respect path to the compile_commands.json Sep 7, 2024
@yh-sb yh-sb changed the title xmake check clang.tidy doesn't respect path to the compile_commands.json xmake check clang.tidy doesn't follow nondefault path to the compile_commands.json Sep 8, 2024
@yh-sb yh-sb changed the title xmake check clang.tidy doesn't follow nondefault path to the compile_commands.json xmake check clang.tidy doesn't follow non-default path to the compile_commands.json Sep 8, 2024
@waruqi
Copy link
Member

waruqi commented Sep 9, 2024

try this patch. #5586

we need pass xmake check clang.tidy --compdb=build/compile_commands.json to clang tidy

@waruqi waruqi added this to the v2.9.5 milestone Sep 9, 2024
@yh-sb
Copy link
Contributor Author

yh-sb commented Sep 9, 2024

Is it possible to somehow grab the compile_commands.json path from project setting in tidy.lua?

Root xmake.lua in project has definition for compile_commands.json path:

add_rules("plugin.compile_commands.autoupdate", {outputdir = "build"})

@waruqi
Copy link
Member

waruqi commented Sep 9, 2024

Is it possible to somehow grab the compile_commands.json path from project setting in tidy.lua?

Root xmake.lua in project has definition for compile_commands.json path:

add_rules("plugin.compile_commands.autoupdate", {outputdir = "build"})

try it again. xmake update -s dev

waruqi added a commit that referenced this issue Sep 9, 2024
@yh-sb
Copy link
Contributor Author

yh-sb commented Sep 9, 2024

It works fine, xmake check clang.tidy is using compile_commands.json even with custom path , {outputdir = "CUSTOM_PATH"}.
Thank you.

@yh-sb yh-sb closed this as completed Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants