cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

Added Support for Shared Items Projects

Open DevFelixFaber opened this issue 1 year ago • 10 comments

At work (Areus Gmbh), we use Shared Items Projects in order to deduplicate code. In contrast to conventional project files (.vcxproj), the compilation configuration is set by the "includee", which makes the code-reuse of the project more flexible.

This pull-request adds support for Shared Items Projects (.vcxitems) in Visual studio projects / solutions.

The idea is that for each .vcxproj, we check for referenced shared items projects. When all the source files and include paths are build, we add the ones defined in the referenced .vcxitems. The implementation probably isn't 100% robust, but this works for our projects and could serve as a starting point :)

I apologize for the commit history - it's a bit wonky as we currently still use 2.11. I tried to merge the changes to the main branch so other could benefit from these changes as well, but seems like the git history looks a bit weird as a result.

DevFelixFaber avatar Apr 12 '24 08:04 DevFelixFaber

Thanks for a contribution. I will take a closer look in the next few days.

Please add a test with an example project to test/cli/more-projects.py.

Also some initial comments inline.

firewave avatar Apr 14 '24 20:04 firewave

I apologize for the commit history - it's a bit wonky as we currently still use 2.11. I tried to merge the changes to the main branch so other could benefit from these changes as well, but seems like the git history looks a bit weird as a result.

That can be resolved by re-basing the branch on the latest head.

firewave avatar Apr 14 '24 20:04 firewave

Thank you for the feedback, I'll try to implement it this week.

DevFelixFaber avatar Apr 15 '24 05:04 DevFelixFaber

I apologize for the commit history - it's a bit wonky as we currently still use 2.11. I tried to merge the changes to the main branch so other could benefit from these changes as well, but seems like the git history looks a bit weird as a result.

That can be resolved by re-basing the branch on the latest head.

I had the same issue as my merge, but my oversight was that my initial changes came from the 2.11 release branch, meaning it includes the few commits made for the official release. I re-based this once more, removed the release commits and force-pushed this to my branch. Seems more correct now.

Still working on adding tests.

DevFelixFaber avatar Apr 19 '24 06:04 DevFelixFaber

Thanks for adding the project. This will help understanding things. It is probably sufficient to have only a single configuration in it. That should make things easier to read as well.

firewave avatar Apr 30 '24 12:04 firewave

Thanks for adding the project. This will help understanding things. It is probably sufficient to have only a single configuration in it. That should make things easier to read as well.

Fixed in 10fb4e5

I also added a (crude) test in d34d14c. Seems to run fine on my machine, but I'm not sure I set it up correctly.

I seem to have broken the "changes requested" with my rebase + force push. Sorry!

DevFelixFaber avatar Apr 30 '24 13:04 DevFelixFaber

Sorry for the late reply.

Please fix the CI and I will finally have a proper look.

firewave avatar May 27 '24 11:05 firewave

My apologies, I borked the pipeline with the code removed in a00dd2a. That was some special code which (should be) unrelated to the shared items support. I fixed some more formatting issues (thanks Visual Studio) and adjusted the assertion on the new shared items project test.

DevFelixFaber avatar Jun 05 '24 12:06 DevFelixFaber

My apologies, I borked the pipeline with the code removed in [a00dd2a]

It happens.

As the CI seems to be happy now, I hope to finish up the review this week.

firewave avatar Jun 05 '24 12:06 firewave

At a glance this looks very interesting. Please make the CI happy. :+1:

danmar avatar Jun 09 '24 17:06 danmar

@firewave any updates on this? I fixed the merge conflicts that were introduced over time. Pipeline is happy-ish (pipeline used to work fine. Now it's failing a test unrelated to my changes, so I'm not sure how to address this)

DevFelixFaber avatar Aug 09 '24 07:08 DevFelixFaber

any updates on this?

Sorry about that. I keep running into existing (long-standing) issues to look into (which mostly block my own in-progress stuff) and forgetting looking into other peoples stuff.

I fixed the merge conflicts that were introduced over time. Pipeline is happy-ish (pipeline used to work fine. Now it's failing a test unrelated to my changes, so I'm not sure this is my fault)

It is all fine. That is a known flake.

firewave avatar Aug 09 '24 07:08 firewave

@DevFelixFaber If nobody has complaints in 2-3 days I think we can merge this. Feel free to ping me..

danmar avatar Aug 21 '24 16:08 danmar

Seems like there are no complaints! @danmar pinging as requested.

Thanks for the review(s) :)

DevFelixFaber avatar Aug 26 '24 08:08 DevFelixFaber

Trac ticket: https://trac.cppcheck.net/ticket/13043

danmar avatar Aug 27 '24 12:08 danmar