-
Notifications
You must be signed in to change notification settings - Fork 92
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
CMAKE compile_commands flag addition #2270
base: main
Are you sure you want to change the base?
Conversation
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make the commit message follow the standard format described at https://github.com/ceph/ceph/blob/main/SubmittingPatches.rst#describe-your-changes
How large is the .json file? where is it placed? Does this mean that the clang-tidy job must be run after the ceph build job? How is that going to fit in our job workflow? |
@@ -960,7 +960,7 @@ build_debs() { | |||
|
|||
echo building debs for $DIST | |||
|
|||
CEPH_EXTRA_CMAKE_ARGS="$CEPH_EXTRA_CMAKE_ARGS $(extra_cmake_args)" | |||
CEPH_EXTRA_CMAKE_ARGS="$CEPH_EXTRA_CMAKE_ARGS $(extra_cmake_args)" + " -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, scripts/build_utils.sh
is used by the CI for building packages. and developers always just use the packages for testing and for redistributing Ceph. if that's the case, who will be reading the output of the linter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2269, as mentioned above, is meant to be a check job, but if it's got to run after a ceph build, I'm not sure how it fits in either.
The .json file is about 50MB.
There is no specific constraint on where it needs to be placed, we can place it anywhere, as of now I am placing it in the
Yes
After Reference: After the build_debs finishes we are starting clang-tidy |
but...so...that means clang-tidy isn't a separate Jenkins job anymore, or a pre-check for PRs, it's a step of the actual build. That's unlike anything else in the build structure. What do we do if the build succeeds but clang-tidy fails? I had started out assuming that clang-tidy was going to be running on ceph PRs like other checks, but now that seems very different from the flow it may need. |
The DCMAKE_EXPORT_COMPILE_COMMANDS flag generates the `compile_commands.json` file which contains the exact compiler calls for all translation units of the project in machine-readable form. This file is used by many code analysis tools, IDE(s), refactoring tools, etc. There is no harm in having the `compile_commands.json` file. We want to integrate clang-tidy into the Ceph CI for which the `compile_commands.json` file is necessary. Signed-off-by: Suyash Dongre <[email protected]>
It doesn't matter if clang-tidy fails, in fact we want it to "fail". The only purpose of clang-tidy is to pop warnings/errors to users.
It still is. The only change that we are making is to get the .json file which the clang-tidy needs. That .json file can only be generated by cmake. There would be no alteration to the workflow whatsoever. |
oh, but, no...the clang-tidy job is attempting to "build_debs()" itself. That's not going to work; the build is a long resource-intensive process, and there's a lot more going on than just build_debs(); that depends on being run from a jenkins job that includes a -setup stage. We're going to need to rethink this. |
I see.. We can just run the cmake to get the .json file. But the issue arises when clang-tidy cannot find the |
I don't know. Also, even "just running cmake" depends on stuff in ./install-deps.sh, which for Debian builds would need to be running inside a pbuilder environment... this is totally new ground. |
what should we do now? What do you think is an appropriate solution? |
Hi @dmick can you please check the above comments? Thanks! |
Maybe it's best to incorporate this as an optional step in the make-check job? make check already builds ceph, and will have a built ceph tree in the workspace (unlike a standalone jenkins job, which would have to redo the build process) |
@dmick |
I have suggested a solution for this please check: #2269 (comment) |
The DCMAKE_EXPORT_COMPILE_COMMANDS flag generates the
compile_commands.json
file which contains the exact compiler calls for all translation units of the project in machine-readable form.This file is used by many code analysis tools, IDE(s), refactoring tools, etc.
There is no harm in having the
compile_commands.json
file.We want to integrate clang-tidy into the Ceph CI for which the
compile_commands.json
file is necessary.