Skip to content

Commit 515c219

Browse files
Merge pull request #24 from UiPath/feature/add_schannel
Add build configuration for using schannel STUD-6_5739
2 parents b5e7f7d + 398c839 commit 515c219

File tree

3 files changed

+26
-68
lines changed

3 files changed

+26
-68
lines changed

build.libgit2.ps1

+19-10
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ $libssh2Directory = ([System.Uri](Join-Path $projectDirectory "libssh2")).Absolu
2424
$x86Directory = Join-Path $projectDirectory "nuget.package\runtimes\win-x86\native"
2525
$x64Directory = Join-Path $projectDirectory "nuget.package\runtimes\win-x64\native"
2626
$hashFile = Join-Path $projectDirectory "nuget.package\libgit2\libgit2_hash.txt"
27-
$sha = Get-Content $hashFile
2827

2928
if (![string]::IsNullOrEmpty($libgit2Name)) {
3029
$binaryFilename = $libgit2Name
3130
} else {
32-
$binaryFilename = "git2-" + $sha.Substring(0,7)
31+
$binaryFilename = "libgit2"
3332
}
3433

3534
$build_clar = 'OFF'
@@ -109,19 +108,29 @@ function Build-LibSsh($generator, $platform, $buildDir) {
109108
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
110109
}
111110

112-
function Build-LibGit($generator, $platform, $nugetDir) {
113-
Write-Output "Building $platform..."
111+
function Build-LibGit($generator, $platform, $nugetDir, $useSchannel, $buildPlatform) {
114112
$libsshBuildDir = "$libssh2Directory/build/$platform"
115113
$libsshBinDir = "$libsshBuildDir/src/$configuration"
116114
$libopensslBinDir = "$libopensslDirectory/$platform/bin"
117-
Build-LibSsh $generator $platform $libsshBuildDir
118-
115+
if ($buildPlatform) {
116+
Write-Output "Building $platform..."
117+
Build-LibSsh $generator $platform $libsshBuildDir
118+
}
119+
119120
$buildDir = [IO.Path]::Combine( $libgit2Directory, "build", $platform)
120121
Run-Command -Quiet { & remove-item $buildDir -recurse -force }
121122
[IO.Directory]::CreateDirectory($buildDir)
122123
cd $buildDir
123-
Write-Output "CONFIGURE LIBGIT..."
124-
Run-Command -Quiet -Fatal { & $cmake -G $generator -A $platform -D ENABLE_TRACE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" -D "USE_SSH=False" -D "LIBSSH2_INCLUDE_DIRS=$libssh2Directory/include" -D "LIBSSH2_LIBRARIES=$libsshBinDir/libssh2.lib" -D "LIBSSH2_FOUND=TRUE" -D "OPENSSL_ROOT_DIR=$libopensslDirectory/$platform" $libgit2Directory }
124+
$variantFilename = $binaryFileName
125+
if ($useSchannel) {
126+
$variantFilename = -join ($binaryFileName, "_schannel")
127+
}
128+
Write-Output "CONFIGURE LIBGIT... Schannel: $useSchannel"
129+
$httpsConfig = ""
130+
if ($useSchannel) {
131+
$httpsConfig = "-D `"USE_HTTPS=Schannel`""
132+
}
133+
Run-Command -Fatal { & $cmake -G $generator -A $platform -D ENABLE_TRACE=ON -D "BUILD_CLAR=$build_clar" -D "BUILD_TESTS=OFF" -D "BUILD_CLI=OFF" $httpsConfig -D "LIBGIT2_FILENAME=$variantFilename" -D "USE_SSH=False" -D "LIBSSH2_INCLUDE_DIRS=$libssh2Directory/include" -D "LIBSSH2_LIBRARIES=$libsshBinDir/libssh2.lib" -D "LIBSSH2_FOUND=TRUE" -D "OPENSSL_ROOT_DIR=$libopensslDirectory/$platform" $libgit2Directory }
125134
Write-Output "BUILD LIBGIT..."
126135
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
127136
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
@@ -158,8 +167,8 @@ try {
158167
$cmake = Find-CMake
159168
$ctest = Join-Path (Split-Path -Parent $cmake) "ctest.exe"
160169

161-
Build-LibGit "Visual Studio $vs" "Win32" $x86Directory
162-
Build-LibGit "Visual Studio $vs" "x64" $x64Directory
170+
Build-LibGit "Visual Studio $vs" "x64" $x64Directory $false $true
171+
Build-LibGit "Visual Studio $vs" "x64" $x64Directory $true $false
163172

164173
Write-Output "Done!"
165174
}

nuget.package/build/LibGit2Sharp.NativeBinaries.UiPath.props

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<PropertyGroup>
33
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
44
<libgit2_propsfile>$(MSBuildThisFileFullPath)</libgit2_propsfile>
5-
<libgit2_hash>572e4d8c1f1d42feac1c770f0cddf6fda6c4eca0</libgit2_hash>
6-
<libgit2_filename>git2-572e4d8</libgit2_filename>
5+
<libgit2_filename>libgit2</libgit2_filename>
76
</PropertyGroup>
87
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
<Project>
22
<PropertyGroup>
33
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
4-
<libgit2_propsfile>$(MSBuildThisFileFullPath)</libgit2_propsfile>
5-
<libgit2_hash>572e4d8c1f1d42feac1c770f0cddf6fda6c4eca0</libgit2_hash>
6-
<libgit2_filename>git2-572e4d8</libgit2_filename>
4+
<liblibgit2_propsfile>$(MSBuildThisFileFullPath)</liblibgit2_propsfile>
5+
<liblibgit2_filename>libgit2</liblibgit2_filename>
76
</PropertyGroup>
87
<ItemGroup>
9-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\git2-572e4d8.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\git2-572e4d8.dll">
10-
<TargetPath>lib\win32\x64\git2-572e4d8.dll</TargetPath>
8+
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\libgit2.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\libgit2.dll">
9+
<TargetPath>lib\win32\x64\libgit2.dll</TargetPath>
1110
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1211
</ContentWithTargetPath>
13-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\git2-572e4d8.pdb')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\git2-572e4d8.pdb">
14-
<TargetPath>lib\win32\x64\git2-572e4d8.pdb</TargetPath>
12+
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\libgit2_schannel.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\libgit2_schannel.dll">
13+
<TargetPath>lib\win32\x64\libgit2_schannel.dll</TargetPath>
1514
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1615
</ContentWithTargetPath>
1716
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\libssh2.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\libssh2.dll">
@@ -22,53 +21,4 @@
2221
<TargetPath>lib\win32\x64\libcrypto-1_1-x64.dll</TargetPath>
2322
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2423
</ContentWithTargetPath>
25-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\git2-572e4d8.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\git2-572e4d8.dll">
26-
<TargetPath>lib\win32\x86\git2-572e4d8.dll</TargetPath>
27-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
28-
</ContentWithTargetPath>
29-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\git2-572e4d8.pdb')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\git2-572e4d8.pdb">
30-
<TargetPath>lib\win32\x86\git2-572e4d8.pdb</TargetPath>
31-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
32-
</ContentWithTargetPath>
33-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\libssh2.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\libssh2.dll">
34-
<TargetPath>lib\win32\x86\libssh2.dll</TargetPath>
35-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
36-
</ContentWithTargetPath>
37-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\libcrypto-1_1.dll')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\libcrypto-1_1.dll">
38-
<TargetPath>lib\win32\x86\libcrypto-1_1.dll</TargetPath>
39-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
40-
</ContentWithTargetPath>
41-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\osx\native\libgit2-572e4d8.dylib')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\osx\native\libgit2-572e4d8.dylib">
42-
<TargetPath>lib\osx\libgit2-572e4d8.dylib</TargetPath>
43-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
44-
</ContentWithTargetPath>
45-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\libgit2-572e4d8.so')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\libgit2-572e4d8.so">
46-
<TargetPath>lib\linux-x64\libgit2-572e4d8.so</TargetPath>
47-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
48-
</ContentWithTargetPath>
49-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\ubuntu.18.04-x64\native\libgit2-572e4d8.so')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\ubuntu.18.04-x64\native\libgit2-572e4d8.so">
50-
<TargetPath>lib\ubuntu.18.04-x64\libgit2-572e4d8.so</TargetPath>
51-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
52-
</ContentWithTargetPath>
53-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\rhel-x64\native\libgit2-572e4d8.so')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\rhel-x64\native\libgit2-572e4d8.so">
54-
<TargetPath>lib\rhel-x64\libgit2-572e4d8.so</TargetPath>
55-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
56-
</ContentWithTargetPath>
57-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\fedora-x64\native\libgit2-572e4d8.so')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\fedora-x64\native\libgit2-572e4d8.so">
58-
<TargetPath>lib\fedora-x64\libgit2-572e4d8.so</TargetPath>
59-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
60-
</ContentWithTargetPath>
61-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\debian.9-x64\native\libgit2-572e4d8.so')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\debian.9-x64\native\libgit2-572e4d8.so">
62-
<TargetPath>lib\debian.9-x64\libgit2-572e4d8.so</TargetPath>
63-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
64-
</ContentWithTargetPath>
65-
<ContentWithTargetPath Condition="Exists('$(MSBuildThisFileDirectory)\..\..\runtimes\alpine-x64\native\libgit2-572e4d8.so')" Include="$(MSBuildThisFileDirectory)\..\..\runtimes\alpine-x64\native\libgit2-572e4d8.so">
66-
<TargetPath>lib\alpine-x64\libgit2-572e4d8.so</TargetPath>
67-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
68-
</ContentWithTargetPath>
69-
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)\..\..\libgit2\LibGit2Sharp.dll.config">
70-
<TargetPath>LibGit2Sharp.dll.config</TargetPath>
71-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
72-
</ContentWithTargetPath>
73-
</ItemGroup>
7424
</Project>

0 commit comments

Comments
 (0)