Skip to content

Commit 5610f27

Browse files
committed
Fix packaging to include portable assembly
1 parent 38cfbcc commit 5610f27

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

nuget.package/BuildNugetPackage.ps1

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#>
88

99
Param(
10-
[Parameter(Mandatory=$true)]
11-
[string]$commitSha,
1210
[scriptblock]$postBuild
1311
)
1412

@@ -60,34 +58,37 @@ Function Get-MSBuild {
6058

6159
#################
6260

61+
$configuration = 'release'
6362
$root = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
63+
$OutDir = Join-Path $root "bin\$configuration"
6464
$projectPath = Join-Path $root "..\LibGit2Sharp"
6565
$slnPath = Join-Path $projectPath "..\LibGit2Sharp.sln"
66+
$nuspecPath = Join-Path $root 'LibGit2Sharp.nuspec'
6667

67-
Remove-Item (Join-Path $projectPath "*.nupkg")
68-
69-
Clean-OutputFolder (Join-Path $projectPath "bin\")
70-
Clean-OutputFolder (Join-Path $projectPath "obj\")
71-
72-
# The nuspec file needs to be next to the csproj, so copy it there during the pack operation
73-
Copy-Item (Join-Path $root "LibGit2Sharp.nuspec") $projectPath
68+
if (-not (Test-Path $OutDir)) {
69+
$null = md $OutDir
70+
}
71+
Remove-Item (Join-Path $OutDir "*.nupkg")
7472

75-
Push-Location $projectPath
73+
Push-Location $root
7674

7775
try {
76+
$DependencyBasePath = $null # workaround script issue in NB.GV
77+
$versionInfo = & "$env:userprofile\.nuget\packages\Nerdbank.GitVersioning\1.5.51\tools\Get-Version.ps1"
78+
$commitSha = $versionInfo.GitCommitId
79+
7880
Set-Content -Encoding ASCII $(Join-Path $projectPath "libgit2sharp_hash.txt") $commitSha
7981
Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Restore "$slnPath" }
80-
Run-Command { & (Get-MSBuild) "$slnPath" "/verbosity:minimal" "/p:Configuration=Release" "/m" }
82+
Run-Command { & (Get-MSBuild) "$slnPath" "/verbosity:minimal" "/p:Configuration=$configuration" "/m" }
8183

8284
If ($postBuild) {
8385
Write-Host -ForegroundColor "Green" "Run post build script..."
8486
Run-Command { & ($postBuild) }
8587
}
8688

87-
Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack -Prop Configuration=Release }
89+
Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack $nuspecPath -OutputDirectory $OutDir -Prop "Configuration=$configuration;GitCommitIdShort=$($versionInfo.GitCommitIdShort)" -Version "$($versionInfo.NuGetPackageVersion)" }
8890
}
8991
finally {
9092
Pop-Location
91-
Remove-Item (Join-Path $projectPath "LibGit2Sharp.nuspec")
9293
Set-Content -Encoding ASCII $(Join-Path $projectPath "libgit2sharp_hash.txt") "unknown"
9394
}

nuget.package/LibGit2Sharp.nuspec

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
<?xml version="1.0"?>
22
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
33
<metadata minClientVersion="2.7">
4-
<id>$id$</id>
4+
<id>LibGit2Sharp</id>
55
<version>$version$</version>
6-
<authors>$author$</authors>
7-
<owners>nulltoken</owners>
8-
<licenseUrl>https://github.com/libgit2/libgit2sharp/raw/master/LICENSE.md</licenseUrl>
6+
<authors>LibGit2Sharp contributors</authors>
7+
<owners>LibGit2Sharp contributors</owners>
8+
<licenseUrl>https://github.com/libgit2/libgit2sharp/raw/$GitCommitIdShort$/LICENSE.md</licenseUrl>
99
<projectUrl>https://github.com/libgit2/libgit2sharp/</projectUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
11-
<description>$description$</description>
12-
<releaseNotes>https://github.com/libgit2/libgit2sharp/blob/master/CHANGES.md#libgit2sharp-changes</releaseNotes>
13-
<iconUrl>https://github.com/libgit2/libgit2sharp/raw/master/square-logo.png</iconUrl>
11+
<description>LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono.</description>
12+
<releaseNotes>https://github.com/libgit2/libgit2sharp/blob/$GitCommitIdShort$/CHANGES.md#libgit2sharp-changes</releaseNotes>
13+
<iconUrl>https://github.com/libgit2/libgit2sharp/raw/$GitCommitIdShort$/square-logo.png</iconUrl>
1414
<tags>libgit2 git wrapper bindings API dvcs vcs</tags>
15+
<dependencies>
16+
<dependency id="LibGit2Sharp.NativeBinaries" version="[1.0.164]" exclude="Build,Analyzers" />
17+
</dependencies>
1518
</metadata>
1619
<files>
1720
<file src="..\README.md" target="App_Readme\LibGit2Sharp.README.md" />
1821
<file src="..\LICENSE.md" target="App_Readme\LibGit2Sharp.LICENSE.md" />
1922
<file src="..\CHANGES.md" target="App_Readme\LibGit2Sharp.CHANGES.md" />
20-
<file src="bin\$configuration$\$id$.pdb" target="lib\net40" />
21-
<file src="..\LibGit2Sharp.Portable\bin\$configuration$\$id$.dll" target="lib\netstandard1.3" />
23+
<file src="..\LibGit2Sharp\bin\$configuration$\LibGit2Sharp.???" target="lib\net40" />
24+
<file src="..\LibGit2Sharp.Portable\bin\$configuration$\LibGit2Sharp.???" target="lib\netstandard1.3" />
2225
</files>
2326
</package>

0 commit comments

Comments
 (0)