Teach UpdateLibgit2ToSha.ps1 to take arbitrary libgit2 library name.

This commit is contained in:
Jameson Miller 2013-07-03 15:44:11 -04:00 коммит произвёл nulltoken
Родитель a496c1c9fb
Коммит 384ce7330d
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -5,6 +5,8 @@
Desired libgit2 version. This is run through `git rev-parse`, so branch names are okay too. Desired libgit2 version. This is run through `git rev-parse`, so branch names are okay too.
.PARAMETER vs .PARAMETER vs
Version of Visual Studio project files to generate. Cmake supports "10" (default) and "11". Version of Visual Studio project files to generate. Cmake supports "10" (default) and "11".
.PARAMETER libgit2Name
The base name (i.e without the file extension) of the libgit2 DLL to generate. Default is to use git2-$suffix, where $suffix is the first 7 characters of the SHA1 of the corresponding libgi2 commit as the suffix.
.PARAMETER test .PARAMETER test
If set, run the libgit2 tests on the desired version. If set, run the libgit2 tests on the desired version.
.PARAMETER debug .PARAMETER debug
@ -14,6 +16,7 @@
Param( Param(
[string]$sha = 'HEAD', [string]$sha = 'HEAD',
[string]$vs = '10', [string]$vs = '10',
[string]$libgit2Name = '',
[switch]$test, [switch]$test,
[switch]$debug [switch]$debug
) )
@ -127,8 +130,12 @@ function Assert-Consistent-Naming($expected, $path) {
popd popd
break break
} }
$shortsha = $sha.Substring(0,7)
$binaryFilename = "git2-$shortsha" if(![string]::IsNullOrEmpty($libgit2Name)) {
$binaryFilename = $libgit2Name
} else {
$binaryFilename = "git2-" + $sha.Substring(0,7)
}
Write-Output "Checking out $sha..." Write-Output "Checking out $sha..."
Run-Command -Quiet -Fatal { & $git checkout $sha } Run-Command -Quiet -Fatal { & $git checkout $sha }
@ -166,7 +173,7 @@ namespace LibGit2Sharp.Core
{ {
internal static class NativeDllName internal static class NativeDllName
{ {
public const string Name = "git2-$shortsha"; public const string Name = "$binaryFilename.dll";
} }
} }
"@ "@