@@ -3,6 +3,7 @@ Set-StrictMode -Version Latest
33[string ] $script :platform = $env: PROCESSOR_ARCHITECTURE
44[string ] $script :vcPath = $null
55[System.IO.DirectoryInfo ] $script :OpenSSHRoot = $null
6+ [System.IO.DirectoryInfo ] $script :gitRoot = $null
67[bool ] $script :Verbose = $false
78[string ] $script :BuildLogFile = $null
89
@@ -268,6 +269,34 @@ function Start-SSHBootstrap
268269 }
269270}
270271
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+
271300function Start-SSHBuild
272301{
273302 [CmdletBinding (SupportsShouldProcess = $false )]
@@ -286,6 +315,8 @@ function Start-SSHBuild
286315
287316 # Get openssh-portable root
288317 $script :OpenSSHRoot = Get-Item - Path $repositoryRoot.FullName
318+ $script :gitRoot = split-path $script :OpenSSHRoot
319+
289320
290321 if ($PSBoundParameters.ContainsKey (" Verbose" ))
291322 {
@@ -302,6 +333,9 @@ function Start-SSHBuild
302333 Write-BuildMsg - AsInfo - Message " Build Log: $ ( $script :BuildLogFile ) "
303334
304335 Start-SSHBootstrap
336+
337+ Clone- Win32OpenSSH
338+ Copy-OpenSSLSDK
305339 $msbuildCmd = " msbuild.exe"
306340 $solutionFile = Get-SolutionFile - root $repositoryRoot.FullName
307341 $cmdMsg = @ (" ${solutionFile} " , " /p:Platform=${NativeHostArch} " , " /p:Configuration=${Configuration} " , " /fl" , " /flp:LogFile=${ script:BuildLogFile } `;Append`;Verbosity=diagnostic" )
@@ -380,4 +414,4 @@ function Get-RepositoryRoot
380414 throw new-object System.IO.DirectoryNotFoundException(" Could not find the root of the GIT repository" )
381415}
382416
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