@@ -3,6 +3,7 @@ Set-StrictMode -Version Latest
3
3
[string ] $script :platform = $env: PROCESSOR_ARCHITECTURE
4
4
[string ] $script :vcPath = $null
5
5
[System.IO.DirectoryInfo ] $script :OpenSSHRoot = $null
6
+ [System.IO.DirectoryInfo ] $script :gitRoot = $null
6
7
[bool ] $script :Verbose = $false
7
8
[string ] $script :BuildLogFile = $null
8
9
@@ -268,6 +269,34 @@ function Start-SSHBootstrap
268
269
}
269
270
}
270
271
272
+ function Clone-Win32OpenSSH
273
+ {
274
+ $win32OpenSSHPath = join-path $script :gitRoot " Win32-OpenSSH"
275
+ if (-not (Test-Path - Path $win32OpenSSHPath - PathType Container))
276
+ {
277
+ Write-BuildMsg - AsInfo - Message " clone repo Win32-OpenSSH"
278
+ Push-Location $gitRoot
279
+ git clone - q -- recursive https:// github.com / PowerShell/ Win32- OpenSSH.git $win32OpenSSHPath
280
+ Pop-Location
281
+ }
282
+ Write-BuildMsg - AsInfo - Message " pull latest from repo Win32-OpenSSH"
283
+ Push-Location $win32OpenSSHPath
284
+ git fetch - q origin
285
+ git checkout - qf L1- Prod
286
+ Pop-Location
287
+ }
288
+
289
+ function Copy-OpenSSLSDK
290
+ {
291
+ $sourcePath = Join-Path $script :gitRoot " Win32-OpenSSH\contrib\win32\openssh\OpenSSLSDK"
292
+ Write-BuildMsg - AsInfo - Message " copying $sourcePath "
293
+ Copy-Item - Container - Path $sourcePath - Destination $PSScriptRoot - Recurse - Force - ErrorAction SilentlyContinue - ErrorVariable e
294
+ if ($e -ne $null )
295
+ {
296
+ Write-BuildMsg - AsError - ErrorAction Stop - Message " Copy OpenSSL from $sourcePath failed "
297
+ }
298
+ }
299
+
271
300
function Start-SSHBuild
272
301
{
273
302
[CmdletBinding (SupportsShouldProcess = $false )]
@@ -286,6 +315,8 @@ function Start-SSHBuild
286
315
287
316
# Get openssh-portable root
288
317
$script :OpenSSHRoot = Get-Item - Path $repositoryRoot.FullName
318
+ $script :gitRoot = split-path $script :OpenSSHRoot
319
+
289
320
290
321
if ($PSBoundParameters.ContainsKey (" Verbose" ))
291
322
{
@@ -302,6 +333,9 @@ function Start-SSHBuild
302
333
Write-BuildMsg - AsInfo - Message " Build Log: $ ( $script :BuildLogFile ) "
303
334
304
335
Start-SSHBootstrap
336
+
337
+ Clone- Win32OpenSSH
338
+ Copy-OpenSSLSDK
305
339
$msbuildCmd = " msbuild.exe"
306
340
$solutionFile = Get-SolutionFile - root $repositoryRoot.FullName
307
341
$cmdMsg = @ (" ${solutionFile} " , " /p:Platform=${NativeHostArch} " , " /p:Configuration=${Configuration} " , " /fl" , " /flp:LogFile=${ script:BuildLogFile } `;Append`;Verbosity=diagnostic" )
@@ -380,4 +414,4 @@ function Get-RepositoryRoot
380
414
throw new-object System.IO.DirectoryNotFoundException(" Could not find the root of the GIT repository" )
381
415
}
382
416
383
- Export-ModuleMember - Function Start-SSHBuild , Get-RepositoryRoot , Get-BuildLogFile
417
+ Export-ModuleMember - Function Start-SSHBuild , Get-RepositoryRoot , Get-BuildLogFile , Clone - Win32OpenSSH , Copy-OpenSSLSDK
0 commit comments