forked from xamarin/xamarin-macios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes xamarin#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 sourcelink dotnet 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; for example, 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
- Loading branch information
1 parent
b7f4bef
commit 55125c2
Showing
3 changed files
with
63 additions
and
0 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,28 @@ | ||
#!/bin/bash -e | ||
|
||
find_files() { | ||
find "$(realpath "$1")" -type f -name "$2" -exec printf "%s," {} + | ||
} | ||
|
||
build_dir="$1" | ||
platform="$2" | ||
|
||
if [ "$platform" = "macos" ]; then | ||
modified_platform="mac" | ||
else | ||
modified_platform="$platform" | ||
fi | ||
|
||
root="$(realpath "$build_dir/../../../..")" | ||
|
||
# find generated/untracked files | ||
# impt to include, otherwise sourcelink test will fail (don't have a valid source file to link to) | ||
files=$(find_files "$build_dir" "*.g.cs") | ||
files+=$(find_files "$root/src/build/common" "*.cs") | ||
files+=$(find_files "$root/src/build/$modified_platform" "AssemblyInfo.cs") | ||
files+=$(find_files "$root/src/build/$modified_platform" "Constants.cs") | ||
files+=$(find_files "$root/src/build/dotnet" "Constants.$platform.generated.cs") | ||
files+=$(find_files "$root/runtime" "*generated.cs") | ||
files+=$(find_files "$root/src" "MinimumVersions.cs") | ||
files="-embed:${files%,}" | ||
echo $files |
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,25 @@ | ||
#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp | ||
|
||
using System.IO; | ||
using System.Text; | ||
|
||
var args = Environment.GetCommandLineArgs (); | ||
|
||
var latestCommit = args [2]; | ||
var src = args [3]; | ||
var outputPath = args [4]; | ||
|
||
var json = new StringBuilder (); | ||
json.AppendLine ("{"); | ||
json.AppendLine (" \"documents\": {"); | ||
|
||
json.AppendLine ($" \"{src}*\": \"https://raw.githubusercontent.com/xamarin/xamarin-macios/{latestCommit}/src/*\""); | ||
json.AppendLine (" }"); | ||
json.AppendLine ("}"); | ||
|
||
string outputData = json.ToString (); | ||
using (StreamWriter writer = new StreamWriter(outputPath)) | ||
{ | ||
writer.Write(outputData); | ||
} | ||
|