-
Notifications
You must be signed in to change notification settings - Fork 148
Conversation
CLA assistant check
All CLA requirements met.
Thanks for the PR.
I'm not sure there is much benefit in merging Source Link files. VC++ linker supports multiple /sourcelink entries: /link /sourcelink <sourcelinkfile1.json> /sourcelink <sourcelinkfile2.json>. If multiple are specified the linker creates named streams called sourcelink1ドル, sourcelink2ドル, etc. and the debugger recognizes these.
This was specifically designed to remove complexity of merging JSON from build systems such as CMake.
..., multiple uses of the link /sourcelink arg are used.
nickdalt
commented
Apr 29, 2020
OK, I hadn't realised that /sourcelink could be used multiple times. I have updated the code to used /sourcelink with each discovered .sourcelink.json file.
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.
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.
Done
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.
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.
Done
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.
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.
Done
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.
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.
Fixed
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.
@nickdalt Thanks for the PR - sorry for the delay in review. Was busy with other things.
Any ideas how we can test this reasonably?
I think we should at least have unit tests for FindAdditionalSourceLinkFiles task. End-to-end test might be too complicated since it would depend on VC++ compiler targets.
@tmat
tmat
left a comment
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.
Command line switches need escaping and we also need a test.
..., multiple uses of the link /sourcelink arg are used.
...dalt/sourcelink into support-for-cpp-static-libs
Added unit tests for FindAdditionalSourceLinkFiles Tweaks to inheritance to handle Task type confusion in VS2022
nickdalt
commented
Sep 6, 2021
Command line switches need escaping and we also need a test.
I am not clear what you want here
Any ideas how we can test this reasonably?
I think we should at least have unit tests for FindAdditionalSourceLinkFiles task. End-to-end test might be too complicated since it would depend on VC++ compiler targets.
I can't see any easy way of testing end to end since that would require publishing the NuGet, consuming it in multiple C++ projects, building them, and finally checking that the pdb contains the sourcelink details for the libs.
I have however added unit tests for FindAdditionalSourceLinkFiles
sylveon
commented
May 24, 2022
I am interested in this - however my setup is a few static libraries packaged in a NuGet package and then acquired in another solution. I imagine in this setup, it would be required for the NuGet package to ship the relevant .sourcelink.json files, and then for the consumer of my package to also have the SourceLink NuGet package installed so that it can then be passed to link.exe during the final link to a .DLL file, correct?
Also, it seems SourceLink is disabled by default for IDE builds, but in a setup like the one mentioned here, we would need to at least get the SourceLink metadata from the static libraries into the final PDB even from IDE builds. Would we need to enable SourceLink as a whole for IDE builds or is this something this PR considers?
I guess, alternatively, we could tweak our NuGet package's props file to pass the relevant /sourcelink flags for the .lib files it ships, but would the linker be okay with potentially passing the same sourcelink.json file twice? For example if the consuming project also uses SourceLink.
tmat
commented
Dec 31, 2022
@nickdalt Sorry for the long delay. Switched focus to some other work. If you're still interested in bringing this PR forward, please rebase to the latest main.
Uh oh!
There was an error while loading. Please reload this page.
Modify Microsoft.SourceLink.Common as follows:-
Makes the assumption that the for a C++ static lib the sourcelink file will be in the same directory with the extension sourcelink.json
Possible additional tasks for maintainer:-
See also issue #580