Skip to content

Commit 7e84a94

Browse files
committed
Introduce SSH linking in the scripts.
1 parent c9157e4 commit 7e84a94

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

LibGit2Sharp.Tests/GlobalSettingsFixture.cs

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using LibGit2Sharp;
33
using LibGit2Sharp.Tests.TestHelpers;
44
using Xunit;
5+
using System.Globalization;
6+
using System.IO;
57

68
namespace LibGit2Sharp.Tests
79
{
@@ -14,6 +16,14 @@ public void CanGetMinimumCompiledInFeatures()
1416

1517
Assert.True(features.HasFlag(BuiltInFeatures.Threads));
1618
Assert.True(features.HasFlag(BuiltInFeatures.Https));
19+
20+
bool hasSsh;
21+
using (var sr = new StreamReader(typeof(GlobalSettingsFixture).Assembly.GetManifestResourceStream("LibGit2Sharp.Tests.ssh_used")))
22+
{
23+
if (!bool.TryParse(sr.ReadLine(), out hasSsh))
24+
hasSsh = false;
25+
}
26+
Assert.Equal(hasSsh, features.HasFlag(BuiltInFeatures.Ssh));
1727
}
1828
}
1929
}

LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,7 @@
150150
<Target Name="AfterBuild">
151151
</Target>
152152
-->
153+
<ItemGroup>
154+
<EmbeddedResource Include="ssh_used.txt" />
155+
</ItemGroup>
153156
</Project>

LibGit2Sharp.Tests/ssh_used.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
True

UpdateLibgit2ToSha.ps1

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@
1111
If set, run the libgit2 tests on the desired version.
1212
.PARAMETER debug
1313
If set, build the "Debug" configuration of libgit2, rather than "RelWithDebInfo" (default).
14+
.PARAMETER ssh
15+
If set, build with SSH enabled.
1416
#>
1517

1618
Param(
1719
[string]$sha = 'HEAD',
1820
[string]$vs = '10',
1921
[string]$libgit2Name = '',
2022
[switch]$test,
21-
[switch]$debug
23+
[switch]$debug,
24+
[switch]$ssh
2225
)
2326

2427
Set-StrictMode -Version Latest
@@ -33,7 +36,8 @@ $build_clar = 'OFF'
3336
if ($test.IsPresent) { $build_clar = 'ON' }
3437
$configuration = "RelWithDebInfo"
3538
if ($debug.IsPresent) { $configuration = "Debug" }
36-
39+
$embed_ssh = ''
40+
if ($ssh.IsPresent) { $embed_ssh = '-DEMBED_SSH_PATH="../../libssh2"' }
3741
function Run-Command([scriptblock]$Command, [switch]$Fatal, [switch]$Quiet) {
3842
$output = ""
3943
if ($Quiet) {
@@ -144,7 +148,7 @@ function Assert-Consistent-Naming($expected, $path) {
144148
Run-Command -Quiet { & remove-item build -recurse -force }
145149
Run-Command -Quiet { & mkdir build }
146150
cd build
147-
Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs" -D THREADSAFE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" -DSTDCALL=ON .. }
151+
Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs" -D THREADSAFE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" -DSTDCALL=ON $embed_ssh .. }
148152
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
149153
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
150154
cd $configuration
@@ -157,7 +161,7 @@ function Assert-Consistent-Naming($expected, $path) {
157161
cd ..
158162
Run-Command -Quiet { & mkdir build64 }
159163
cd build64
160-
Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs Win64" -D THREADSAFE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" -DSTDCALL=ON ../.. }
164+
Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs Win64" -D THREADSAFE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" -DSTDCALL=ON $embed_ssh ../.. }
161165
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
162166
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
163167
cd $configuration
@@ -180,6 +184,7 @@ namespace LibGit2Sharp.Core
180184

181185
sc -Encoding ASCII (Join-Path $libgit2sharpDirectory "Libgit2sharp\Core\NativeDllName.cs") $dllNameClass
182186
sc -Encoding ASCII (Join-Path $libgit2sharpDirectory "Libgit2sharp\libgit2_hash.txt") $sha
187+
sc -Encoding ASCII (Join-Path $libgit2sharpDirectory "Libgit2sharp.Tests\Resources\ssh_used.txt") $ssh.IsPresent
183188

184189
Write-Output "Done!"
185190
}

build.libgit2sharp.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
LIBGIT2SHA=`cat ./LibGit2Sharp/libgit2_hash.txt`
44
SHORTSHA=${LIBGIT2SHA:0:7}
5-
5+
USESSH=${1-OFF}
66
rm -rf libgit2/build
77
mkdir libgit2/build
88
pushd libgit2/build
@@ -11,7 +11,7 @@ export _BINPATH=`pwd`
1111
cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
1212
-DTHREADSAFE:BOOL=ON \
1313
-DBUILD_CLAR:BOOL=OFF \
14-
-DUSE_SSH=OFF \
14+
-DUSE_SSH=$USESSH \
1515
-DLIBGIT2_FILENAME=git2-$SHORTSHA \
1616
-DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
1717
..

0 commit comments

Comments
 (0)