@@ -16,7 +16,7 @@ $self = Split-Path -Leaf $MyInvocation.MyCommand.Path
16
16
$projectDirectory = Split-Path $MyInvocation.MyCommand.Path
17
17
$libgit2Directory = Join-Path $projectDirectory " libgit2"
18
18
19
- function Run -Command ([scriptblock ]$Command , [switch ]$Fatal , [switch ]$Quiet ) {
19
+ function Invoke -Command ([scriptblock ]$Command , [switch ]$Fatal , [switch ]$Quiet ) {
20
20
$output = " "
21
21
if ($Quiet ) {
22
22
$output = & $Command 2>&1
@@ -67,18 +67,18 @@ Push-Location $libgit2Directory
67
67
$git = Find-Git
68
68
69
69
Write-Output " Fetching..."
70
- Run - Command - Quiet { & $git fetch }
70
+ Invoke -Command - Quiet { & $git fetch }
71
71
72
72
Write-Output " Verifying $sha ..."
73
73
$sha = & $git rev- parse $sha
74
74
if ($LASTEXITCODE -ne 0 ) {
75
75
write-host - foregroundcolor red " Error: invalid SHA. USAGE: $self <SHA>"
76
- popd
76
+ Pop-Location
77
77
break
78
78
}
79
79
80
80
Write-Output " Checking out $sha ..."
81
- Run - Command - Quiet - Fatal { & $git checkout $sha }
81
+ Invoke -Command - Quiet - Fatal { & $git checkout $sha }
82
82
83
83
Pop-Location
84
84
@@ -88,46 +88,63 @@ Push-Location $libgit2Directory
88
88
$binaryFilename = " git2-" + $sha.Substring (0 , 7 )
89
89
}
90
90
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
91
+ Set-Content - Encoding ASCII (Join-Path $projectDirectory " nuget.package\libgit2\libgit2_hash.txt" ) $sha
93
92
94
93
$buildProperties = @"
95
- <?xml version="1.0" encoding="utf-8"?>
96
- <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
97
- <ItemGroup>
98
- <None Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename .dll')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename .dll">
99
- <Link>lib\win32\x64\$binaryFilename .dll</Link>
100
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
101
- </None>
102
- <None Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename .pdb')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename .pdb">
103
- <Link>lib\win32\x64\$binaryFilename .pdb</Link>
104
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
105
- </None>
106
- <None Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename .dll')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename .dll">
107
- <Link>lib\win32\x86\$binaryFilename .dll</Link>
108
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
109
- </None>
110
- <None Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename .pdb')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename .pdb">
111
- <Link>lib\win32\x86\$binaryFilename .pdb</Link>
112
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
113
- </None>
114
- <None Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\osx\native\lib$binaryFilename .dylib')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\osx\native\lib$binaryFilename .dylib">
115
- <Link>lib\osx\lib$binaryFilename .dylib</Link>
116
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
117
- </None>
118
- <None Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\lib$binaryFilename .so')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\lib$binaryFilename .so">
119
- <Link>lib\linux\x86_64\lib$binaryFilename .so</Link>
120
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
121
- </None>
122
- <None Include="`$ (MSBuildThisFileDirectory)\..\..\libgit2\LibGit2Sharp.dll.config">
123
- <Link>LibGit2Sharp.dll.config</Link>
124
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
125
- </None>
126
- </ItemGroup>
94
+ <Project>
95
+ <PropertyGroup>
96
+ <MSBuildAllProjects>`$ (MSBuildAllProjects);`$ (MSBuildThisFileFullPath)</MSBuildAllProjects>
97
+ <libgit2_propsfile>`$ (MSBuildThisFileFullPath)</libgit2_propsfile>
98
+ <libgit2_hash>$sha </libgit2_hash>
99
+ <libgit2_filename>$binaryFilename </libgit2_filename>
100
+ </PropertyGroup>
101
+ </Project>
102
+ "@
103
+
104
+ Set-Content - Encoding UTF8 (Join-Path $projectDirectory " nuget.package\build\LibGit2Sharp.NativeBinaries.props" ) $buildProperties
105
+
106
+ $net461BuildProperties = @"
107
+ <Project>
108
+ <PropertyGroup>
109
+ <MSBuildAllProjects>`$ (MSBuildAllProjects);`$ (MSBuildThisFileFullPath)</MSBuildAllProjects>
110
+ <libgit2_propsfile>`$ (MSBuildThisFileFullPath)</libgit2_propsfile>
111
+ <libgit2_hash>$sha </libgit2_hash>
112
+ <libgit2_filename>$binaryFilename </libgit2_filename>
113
+ </PropertyGroup>
114
+ <ItemGroup>
115
+ <ContentWithTargetPath Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename .dll')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename .dll">
116
+ <TargetPath>lib\win32\x64\$binaryFilename .dll</TargetPath>
117
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
118
+ </ContentWithTargetPath>
119
+ <ContentWithTargetPath Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename .pdb')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x64\native\$binaryFilename .pdb">
120
+ <TargetPath>lib\win32\x64\$binaryFilename .pdb</TargetPath>
121
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
122
+ </ContentWithTargetPath>
123
+ <ContentWithTargetPath Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename .dll')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename .dll">
124
+ <TargetPath>lib\win32\x86\$binaryFilename .dll</TargetPath>
125
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
126
+ </ContentWithTargetPath>
127
+ <ContentWithTargetPath Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename .pdb')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\win7-x86\native\$binaryFilename .pdb">
128
+ <TargetPath>lib\win32\x86\$binaryFilename .pdb</TargetPath>
129
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
130
+ </ContentWithTargetPath>
131
+ <ContentWithTargetPath Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\osx\native\lib$binaryFilename .dylib')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\osx\native\lib$binaryFilename .dylib">
132
+ <TargetPath>lib\osx\lib$binaryFilename .dylib</TargetPath>
133
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
134
+ </ContentWithTargetPath>
135
+ <ContentWithTargetPath Condition="Exists('`$ (MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\lib$binaryFilename .so')" Include="`$ (MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\lib$binaryFilename .so">
136
+ <TargetPath>lib\linux\x86_64\lib$binaryFilename .so</TargetPath>
137
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
138
+ </ContentWithTargetPath>
139
+ <ContentWithTargetPath Include="`$ (MSBuildThisFileDirectory)\..\..\libgit2\LibGit2Sharp.dll.config">
140
+ <TargetPath>LibGit2Sharp.dll.config</TargetPath>
141
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
142
+ </ContentWithTargetPath>
143
+ </ItemGroup>
127
144
</Project>
128
145
"@
129
146
130
- sc - Encoding UTF8 (Join-Path $projectDirectory " nuget.package\build\net40 \LibGit2Sharp.NativeBinaries.props" ) $buildProperties
147
+ Set-Content - Encoding UTF8 (Join-Path $projectDirectory " nuget.package\build\net461 \LibGit2Sharp.NativeBinaries.props" ) $net461BuildProperties
131
148
132
149
$dllConfig = @"
133
150
<configuration>
@@ -136,7 +153,7 @@ Push-Location $libgit2Directory
136
153
</configuration>
137
154
"@
138
155
139
- sc - Encoding UTF8 (Join-Path $projectDirectory " nuget.package\libgit2\LibGit2Sharp.dll.config" ) $dllConfig
156
+ Set-Content - Encoding UTF8 (Join-Path $projectDirectory " nuget.package\libgit2\LibGit2Sharp.dll.config" ) $dllConfig
140
157
141
158
Write-Output " Done!"
142
159
}
0 commit comments