Update the build scripts to the latest version

This commit is contained in:
Victor Hurdugaci 2016-03-07 20:54:56 -08:00
Родитель a6c044c159
Коммит 33e7471c44
2 изменённых файлов: 45 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,33 @@
$ErrorActionPreference = "Stop"
function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries)
{
while($true)
{
try
{
Invoke-WebRequest $url -OutFile $downloadLocation
break
}
catch
{
$exceptionMessage = $_.Exception.Message
Write-Host "Failed to download '$url': $exceptionMessage"
if ($retries -gt 0) {
$retries--
Write-Host "Waiting 10 seconds before retrying. Retries left: $retries"
Start-Sleep -Seconds 10
}
else
{
$exception = $_.Exception
throw $exception
}
}
}
}
cd $PSScriptRoot
$repoFolder = $PSScriptRoot
@ -20,7 +50,8 @@ if (!(Test-Path $buildFolder)) {
$localZipFile="$tempFolder\korebuild.zip"
Invoke-WebRequest $koreBuildZip -OutFile $localZipFile
DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder)

Просмотреть файл

@ -18,7 +18,18 @@ if test ! -d $buildFolder; then
localZipFile="$tempFolder/korebuild.zip"
wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip /dev/null
retries=6
until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null)
do
echo "Failed to download '$koreBuildZip'"
if [ "$retries" -le 0 ]; then
exit 1
fi
retries=$((retries - 1))
echo "Waiting 10 seconds before retrying. Retries left: $retries"
sleep 10s
done
unzip -q -d $tempFolder $localZipFile
mkdir $buildFolder
@ -32,4 +43,4 @@ if test ! -d $buildFolder; then
fi
fi
$buildFile -r $repoFolder "$@"
$buildFile -r $repoFolder "$@"