Skip to content
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

Generated compile_commands.json is invalid on Unix systems #121

Open
alexrp opened this issue Mar 31, 2024 · 1 comment
Open

Generated compile_commands.json is invalid on Unix systems #121

alexrp opened this issue Mar 31, 2024 · 1 comment
Assignees
Labels
area: sdk Issues related to the MSBuild SDK. state: confirmed Bugs that have been confirmed. type: bug Issues that are classified as bug reports.
Milestone

Comments

@alexrp
Copy link
Sponsor Member

alexrp commented Mar 31, 2024

\ characters are replaced with / because MSBuild thinks they're path separators, resulting in invalid JSON...

<Target Name="_GatherCompileCommands"
Condition="'$(_RefreshCompileCommands)' == 'true'">
<ItemGroup>
<_CdbFragments Include="$(_CommandFragmentsPath)/*.json" />
<_CdbFragments Update="@(_CdbFragments)"
Json="$([System.IO.File]::ReadAllText('%(FullPath)').Trim().TrimEnd(','))" />
</ItemGroup>
<PropertyGroup>
<_CompileCommands>
<![CDATA[
[ @(_CdbFragments->'%(Json)', ', ') ]
]]>
</_CompileCommands>
</PropertyGroup>
<WriteLinesToFile File="$(CommandsPath)"
Lines="$(_CompileCommands)"
Overwrite="true" />
</Target>

@alexrp alexrp added type: bug Issues that are classified as bug reports. state: confirmed Bugs that have been confirmed. area: sdk Issues related to the MSBuild SDK. labels Mar 31, 2024
@alexrp alexrp added this to the v5.0 milestone Mar 31, 2024
@alexrp alexrp self-assigned this Mar 31, 2024
@alexrp
Copy link
Sponsor Member Author

alexrp commented Apr 1, 2024

Seems like we might have to use an inline task for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: sdk Issues related to the MSBuild SDK. state: confirmed Bugs that have been confirmed. type: bug Issues that are classified as bug reports.
Development

No branches or pull requests

1 participant