-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
For issue #528: Add linking database #529
base: master
Are you sure you want to change the base?
For issue #528: Add linking database #529
Conversation
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.
Hey Maria, thanks for this improvement.
I'm traveling at the moment, so can't review it now. And this is an important feature, so I would like to read it properly. I'm back in mid July.
Have you seen the older tickets (might be closed) which were touching this subject? And have you considered using the config file instead of the commands line arguments?
Initially, I made these changes for another project, so I first of all started from the described requirements. I didn't look at previous tickets. But I'm certainly willing to make any changes. |
I'm sorry, but is it true that you will be able to see them only after mid July? And do you have plans to work with this pr and add it (after all the changes)? I'm asking this because it's a pretty big change. |
I'm back in mid July, that's true. :) Might be able to have access to a laptop in June, so I can take a quick look. This feature was requested earlier, so I'm interested to see your implementation... And I know to implement this feature will require making some important decisions. To mention one: shall the new entries break the JSON compilation database spec? If not, then how to represent a linking call as compilation? (One of the previous discussions with c2rust transpiller authors is captured in the issues. That's why I was suggesting to look into older issues.) Also, I would prefer to have small PRs, instead of a big one. I know it's hard, but I also know it is possible. :) Sorry for not being available now, but that's temporary. |
Okay, I'll close this PR and open some smaller ones. In the process, there were indeed some decisions to be made. I would suggest that you first familiarize yourself with my solutions and then discuss how successful they are and how much they correspond to your vision. And then change them. |
Unfortunately, it turned out that the changes in different files are quite strongly related, so it was not possible to isolate independent meaningful parts for creating a PRs. If you have any suggestions, I'm ready to listen to them. |
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.
Thanks for this PR @mamaria-k !
In general, I would like to make the linking support available through the configuration file (without command line flag changes). I believe that majority of users are only interested in compilations, and just a few people will be interested in the linking commands. I prefer to keep this feature out of the way for people who are just creating the compilation database for "normal" use cases. And those who want to get the link commands, will be considered as "advanced" users and have the skills to write a config file.
The other thing I would like to clarify is where the output goes...
- Your solution was using a separate file for the link commands, with a special syntax.
- While the Support link commands in the output #276 issue was suggest to write that into the same output file, and the
file
field of the entry contained all the link related information. (See here.) - My proposal would be to serialize the
cs::Semantic
objects into the output file. Therefore all information thatcitnames
was detected would be accessible. Then with some post processing (JSON processing is easy in many languages) people can filter the desired entries and format into whatever they like. (This project might provide a few default scripts if that's desired.)
I think the 3rd option gives the more flexibility. And learning from use cases later this project can be favor one "final" output format. Which might be ideal, since it's not clear what are the use cases of the link output. :)
source/bear/man/bear.1.md
Outdated
@@ -34,16 +34,26 @@ compilation database. | |||
\--verbose | |||
: Enable verbose logging. | |||
|
|||
\--output *file* | |||
: Specify output file. (Default file name provided.) The output is | |||
a JSON compilation database. |
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.
I would like to keep the --output
flag, so please don't remove it.
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.
Ok, returned the original set of flags.
@@ -34,7 +39,7 @@ namespace cs::semantic { | |||
|
|||
// Returns the semantic of a command execution. | |||
[[nodiscard]] | |||
virtual rust::Result<SemanticPtr> recognize(const Execution &) const = 0; | |||
virtual rust::Result<SemanticPtr> recognize(const Execution &, const BuildTarget target) const = 0; |
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.
Could we keep the signature of this method? The idea would be that tools are recognizing everything they could, and the separation of the linker and compiler calls would be based on the Semantic
instance type.
Maybe change the CompilerCall::into_entries
as virtual std::list<cs::Entry> into_entries(bool only_compilations = true) const = 0
?
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.
See point 3 of the comment below.
About support for the linking option in the configuration file. Do you mean storing in a file participating in the compilation (like config.h.in) or should it be a file (maybe json), after changing which the project does not need to be rebuilt? |
Bear has a config file, which controls what should be in the output file. See |
* Add patch for linking database
* Fix arguments formation for Entry, fix unit tests * Change saving arguments and fix tests * Add functional tests for linking
* Add files count for linking checking * Fix files validation and content filter checking * Fix processing case with ar * Fix test name * Update unit test
* Add processing of linking flags -l -Wl -L * Separate -static flag from -static-s * Supplement testing system, add processing libs for compilation database
* Fix case with unsorted events
aa23f24
to
1996895
Compare
…tabase to the configuration file
Then I have a few questions.
|
@rizsotto, questions are still relevant. |
Hey @mamaria-k ,
|
Is there any update on the status of this issue and the associated pull request? Just checking to see if there's still interest in moving this forward. Also, I came across a similar approach in a cmake pull request that's still open here: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6009. It might be relevant to our discussion? |
There is interest, but I will be able to continue working in mid-summer. |
just used your branch to successfully get link commands that I needed to rebuild a legacy build system. sweet |
This issue was created to suggest improvements. Adding the ability to create a linking database.
Changes:
Now the filtering works considering that the events are sorted. However, I saw that with a small probability they are unsorted. Therefore, handling of the case of unsorted events will be added soon.