Update the build scripts to the latest version
This commit is contained in:
Родитель
1d78d51cb1
Коммит
42417a985e
33
build.ps1
33
build.ps1
|
@ -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
|
cd $PSScriptRoot
|
||||||
|
|
||||||
$repoFolder = $PSScriptRoot
|
$repoFolder = $PSScriptRoot
|
||||||
|
@ -20,7 +50,8 @@ if (!(Test-Path $buildFolder)) {
|
||||||
|
|
||||||
$localZipFile="$tempFolder\korebuild.zip"
|
$localZipFile="$tempFolder\korebuild.zip"
|
||||||
|
|
||||||
Invoke-WebRequest $koreBuildZip -OutFile $localZipFile
|
DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6
|
||||||
|
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder)
|
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder)
|
||||||
|
|
||||||
|
|
13
build.sh
13
build.sh
|
@ -18,7 +18,18 @@ if test ! -d $buildFolder; then
|
||||||
|
|
||||||
localZipFile="$tempFolder/korebuild.zip"
|
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
|
unzip -q -d $tempFolder $localZipFile
|
||||||
|
|
||||||
mkdir $buildFolder
|
mkdir $buildFolder
|
||||||
|
|
Загрузка…
Ссылка в новой задаче