diff --git a/.gitignore b/.gitignore index 6c668f7cc..e4e613313 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,7 @@ _ReSharper*/ *.pidb *.userprefs *.swp -*.DotSettings \ No newline at end of file +*.DotSettings + +!Lib/NativeBinaries/x86/*.pdb +!Lib/NativeBinaries/amd64/*.pdb diff --git a/.gitmodules b/.gitmodules index 30eb68a28..a496a75da 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "libgit2"] path = libgit2 - url = https://github.com/libgit2/libgit2.git + url = https://github.com/carlosmn/libgit2.git diff --git a/.travis.yml b/.travis.yml index 496884376..b0930caa6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,10 @@ install: script: - git submodule update --init - mkdir cmake-build + - LIBGIT2SHA=`cat ./LibGit2Sharp/libgit2_hash.txt` + - SHORTSHA=${LIBGIT2SHA:0:7} - cd cmake-build - - cmake -DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./libgit2-bin ../libgit2 + - cmake -DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./libgit2-bin -DSONAME_APPEND=$SHORTSHA ../libgit2 - export LD_LIBRARY_PATH=$PWD/libgit2-bin/lib - cmake --build . --target install - cd .. diff --git a/Lib/Libgit2sharp.dll.config b/Lib/Libgit2sharp.dll.config new file mode 100644 index 000000000..44d669377 --- /dev/null +++ b/Lib/Libgit2sharp.dll.config @@ -0,0 +1,5 @@ + + + + + diff --git a/Lib/NativeBinaries/amd64/git2-3bbc87d.dll b/Lib/NativeBinaries/amd64/git2-3bbc87d.dll new file mode 100644 index 000000000..454338da1 Binary files /dev/null and b/Lib/NativeBinaries/amd64/git2-3bbc87d.dll differ diff --git a/Lib/NativeBinaries/amd64/git2.pdb b/Lib/NativeBinaries/amd64/git2-3bbc87d.pdb similarity index 56% rename from Lib/NativeBinaries/amd64/git2.pdb rename to Lib/NativeBinaries/amd64/git2-3bbc87d.pdb index a6088a28d..8437eaa71 100644 Binary files a/Lib/NativeBinaries/amd64/git2.pdb and b/Lib/NativeBinaries/amd64/git2-3bbc87d.pdb differ diff --git a/Lib/NativeBinaries/amd64/git2.dll b/Lib/NativeBinaries/amd64/git2.dll deleted file mode 100644 index ed03a1695..000000000 Binary files a/Lib/NativeBinaries/amd64/git2.dll and /dev/null differ diff --git a/Lib/NativeBinaries/x86/git2-3bbc87d.dll b/Lib/NativeBinaries/x86/git2-3bbc87d.dll new file mode 100644 index 000000000..a0e8b24b8 Binary files /dev/null and b/Lib/NativeBinaries/x86/git2-3bbc87d.dll differ diff --git a/Lib/NativeBinaries/x86/git2.pdb b/Lib/NativeBinaries/x86/git2-3bbc87d.pdb similarity index 55% rename from Lib/NativeBinaries/x86/git2.pdb rename to Lib/NativeBinaries/x86/git2-3bbc87d.pdb index 979b5d379..032d4ca51 100644 Binary files a/Lib/NativeBinaries/x86/git2.pdb and b/Lib/NativeBinaries/x86/git2-3bbc87d.pdb differ diff --git a/Lib/NativeBinaries/x86/git2.dll b/Lib/NativeBinaries/x86/git2.dll deleted file mode 100644 index 5846aeff7..000000000 Binary files a/Lib/NativeBinaries/x86/git2.dll and /dev/null differ diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index f9dc8766f..5724eb76a 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -136,4 +136,4 @@ - \ No newline at end of file + diff --git a/LibGit2Sharp/Core/NativeDllName.cs b/LibGit2Sharp/Core/NativeDllName.cs new file mode 100644 index 000000000..4b91aaa83 --- /dev/null +++ b/LibGit2Sharp/Core/NativeDllName.cs @@ -0,0 +1,7 @@ +namespace LibGit2Sharp.Core +{ + internal static class NativeDllName + { + public const string Name = "git2-3bbc87d"; + } +} diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index 152d545e2..19a80dc1e 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -14,7 +14,7 @@ namespace LibGit2Sharp.Core internal static class NativeMethods { public const uint GIT_PATH_MAX = 4096; - private const string libgit2 = "git2"; + private const string libgit2 = NativeDllName.Name; private static readonly LibraryLifetimeObject lifetimeObject; private static int handlesCount; diff --git a/LibGit2Sharp/Core/UnSafeNativeMethods.cs b/LibGit2Sharp/Core/UnSafeNativeMethods.cs index 49093e6e3..421096f62 100644 --- a/LibGit2Sharp/Core/UnSafeNativeMethods.cs +++ b/LibGit2Sharp/Core/UnSafeNativeMethods.cs @@ -6,7 +6,7 @@ namespace LibGit2Sharp.Core { internal static unsafe class UnSafeNativeMethods { - private const string libgit2 = "git2"; + private const string libgit2 = NativeDllName.Name; [DllImport(libgit2)] internal static extern int git_reference_list(out git_strarray array, RepositorySafeHandle repo, GitReferenceType flags); diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index aedf03034..0a84bb13d 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -67,6 +67,7 @@ + @@ -271,4 +272,4 @@ - \ No newline at end of file + diff --git a/LibGit2Sharp/libgit2_hash.txt b/LibGit2Sharp/libgit2_hash.txt index 5d90d86df..21afa04cd 100644 --- a/LibGit2Sharp/libgit2_hash.txt +++ b/LibGit2Sharp/libgit2_hash.txt @@ -1 +1 @@ -b641c00eebb3c60e8719c0dfc55dde91ca30a5d2 +3bbc87d697b24725beb8dcd41fa83ca604d3a9e2 diff --git a/UpdateLibgit2ToSha.ps1 b/UpdateLibgit2ToSha.ps1 index c768b14d6..96ff2998b 100644 --- a/UpdateLibgit2ToSha.ps1 +++ b/UpdateLibgit2ToSha.ps1 @@ -18,6 +18,7 @@ Param( [switch]$debug ) + Set-StrictMode -Version Latest $self = Split-Path -Leaf $MyInvocation.MyCommand.Path @@ -111,6 +112,7 @@ Push-Location $libgit2Directory popd break } + $shortsha = $sha.Substring(0,7) Write-Output "Checking out $sha..." Run-Command -Quiet -Fatal { & $git checkout $sha } @@ -119,26 +121,49 @@ Push-Location $libgit2Directory Run-Command -Quiet { & remove-item build -recurse -force } Run-Command -Quiet { & mkdir build } cd build - Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs" -D THREADSAFE=ON -D "BUILD_CLAR=$build_clar" .. } + Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs" -D THREADSAFE=ON -D "BUILD_CLAR=$build_clar" -D "SONAME_APPEND=$shortsha" .. } Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration } if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } } cd $configuration Run-Command -Quiet { & rm *.exp } + Run-Command -Quiet { & rm $x86Directory\* } Run-Command -Quiet -Fatal { & copy -fo * $x86Directory } Write-Output "Building 64-bit..." cd .. Run-Command -Quiet { & mkdir build64 } cd build64 - Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs Win64" -D THREADSAFE=ON -D "BUILD_CLAR=$build_clar" ../.. } + Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs Win64" -D THREADSAFE=ON -D "BUILD_CLAR=$build_clar" -D "SONAME_APPEND=$shortsha" ../.. } Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration } if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } } cd $configuration Run-Command -Quiet { & rm *.exp } + Run-Command -Quiet { & rm $x64Directory\* } Run-Command -Quiet -Fatal { & copy -fo * $x64Directory } - Write-Output "Done!" pop-location - sc -Encoding UTF8 libgit2sharp\libgit2_hash.txt $sha + + $dllMap = @" + + + + + +"@ + $dllNameClass = @" +namespace LibGit2Sharp.Core +{ + internal static class NativeDllName + { + public const string Name = "git2-$shortsha"; + } +} +"@ + + sc -Encoding ASCII .\Libgit2sharp\Core\NativeDllName.cs $dllNameClass + sc -Encoding ASCII .\Lib\Libgit2sharp.dll.config $dllMap + sc -Encoding ASCII libgit2sharp\libgit2_hash.txt $sha + + Write-Output "Done!" } exit diff --git a/build.libgit2sharp.sh b/build.libgit2sharp.sh index c5f1948f9..1a418d094 100644 --- a/build.libgit2sharp.sh +++ b/build.libgit2sharp.sh @@ -2,10 +2,14 @@ PREVIOUS_LD=$LD_LIBRARY_PATH +LIBGIT2SHA=`cat ./LibGit2Sharp/libgit2_hash.txt` +SHORTSHA=${LIBGIT2SHA:0:7} +echo $SHORTSHA + rm -rf cmake-build mkdir cmake-build && cd cmake-build -cmake -DBUILD_SHARED_LIBS:BOOL=ON -DTHREADSAFE:BOOL=ON -DBUILD_CLAR:BOOL=OFF -DCMAKE_INSTALL_PREFIX=./libgit2-bin ../libgit2 +cmake -DBUILD_SHARED_LIBS:BOOL=ON -DTHREADSAFE:BOOL=ON -DBUILD_CLAR:BOOL=OFF -DCMAKE_INSTALL_PREFIX=./libgit2-bin -DSONAME_APPEND=$SHORTSHA ../libgit2 cmake --build . --target install LD_LIBRARY_PATH=$PWD/libgit2-bin/lib:$LD_LIBRARY_PATH diff --git a/libgit2 b/libgit2 index b641c00ee..3bbc87d69 160000 --- a/libgit2 +++ b/libgit2 @@ -1 +1 @@ -Subproject commit b641c00eebb3c60e8719c0dfc55dde91ca30a5d2 +Subproject commit 3bbc87d697b24725beb8dcd41fa83ca604d3a9e2