Skip to content

Commit

Permalink
fix libgit2#876 adds source indexing using SourceLink.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
ctaggart committed Mar 22, 2015
1 parent 7cbd0c6 commit c0afb34
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
24 changes: 19 additions & 5 deletions nuget.package/BuildNugetPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

Param(
[Parameter(Mandatory=$true)]
[string]$commitSha
[string]$commitSha,
[scriptblock]$postBuild
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -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")

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions nuget.package/LibGit2Sharp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<file src="..\CHANGES.md" target="App_Readme\LibGit2Sharp.CHANGES.md" />
<file src="..\nuget.package\build\*.*" target="build\net40" />
<file src="..\Lib\NativeBinaries\libgit2.license.txt" target="App_Readme" />
<file src="bin\$configuration$\$id$.pdb" target="lib\net40" />
</files>
</package>

0 comments on commit c0afb34

Please sign in to comment.