Skip to content

Commit b02d5e3

Browse files
committed
Pass libgit2 info via MSBuild properties instead of files
1 parent 9e087d8 commit b02d5e3

File tree

6 files changed

+38
-21
lines changed

6 files changed

+38
-21
lines changed

UpdateLibgit2ToSha.ps1

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<#
22
.SYNOPSIS
3-
Updates the libgit2 submodule to the specified commit and updates libgit2_hash.txt and NativeBinaries.props with the new hash value.
3+
Updates the libgit2 submodule to the specified commit and updates NativeBinaries.props with the new hash value.
44
.PARAMETER sha
55
Desired libgit2 version. This is run through `git rev-parse`, so branch names are okay too.
66
#>
@@ -88,11 +88,23 @@ Push-Location $libgit2Directory
8888
$binaryFilename = "git2-" + $sha.Substring(0,7)
8989
}
9090

91-
sc -Encoding ASCII (Join-Path $projectDirectory "nuget.package\contentFiles\any\any\libgit2_hash.txt") $sha
92-
sc -Encoding ASCII (Join-Path $projectDirectory "nuget.package\contentFiles\any\any\libgit2_filename.txt") $binaryFilename
93-
9491
$buildProperties = @"
9592
<Project>
93+
<PropertyGroup>
94+
<libgit2_hash>$sha</libgit2_hash>
95+
<libgit2_filename>$binaryFilename</libgit2_filename>
96+
</PropertyGroup>
97+
</Project>
98+
"@
99+
100+
sc -Encoding UTF8 (Join-Path $projectDirectory "nuget.package\build\LibGit2Sharp.NativeBinaries.props") $buildProperties
101+
102+
$net40BuildProperties = @"
103+
<Project>
104+
<PropertyGroup>
105+
<libgit2_hash>$sha</libgit2_hash>
106+
<libgit2_filename>$binaryFilename</libgit2_filename>
107+
</PropertyGroup>
96108
<ItemGroup>
97109
<ContentWithTargetPath Condition="Exists('`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename.dll')" Include="`$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename.dll">
98110
<TargetPath>lib\win32\x64\$binaryFilename.dll</TargetPath>
@@ -126,7 +138,7 @@ Push-Location $libgit2Directory
126138
</Project>
127139
"@
128140

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

131143
$dllConfig = @"
132144
<configuration>
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3-
<metadata>
4-
<id>LibGit2Sharp.NativeBinaries</id>
5-
<version>1.0.155</version>
6-
<authors>LibGit2Sharp contributors</authors>
7-
<owners>nulltoken</owners>
8-
<licenseUrl>https://raw.githubusercontent.com/libgit2/libgit2/master/COPYING</licenseUrl>
9-
<projectUrl>https://github.com/libgit2/libgit2sharp.nativebinaries</projectUrl>
10-
<iconUrl>https://raw.githubusercontent.com/libgit2/libgit2sharp/master/square-logo.png</iconUrl>
11-
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12-
<description>Native binaries for LibGit2Sharp</description>
13-
<contentFiles>
14-
<files include="**/*" buildAction="EmbeddedResource" />
15-
</contentFiles>
16-
</metadata>
3+
<metadata>
4+
<id>LibGit2Sharp.NativeBinaries</id>
5+
<version>1.0.155</version>
6+
<authors>LibGit2Sharp contributors</authors>
7+
<owners>nulltoken</owners>
8+
<licenseUrl>https://raw.githubusercontent.com/libgit2/libgit2/master/COPYING</licenseUrl>
9+
<projectUrl>https://github.com/libgit2/libgit2sharp.nativebinaries</projectUrl>
10+
<iconUrl>https://raw.githubusercontent.com/libgit2/libgit2sharp/master/square-logo.png</iconUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>Native binaries for LibGit2Sharp</description>
13+
</metadata>
1714
</package>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<libgit2_hash>15e119375018fba121cf58e02a9f17fe22df0df8</libgit2_hash>
4+
<libgit2_filename>git2-15e1193</libgit2_filename>
5+
</PropertyGroup>
6+
</Project>

nuget.package/build/net40/LibGit2Sharp.NativeBinaries.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<Project>
2+
<PropertyGroup>
3+
<libgit2_hash>15e119375018fba121cf58e02a9f17fe22df0df8</libgit2_hash>
4+
<libgit2_filename>git2-15e1193</libgit2_filename>
5+
</PropertyGroup>
26
<ItemGroup>
37
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\git2-15e1193.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\git2-15e1193.dll">
48
<TargetPath>lib\win32\x64\git2-15e1193.dll</TargetPath>

nuget.package/contentFiles/any/any/libgit2_filename.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

nuget.package/contentFiles/any/any/libgit2_hash.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)