From c0afb3407b7767af089d02a0c27958712bc9f15d Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Sun, 22 Mar 2015 14:37:20 -0700 Subject: [PATCH] fix libgit2/libgit2sharp#876 adds source indexing using SourceLink.exe --- appveyor.yml | 3 ++- nuget.package/BuildNugetPackage.ps1 | 24 +++++++++++++++++++----- nuget.package/LibGit2Sharp.nuspec | 1 + 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dff792e28..c67ccc7e9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,6 +39,7 @@ install: $ShouldPublishNugetArtifact = "$($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null)" $Env:SHOULD_PUBLISH_NUGET_ARTIFACT = $ShouldPublishNugetArtifact Write-Host "Should publish Nuget artifact = $($Env:SHOULD_PUBLISH_NUGET_ARTIFACT)" + cinst sourcelink -y assembly_info: patch: true @@ -62,7 +63,7 @@ test_script: on_success: - ps: | - & "$env:APPVEYOR_BUILD_FOLDER\nuget.package\BuildNugetPackage.ps1" "$env:APPVEYOR_REPO_COMMIT" + & "$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%' } Add-Type -Path "$env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp\bin\Release\LibGit2Sharp.dll" Write-Host "LibGit2Sharp version = $([LibGit2Sharp.GlobalSettings]::Version)" -ForegroundColor "Magenta" If ($Env:SHOULD_PUBLISH_NUGET_ARTIFACT -eq $True) diff --git a/nuget.package/BuildNugetPackage.ps1 b/nuget.package/BuildNugetPackage.ps1 index 5dac796e0..6770c14fc 100644 --- a/nuget.package/BuildNugetPackage.ps1 +++ b/nuget.package/BuildNugetPackage.ps1 @@ -8,7 +8,8 @@ Param( [Parameter(Mandatory=$true)] - [string]$commitSha + [string]$commitSha, + [scriptblock]$postBuild ) $ErrorActionPreference = "Stop" @@ -51,10 +52,19 @@ function Clean-OutputFolder($folder) { } } +# From http://www.dougfinke.com/blog/index.php/2010/12/01/note-to-self-how-to-programmatically-get-the-msbuild-path-in-powershell/ + +Function Get-MSBuild { + $lib = [System.Runtime.InteropServices.RuntimeEnvironment] + $rtd = $lib::GetRuntimeDirectory() + Join-Path $rtd msbuild.exe +} + ################# $root = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition $projectPath = Join-Path $root "..\LibGit2Sharp" +$slnPath = Join-Path $projectPath "..\LibGit2Sharp.sln" Remove-Item (Join-Path $projectPath "*.nupkg") @@ -68,11 +78,15 @@ Push-Location $projectPath try { Set-Content -Encoding ASCII $(Join-Path $projectPath "libgit2sharp_hash.txt") $commitSha - Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Restore "$(Join-Path $projectPath "..\LibGit2Sharp.sln")" } + Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Restore "$slnPath" } + Run-Command { & (Get-MSBuild) "$slnPath" "/verbosity:minimal" "/p:Configuration=Release" } + + If ($postBuild) { + Write-Host -ForegroundColor "Green" "Run post build script..." + Run-Command { & ($postBuild) } + } - # Cf. https://stackoverflow.com/questions/21728450/nuget-exclude-files-from-symbols-package-in-nuspec - Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack -Build -Symbols "$(Join-Path $projectPath "LibGit2Sharp.csproj")" -Prop Configuration=Release -Exclude "**/NativeBinaries/**/*.*"} - Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack "$(Join-Path $projectPath "LibGit2Sharp.csproj")" -Prop Configuration=Release } + Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack -Prop Configuration=Release } } finally { Pop-Location diff --git a/nuget.package/LibGit2Sharp.nuspec b/nuget.package/LibGit2Sharp.nuspec index f605336c7..3b9974187 100644 --- a/nuget.package/LibGit2Sharp.nuspec +++ b/nuget.package/LibGit2Sharp.nuspec @@ -24,5 +24,6 @@ +