aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-09-16 14:44:29 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-09-16 14:44:29 +0200
commitf0d3d148cc5425dfe8b1fe601093042c3611be55 (patch)
treedd03091d47a4a219fb2f20c2408c721faccb6aa9
parent95cd67ff399d2fc14fc01ef3ac3bd0bebb163c69 (diff)
downloadsonar-scanner-cli-f0d3d148cc5425dfe8b1fe601093042c3611be55.tar.gz
sonar-scanner-cli-f0d3d148cc5425dfe8b1fe601093042c3611be55.zip
Fix build in Appveyor
-rw-r--r--appveyor.ps156
1 files changed, 56 insertions, 0 deletions
diff --git a/appveyor.ps1 b/appveyor.ps1
index 968c088..9e66c12 100644
--- a/appveyor.ps1
+++ b/appveyor.ps1
@@ -1,5 +1,61 @@
$ErrorActionPreference = "Stop"
+function FetchAndUnzip
+{
+ param ([string]$Url, [string]$Out)
+
+ $tmp = [System.IO.Path]::GetTempFileName()
+ [System.Reflection.Assembly]::LoadWithPartialName('System.Net.Http') | Out-Null
+ $client = (New-Object System.Net.Http.HttpClient)
+ try
+ {
+ if (-not([string]::IsNullOrEmpty($env:GITHUB_TOKEN)))
+ {
+ $credentials = [string]::Format([System.Globalization.CultureInfo]::InvariantCulture, "{0}:", $env:GITHUB_TOKEN);
+ $credentials = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($credentials));
+ $client.DefaultRequestHeaders.Authorization = (New-Object System.Net.Http.Headers.AuthenticationHeaderValue("Basic", $credentials));
+ }
+ $contents = $client.GetByteArrayAsync($url).Result;
+ [System.IO.File]::WriteAllBytes($tmp, $contents);
+ }
+ finally
+ {
+ $client.Dispose()
+ }
+
+ if (-not(Test-Path $Out))
+ {
+ mkdir $Out | Out-Null
+ }
+ [System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null
+ [System.IO.Compression.ZipFile]::ExtractToDirectory($tmp, $Out)
+}
+
+function InstallAppveyorTools
+{
+ $travisUtilsVersion = "16"
+ $localPath = "$env:USERPROFILE\.local"
+ $travisUtilsPath = "$localPath\travis-utils-$travisUtilsVersion"
+ if (Test-Path $travisUtilsPath)
+ {
+ echo "Reusing the Travis Utils version $travisUtilsVersion already downloaded under $travisUtilsPath"
+ }
+ else
+ {
+ $url = "https://github.com/SonarSource/travis-utils/archive/v$travisUtilsVersion.zip"
+ echo "Downloading Travis Utils version $travisUtilsVersion from $url into $localPath"
+ FetchAndUnzip $url $localPath
+ }
+
+ $mavenLocalSettings = "$env:USERPROFILE\.m2\settings.xml"
+ echo "Installating settings.xml into $mavenLocalSettings"
+ Copy-Item "$travisUtilsPath\m2\settings-public.xml" $mavenLocalSettings -Force -Recurse
+
+ $env:ORCHESTRATOR_CONFIG_URL = ""
+ $env:TRAVIS = "ORCH-332"
+}
+
+
function CheckLastExitCode
{
param ([int[]]$SuccessCodes = @(0))