Skip to content

Commit

Permalink
Move embedded files to contentFiles
Browse files Browse the repository at this point in the history
Props file now only for net40
  • Loading branch information
bording committed Apr 30, 2017
1 parent 62a3dc5 commit 875f128
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 37 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
*.dylib
*.so
*.zip

# nuget package placeholder
*.here
Binary file removed NuGet.exe
Binary file not shown.
24 changes: 10 additions & 14 deletions UpdateLibgit2ToSha.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -88,50 +88,46 @@ Push-Location $libgit2Directory
$binaryFilename = "git2-" + $sha.Substring(0,7)
}

sc -Encoding ASCII (Join-Path $projectDirectory "nuget.package\libgit2\libgit2_hash.txt") $sha
sc -Encoding ASCII (Join-Path $projectDirectory "nuget.package\libgit2\libgit2_filename.txt") $binaryFilename
sc -Encoding ASCII (Join-Path $projectDirectory "nuget.package\contentFiles\any\any\libgit2_hash.txt") $sha
sc -Encoding ASCII (Join-Path $projectDirectory "nuget.package\contentFiles\any\any\libgit2_filename.txt") $binaryFilename

$buildProperties = @"
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<EmbeddedResource Include="`$(MSBuildThisFileDirectory)\..\libgit2\libgit2_hash.txt" />
<EmbeddedResource Include="`$(MSBuildThisFileDirectory)\..\libgit2\libgit2_filename.txt" />
</ItemGroup>
<ItemGroup>
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\runtimes\win7-x64\native\$binaryFilename.dll')" Include="`$(MSBuildThisFileDirectory)\..\runtimes\win7-x64\native\$binaryFilename.dll">
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename.dll')" Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename.dll">
<Link>lib\win32\x64\$binaryFilename.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\runtimes\win7-x64\native\$binaryFilename.pdb')" Include="`$(MSBuildThisFileDirectory)\..\runtimes\win7-x64\native\$binaryFilename.pdb">
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename.pdb')" Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename.pdb">
<Link>lib\win32\x64\$binaryFilename.pdb</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\runtimes\win7-x86\native\$binaryFilename.dll')" Include="`$(MSBuildThisFileDirectory)\..\runtimes\win7-x86\native\$binaryFilename.dll">
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename.dll')" Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename.dll">
<Link>lib\win32\x86\$binaryFilename.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\runtimes\win7-x86\native\$binaryFilename.pdb')" Include="`$(MSBuildThisFileDirectory)\..\runtimes\win7-x86\native\$binaryFilename.pdb">
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename.pdb')" Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename.pdb">
<Link>lib\win32\x86\$binaryFilename.pdb</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\runtimes\osx\native\lib$binaryFilename.dylib')" Include="`$(MSBuildThisFileDirectory)\..\runtimes\osx\native\lib$binaryFilename.dylib">
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\..\runtimes\osx\native\lib$binaryFilename.dylib')" Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\osx\native\lib$binaryFilename.dylib">
<Link>lib\osx\lib$binaryFilename.dylib</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\runtimes\linux-x64\native\lib$binaryFilename.so')" Include="`$(MSBuildThisFileDirectory)\..\runtimes\linux-x64\native\lib$binaryFilename.so">
<None Condition="Exists('`$(MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\lib$binaryFilename.so')" Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\lib$binaryFilename.so">
<Link>lib\linux\x86_64\lib$binaryFilename.so</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="`$(MSBuildThisFileDirectory)\..\libgit2\LibGit2Sharp.dll.config">
<None Include="`$(MSBuildThisFileDirectory)\..\..\libgit2\LibGit2Sharp.dll.config">
<Link>LibGit2Sharp.dll.config</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
"@

sc -Encoding UTF8 (Join-Path $projectDirectory "nuget.package\build\LibGit2Sharp.NativeBinaries.props") $buildProperties
sc -Encoding UTF8 (Join-Path $projectDirectory "nuget.package\build\net40\LibGit2Sharp.NativeBinaries.props") $buildProperties

$dllConfig = @"
<configuration>
Expand Down
2 changes: 1 addition & 1 deletion build.libgit2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $projectDirectory = Split-Path $MyInvocation.MyCommand.Path
$libgit2Directory = Join-Path $projectDirectory "libgit2"
$x86Directory = Join-Path $projectDirectory "nuget.package\runtimes\win7-x86\native"
$x64Directory = Join-Path $projectDirectory "nuget.package\runtimes\win7-x64\native"
$hashFile = Join-Path $projectDirectory "nuget.package\libgit2\libgit2_hash.txt"
$hashFile = Join-Path $projectDirectory "nuget.package\contentFiles\any\any\libgit2_hash.txt"
$sha = Get-Content $hashFile

if (![string]::IsNullOrEmpty($libgit2Name)) {
Expand Down
2 changes: 1 addition & 1 deletion build.libgit2.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

LIBGIT2SHA=`cat ./nuget.package/libgit2/libgit2_hash.txt`
LIBGIT2SHA=`cat ./nuget.package/contentFiles/any/any/libgit2_hash.txt`
SHORTSHA=${LIBGIT2SHA:0:7}

rm -rf libgit2/build
Expand Down
6 changes: 1 addition & 5 deletions buildpackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,21 @@ $linuxDirectory = Join-Path $projectDirectory "nuget.package\runtimes\linux-x64\
if ( -Not (Test-Path $x86Directory\*.dll) )
{
mkdir -fo $x86Directory > $null
Set-Content $x86Directory\addbinaries.here $null
}

if ( -Not (Test-Path $x64Directory\*.dll) )
{
mkdir -fo $x64Directory > $null
Set-Content $x64Directory\addbinaries.here $null
}

if ( -Not (Test-Path $osxDirectory\*.dylib) )
{
mkdir -fo $osxDirectory > $null
Set-Content $osxDirectory\addbinaries.here $null
}

if ( -Not (Test-Path $linuxDirectory\*.so) )
{
mkdir -fo $linuxDirectory > $null
Set-Content $linuxDirectory\addbinaries.here $null
}

.\Nuget.exe Pack nuget.package\NativeBinaries.nuspec -Version $version$versionSuffix -NoPackageAnalysis
.\nuget.exe Pack nuget.package\NativeBinaries.nuspec -Version $version$versionSuffix -NoPackageAnalysis
2 changes: 0 additions & 2 deletions download.build.artifacts.and.package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ Add-Type -assembly "System.Io.Compression.Filesystem"

Write-Host -ForegroundColor "Yellow" "Including non Windows build artifacts"
Move-Item "$($linuxBins.FullName).ext\libgit2\linux-x64\native\*.so" "$($package.FullName).ext\runtimes\linux-x64\native"
Remove-Item "$($package.FullName).ext\runtimes\linux-x64\native\addbinaries.here"
Move-Item "$($osxBins.FullName).ext\libgit2\osx\native\*.dylib" "$($package.FullName).ext\runtimes\osx\native"
Remove-Item "$($package.FullName).ext\runtimes\osx\native\addbinaries.here"

Write-Host -ForegroundColor "Yellow" "Building final NuGet package"
Push-location "$($package.FullName).ext"
Expand Down
Binary file added nuget.exe
Binary file not shown.
3 changes: 3 additions & 0 deletions nuget.package/NativeBinaries.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
<iconUrl>https://raw.githubusercontent.com/libgit2/libgit2sharp/master/square-logo.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Native binaries for LibGit2Sharp</description>
<contentFiles>
<files include="**/*" buildAction="EmbeddedResource" />
</contentFiles>
</metadata>
</package>
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\..\libgit2\libgit2_hash.txt" />
<EmbeddedResource Include="$(MSBuildThisFileDirectory)\..\libgit2\libgit2_filename.txt" />
</ItemGroup>
<ItemGroup>
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\runtimes\win7-x64\native\git2-1196807.dll')" Include="$(MSBuildThisFileDirectory)\..\runtimes\win7-x64\native\git2-1196807.dll">
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\git2-1196807.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\git2-1196807.dll">
<Link>lib\win32\x64\git2-1196807.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\runtimes\win7-x64\native\git2-1196807.pdb')" Include="$(MSBuildThisFileDirectory)\..\runtimes\win7-x64\native\git2-1196807.pdb">
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\git2-1196807.pdb')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\git2-1196807.pdb">
<Link>lib\win32\x64\git2-1196807.pdb</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\runtimes\win7-x86\native\git2-1196807.dll')" Include="$(MSBuildThisFileDirectory)\..\runtimes\win7-x86\native\git2-1196807.dll">
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\git2-1196807.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\git2-1196807.dll">
<Link>lib\win32\x86\git2-1196807.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\runtimes\win7-x86\native\git2-1196807.pdb')" Include="$(MSBuildThisFileDirectory)\..\runtimes\win7-x86\native\git2-1196807.pdb">
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\git2-1196807.pdb')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\git2-1196807.pdb">
<Link>lib\win32\x86\git2-1196807.pdb</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\runtimes\osx\native\libgit2-1196807.dylib')" Include="$(MSBuildThisFileDirectory)\..\runtimes\osx\native\libgit2-1196807.dylib">
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\osx\native\libgit2-1196807.dylib')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\osx\native\libgit2-1196807.dylib">
<Link>lib\osx\libgit2-1196807.dylib</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\runtimes\linux-x64\native\libgit2-1196807.so')" Include="$(MSBuildThisFileDirectory)\..\runtimes\linux-x64\native\libgit2-1196807.so">
<None Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\libgit2-1196807.so')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\libgit2-1196807.so">
<Link>lib\linux\x86_64\libgit2-1196807.so</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)\..\libgit2\LibGit2Sharp.dll.config">
<None Include="$(MSBuildThisFileDirectory)\..\..\libgit2\LibGit2Sharp.dll.config">
<Link>LibGit2Sharp.dll.config</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 875f128

Please sign in to comment.