DAOS-14846 build: scons support generate compile_command.json
clangd use compile_command.json to do code completion and something else, generate this file is helpful to someone who using editor with completation based on clangd
tested under scons-3.1.2 and scons-4.6.0
Before requesting gatekeeper:
- [ ] Two review approvals and any prior change requests have been resolved.
- [ ] Testing is complete and all tests passed or there is a reason documented in the PR why it should be force landed and forced-landing tag is set.
- [ ]
Features:(orTest-tag*) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR. - [ ] Commit messages follows the guidelines outlined here.
- [ ] Any tests skipped by the ticket being addressed have been run and passed in the PR.
Gatekeeper:
- [ ] You are the appropriate gatekeeper to be landing the patch.
- [ ] The PR has 2 reviews by people familiar with the code, including appropriate watchers.
- [ ] Githooks were used. If not, request that user install them and check copyright dates.
- [ ] Checkpatch issues are resolved. Pay particular attention to ones that will show up on future PRs.
- [ ] All builds have passed. Check non-required builds for any new compiler warnings.
- [ ] Sufficient testing is done. Check feature pragmas and test tags and that tests skipped for the ticket are run and now pass with the changes.
- [ ] If applicable, the PR has addressed any potential version compatibility issues.
- [ ] Check the target branch. If it is master branch, should the PR go to a feature branch? If it is a release branch, does it have merge approval in the JIRA ticket.
- [ ] Extra checks if forced landing is requested
- [ ] Review comments are sufficiently resolved, particularly by prior reviewers that requested changes.
- [ ] No new NLT or valgrind warnings. Check the classic view.
- [ ] Quick-build or Quick-functional is not used.
- [ ] Fix the commit message upon landing. Check the standard here. Edit it to create a single commit. If necessary, ask submitter for a new summary.
Bug-tracker data: Ticket title is 'support scons generate compile_command.json' Status is 'In Progress' https://daosio.atlassian.net/browse/DAOS-14846
@wineway In any future commits you make to this PR please add:
Run-GHA: true
to your commit message somewhere (convention is usually at the end of the commit message along with your Signed-off-by: etc.) so that it runs the build and test in GitHub Actions.
@wineway In any future commits you make to this PR please add:
Run-GHA: trueto your commit message somewhere (convention is usually at the end of the commit message along with your
Signed-off-by:etc.) so that it runs the build and test in GitHub Actions.
@brianjmurrell seems it not works😢, workflows need to be approved
@brianjmurrell seems it not works😢, workflows need to be approved
Yes, all workflows do need to be approved once reviewed and accepted. But even once approved they won't run any RPM build and test without the required Run-GHA: true.
That said, nobody here really understands what this change is about/for. Could you please provide a more complete description of what this change is and what it achieves in the original comment/description. Thanks.
To answer @brianjmurrell Question, this is motivation i copied from ticket descriptions: "clangd use compile_command.json to do code completion and something else, generate this file is helpful to someone who using editor with completation based on clangd"
To answer @brianjmurrell Question, this is motivation i copied from ticket descriptions: "clangd use compile_command.json to do code completion and something else, generate this file is helpful to someone who using editor with completation based on clangd"
Thank you for answering for me🫡, updated on the description of this pull request
Ticket title is 'support scons generate compile_command.json' Status is 'In Progress' https://daosio.atlassian.net/browse/DAOS-14846
clangd use compile_command.json to do code completion and something else, generate this file is helpful to someone who using editor with completation based on clangd
What is "something else"?
And is there expected to be a file generated called compile_command.json? When Iast tried this, I didn't see any such file or really anything different generated.
clangd use compile_command.json to do code completion and something else, generate this file is helpful to someone who using editor with completation based on clangd
What is "something else"?
And is there expected to be a file generated called
compile_command.json? When Iast tried this, I didn't see any such file or really anything different generated.
@daltonbohning "something else" is some actions rely on clangd, like code compiletion, reference/definition jumping etc.
For more Features
And is there expected to be a file generated called
compile_command.json
refer to extensions#compilation-commands
the default behivour of searching the compile_command.json is searching their ancestor directories. and usually is fine to place this file at the root directory of the project, this is also the default behavior of compiledb plugin of Scons
I didn't see any such file generated.
if your Scons version is greater than 4.0.0, then execute scons -Q compiledb, you can find compile_command.json in the root directory of the project