Skip to content

Commit c0afb34

Browse files
committed
fix #876 adds source indexing using SourceLink.exe
1 parent 7cbd0c6 commit c0afb34

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ install:
3939
$ShouldPublishNugetArtifact = "$($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null)"
4040
$Env:SHOULD_PUBLISH_NUGET_ARTIFACT = $ShouldPublishNugetArtifact
4141
Write-Host "Should publish Nuget artifact = $($Env:SHOULD_PUBLISH_NUGET_ARTIFACT)"
42+
cinst sourcelink -y
4243
4344
assembly_info:
4445
patch: true
@@ -62,7 +63,7 @@ test_script:
6263

6364
on_success:
6465
- ps: |
65-
& "$env:APPVEYOR_BUILD_FOLDER\nuget.package\BuildNugetPackage.ps1" "$env:APPVEYOR_REPO_COMMIT"
66+
& "$env:APPVEYOR_BUILD_FOLDER\nuget.package\BuildNugetPackage.ps1" -commitSha "$env:APPVEYOR_REPO_COMMIT" -postBuild { sourcelink index -pr LibGit2Sharp.csproj -pp Configuration Release -nf Core\UniqueIdentifier.cs -nf Properties\AssemblyInfo.cs -r .. -u 'https://raw.githubusercontent.com/libgit2/libgit2sharp/{0}/%var2%' }
6667
Add-Type -Path "$env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp\bin\Release\LibGit2Sharp.dll"
6768
Write-Host "LibGit2Sharp version = $([LibGit2Sharp.GlobalSettings]::Version)" -ForegroundColor "Magenta"
6869
If ($Env:SHOULD_PUBLISH_NUGET_ARTIFACT -eq $True)

nuget.package/BuildNugetPackage.ps1

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
Param(
1010
[Parameter(Mandatory=$true)]
11-
[string]$commitSha
11+
[string]$commitSha,
12+
[scriptblock]$postBuild
1213
)
1314

1415
$ErrorActionPreference = "Stop"
@@ -51,10 +52,19 @@ function Clean-OutputFolder($folder) {
5152
}
5253
}
5354

55+
# From http://www.dougfinke.com/blog/index.php/2010/12/01/note-to-self-how-to-programmatically-get-the-msbuild-path-in-powershell/
56+
57+
Function Get-MSBuild {
58+
$lib = [System.Runtime.InteropServices.RuntimeEnvironment]
59+
$rtd = $lib::GetRuntimeDirectory()
60+
Join-Path $rtd msbuild.exe
61+
}
62+
5463
#################
5564

5665
$root = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
5766
$projectPath = Join-Path $root "..\LibGit2Sharp"
67+
$slnPath = Join-Path $projectPath "..\LibGit2Sharp.sln"
5868

5969
Remove-Item (Join-Path $projectPath "*.nupkg")
6070

@@ -68,11 +78,15 @@ Push-Location $projectPath
6878

6979
try {
7080
Set-Content -Encoding ASCII $(Join-Path $projectPath "libgit2sharp_hash.txt") $commitSha
71-
Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Restore "$(Join-Path $projectPath "..\LibGit2Sharp.sln")" }
81+
Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Restore "$slnPath" }
82+
Run-Command { & (Get-MSBuild) "$slnPath" "/verbosity:minimal" "/p:Configuration=Release" }
83+
84+
If ($postBuild) {
85+
Write-Host -ForegroundColor "Green" "Run post build script..."
86+
Run-Command { & ($postBuild) }
87+
}
7288

73-
# Cf. https://stackoverflow.com/questions/21728450/nuget-exclude-files-from-symbols-package-in-nuspec
74-
Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack -Build -Symbols "$(Join-Path $projectPath "LibGit2Sharp.csproj")" -Prop Configuration=Release -Exclude "**/NativeBinaries/**/*.*"}
75-
Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack "$(Join-Path $projectPath "LibGit2Sharp.csproj")" -Prop Configuration=Release }
89+
Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack -Prop Configuration=Release }
7690
}
7791
finally {
7892
Pop-Location

nuget.package/LibGit2Sharp.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
<file src="..\CHANGES.md" target="App_Readme\LibGit2Sharp.CHANGES.md" />
2525
<file src="..\nuget.package\build\*.*" target="build\net40" />
2626
<file src="..\Lib\NativeBinaries\libgit2.license.txt" target="App_Readme" />
27+
<file src="bin\$configuration$\$id$.pdb" target="lib\net40" />
2728
</files>
2829
</package>

0 commit comments

Comments
 (0)