-
Notifications
You must be signed in to change notification settings - Fork 899
Automate the building of libgit2 native libraries with Powershell #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Grabbed the script from #235. It doesn't currently run the tests, but it does:
|
Updated to be more like @aroben's script (thanks!). This one is quite a bit nicer. |
Thanks for the review @dahlbyk! I've addressed the issues you brought up, and added an option to build libgit2 in the "Debug" configuration (which helps when using a debugger to figure out interop). |
👍👍 |
@ben I may need some help here. PS D:\LibGit2Sharp> .\UpdateLibgit2ToSha.ps1 1e99ce9ac7d7a73f629327d020034e4b2ed1374c
Fetching...
` & git fetch ` failed
At D:\LibGit2Sharp\UpdateLibgit2ToSha.ps1:49 char:10
+ Throw <<<< $error
+ CategoryInfo : OperationStopped: (` & git fetch ` failed:String) [], RuntimeException
+ FullyQualifiedErrorId : ` & git fetch ` failed |
ben:libgit2-update-script...dahlbyk:libgit2-update-script has a few suggestions/proposals. The first (-test) doesn't seem to actually run tests (at least I couldn't get the build to fail), but it seems like a useful addition. |
@dahlbyk Nice! I took the liberty of rolling your changes in, and implementing the unit-test-runner. |
Ah, so that's how you run tests... 🆒 |
The fetch fails consistently through the script, but works if you |
That's the point. Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS D:\LibGit2Sharp> git --version
git version 1.7.11.msysgit.1
PS D:\LibGit2Sharp> .\UpdateLibgit2ToSha.ps1 a5e85d86b7e13352c553b0a43bc36fee5880b5c7
Fetching...
` & git fetch ` failed
At D:\LibGit2Sharp\UpdateLibgit2ToSha.ps1:53 char:10
+ Throw <<<< $error
+ CategoryInfo : OperationStopped: (` & git fetch ` failed:String) [], RuntimeException
+ FullyQualifiedErrorId : ` & git fetch ` failed
PS D:\LibGit2Sharp> git fetch
PS D:\LibGit2Sharp> git fetch origin
remote: Counting objects: 40, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 30 (delta 23), reused 30 (delta 23)
Unpacking objects: 100% (30/30), done.
From https://github.com/libgit2/libgit2sharp
+ d357ac4...d23b339 benstraub/clone -> origin/benstraub/clone (forced update)
PS D:\LibGit2Sharp> Then, if I type PS D:\LibGit2Sharp\libgit2> git remote -v
origin http://github.com/libgit2/libgit2.git (fetch)
origin http://github.com/libgit2/libgit2.git (push) |
@nulltoken, try it now. Your results are kind of strange, but this script should still work if you're disconnected but still have the desired libgit2 revision in your repo. |
This is going further... PS D:\LibGit2Sharp> .\UpdateLibgit2ToSha.ps1 8a85378829cb3bd417b04cd690da8d7d470b6214
Fetching...
Verifying 8a85378829cb3bd417b04cd690da8d7d470b6214...
trace: built-in: git 'rev-parse' '--verify' '8a85378829cb3bd417b04cd690da8d7d470b6214'
Split-Path : Cannot find drive. A drive with the name '
trap {
Pop-Location
break
}
$cmake = Find-CMake
$ctest = Join-Path (Split-Path -Parent $cmake) "ctest.exe"
Write-Output "Fetching..."
Run-Command -Quiet { & git fetch }
Write-Output "Verifying $sha..."
$sha = git rev-parse --verify $sha
if ($LASTEXITCODE -ne 0) {
$mypath = split-path -leaf $MyInvocation.MyCommand.Definition
throw "Error' does not exist.
At D:\LibGit2Sharp\UpdateLibgit2ToSha.ps1:97 char:23
+ $mypath = split-path <<<< -leaf $MyInvocation.MyCommand.Definition
+ CategoryInfo : ObjectNotFound: (
trap {
Po...
throw "Error:String) [Split-Path], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SplitPathCommand
Error: invalid SHA. USAGE: <SHA>
At D:\LibGit2Sharp\UpdateLibgit2ToSha.ps1:98 char:8
+ throw <<<< "Error: invalid SHA. USAGE: $mypath <SHA>"
+ CategoryInfo : OperationStopped: (Error: invalid SHA. USAGE: <SHA>:String) [], RuntimeException
+ FullyQualifiedErrorId : Error: invalid SHA. USAGE: <SHA> |
@nulltoken can you try it again? I think I figured out the reason for the bad error message, but all of your git commands seem to be returning non-zero, which isn't helpful. |
😿 Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS D:\LibGit2Sharp> git --version
git version 1.7.11.msysgit.1
PS D:\LibGit2Sharp> .\UpdateLibgit2ToSha.ps1 8ff2b0c75983160264ee7c45a01bde27cfbc91ea
Fetching...
Verifying 8ff2b0c75983160264ee7c45a01bde27cfbc91ea...
Error: invalid SHA. USAGE: UpdateLibgit2ToSha.ps1 <SHA>
PS D:\LibGit2Sharp> cd .\libgit2
PS D:\LibGit2Sharp\libgit2> git rev-parse --verify 8ff2b0c75983160264ee7c45a01bde27cfbc91ea
8ff2b0c75983160264ee7c45a01bde27cfbc91ea
PS D:\LibGit2Sharp\libgit2> echo $LASTEXITCODE, $?
1
False
PS D:\LibGit2Sharp\libgit2> |
Okay, @nulltoken. One more time, please include your output. |
Maybe someone else here has seen this issue. @nulltoken has a problem where running |
(I've never seen this) |
@nulltoken, Out of interest, what do you get when you run |
@martinwoodward Sorry for the late answer PS C:\Users\OneAmongMany> Get-Command git | Format-List
Name : git.exe
CommandType : Application
Definition : C:\Program Files\Git\cmd\git.exe
Extension : .exe
Path : C:\Program Files\Git\cmd\git.exe
FileVersionInfo : File: C:\Program Files\Git\cmd\git.exe
InternalName:
OriginalFilename:
FileVersion:
FileDescription:
Product:
ProductVersion:
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: |
@ben I've completely reinstalled my Git setup. It now works. Congrats and ❤️! Could you please rebase and cleanup a bit the commit history? |
A call to ".\UpdateLibgit2ToSha.ps1 deadbeef" will: - Fetch libgit2 - Checkout the sha, if it exists as a commit - Build 32- and 64-bit variants of the library, and copy them to NativeBinaries - Update the libgit2_sha.txt file
I'm so glad! Rebased and squashed into one commit. |
Bam! Merged in 💖 |
@aroben did a wonderful job with Update-NativeBinaries.ps1.
LibGit2Sharp embeds both x86 and amd64 versions of Windows libgit2 bins in the
Lib/NativeLibraries
directory.This issue should try and make the PowerShell script handle the following
FWIW, passing parameter
-G "Visual Studio 10 Win64"
to cmake will make it build an amd64 version of the library.Notes: