-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dotnet] add sourcelink support (#20054)
Fixes #18968 We provide a mapping to the checked in source files via SourceLink.json and the rest of the generated/untracked sources are embedded into the PDB to provide a more comprehensive debugging experience. Since we invoke CSC directly, there were a few workarounds that had to be implemented (ex: implementing a helper script to account for untracked sources instead of simply using the EmbedUntrackedSources MSBuild property). As for testing, the newly added support was validated via the dotnet sourcelink tool which confirmed all the sources in the PDB either had valid urls or were embedded. `sourcelink test Microsoft.MacCatalyst.pdb` —> `sourcelink test passed: Microsoft.MacCatalyst.pdb` The PDB size does increase in size after embedding; Microsoft.MacCatalyst.pdb went from 5 MB to 15.7 MB. But considering it would significantly help improve the debugging experience, be consistent with Android’s offerings, and it’s a highlighted attribute on the NuGet package explorer I think it’s a worthy size increase. Refs: dotnet/android#7298 dotnet/roslyn#12625 https://github.com/dotnet/sourcelink/tree/main/docs --------- Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com> Co-authored-by: Alex Soto <alex@alexsoto.me> Co-authored-by: Michael Cummings (MSFT) <mcumming@microsoft.com> Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
- Loading branch information
1 parent
caf8517
commit 297f12d
Showing
7 changed files
with
143 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash -e | ||
|
||
gen_sources="$1" | ||
dotnet_sources="$2" | ||
IFS=$'\n' | ||
arr=($(<$gen_sources)) | ||
IFS=' ' | ||
read -ra sources_array <<< "$dotnet_sources" | ||
arr+=("${sources_array[@]}") | ||
git_files=($(git ls-files)) | ||
IFS=$'\n' | ||
filtered_files=($(printf "%s\n" "${arr[@]}" | grep -vF "${git_files[*]}")) | ||
IFS=',' | ||
echo "-embed:${filtered_files[*]}" | ||
unset IFS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s | ||
|
||
using System.IO; | ||
using System.Text; | ||
|
||
var args = Args; | ||
var idx = 0; | ||
var latestCommit = args [idx++]; | ||
var src = args [idx++]; | ||
var outputPath = args [idx++]; | ||
|
||
using (var writer = new StreamWriter (outputPath)) { | ||
writer.WriteLine ("{"); | ||
writer.WriteLine (" \"documents\": {"); | ||
writer.WriteLine ($" \"{src}*\": \"https://raw.githubusercontent.com/xamarin/xamarin-macios/{latestCommit}/src*\""); | ||
writer.WriteLine (" }"); | ||
writer.WriteLine ("}"); | ||
} | ||
|
||
Environment.Exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.