[powershell] Remove usages of BitsTransfer

This commit is contained in:
Alexander Karatarakis 2018-01-17 17:31:22 -08:00
parent 8e773df065
commit 3390007020

View File

@ -94,11 +94,6 @@ function vcpkgCheckEqualFileHash( [Parameter(Mandatory=$true)][string]$filePat
}
}
if (vcpkgHasModule -moduleName 'BitsTransfer')
{
Import-Module BitsTransfer -Verbose:$false
}
function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url,
[Parameter(Mandatory=$true)][string]$downloadPath)
{
@ -119,28 +114,6 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url,
$wc.Proxy.Credentials = vcpkgGetCredentials
}
# Some download (e.g. git from github)fail with Start-BitsTransfer
if (vcpkgHasCommand -commandName 'Start-BitsTransfer')
{
try
{
if ($proxyAuth)
{
$PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyAuthentication","Basic")
$PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyCredential", $wc.Proxy.Credentials)
}
Start-BitsTransfer -Source $url -Destination $downloadPartPath -ErrorAction Stop
Move-Item -Path $downloadPartPath -Destination $downloadPath
return
}
catch [System.Exception]
{
# If BITS fails for any reason, delete any potentially partially downloaded files and continue
vcpkgRemoveItem $downloadPartPath
}
}
Write-Verbose("Downloading $Dependency...")
$wc.DownloadFile($url, $downloadPartPath)
Move-Item -Path $downloadPartPath -Destination $downloadPath
}