diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2019-08-22 10:42:38 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2019-08-22 10:42:38 +0300 |
commit | a7ba9cb0c0c2316274b40299a887ce4381f6c22b (patch) | |
tree | 163687cdc68d9794b5704b194e987be31c4c0a7f /.appveyor | |
parent | add .gitattributes (diff) | |
download | windows-env-a7ba9cb0c0c2316274b40299a887ce4381f6c22b.tar.gz windows-env-a7ba9cb0c0c2316274b40299a887ce4381f6c22b.zip |
fix eol
Diffstat (limited to '')
-rw-r--r-- | .appveyor/build.ps1 | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/.appveyor/build.ps1 b/.appveyor/build.ps1 index c4c6117..80477a7 100644 --- a/.appveyor/build.ps1 +++ b/.appveyor/build.ps1 @@ -1,73 +1,73 @@ -param(
- [string] $Platform = $null
-)
-
-$ErrorActionPreference = "Stop";
-
-function Invoke-Exe {
- param(
- [ScriptBlock] $Cmd,
- [int[]] $AllowedExitCodes = @(0)
- )
-
- $backupErrorActionPreference = $script:ErrorActionPreference
- $script:ErrorActionPreference = 'Continue'
-
- try {
- & $Cmd
- if ($AllowedExitCodes -notcontains $LastExitCode) {
- throw "External command failed with exit code ${LastExitCode}: $Cmd"
- }
- } finally {
- $script:ErrorActionPreference = $backupErrorActionPreference
- }
-}
-
-function Test-AppVeyor {
- return Test-Path env:APPVEYOR
-}
-
-function Get-StackUrl {
- param(
- [Parameter(Mandatory=$true)]
- [string] $Platform
- )
-
- if ($Platform -eq 'x86_64') {
- return 'https://get.haskellstack.org/stable/windows-x86_64.zip'
- } else {
- return 'https://get.haskellstack.org/stable/windows-i386.zip'
- }
-}
-
-function Install-Stack {
- param(
- [Parameter(Mandatory=$true)]
- [string] $Platform
- )
-
- Invoke-Exe { curl.exe --silent --show-error --output C:\stack.zip --location --insecure -- $(Get-StackUrl -Platform $Platform) }
- Invoke-Exe { 7z.exe x -oC:\sr C:\stack.zip }
- $env:STACK_ROOT = 'C:\sr'
-}
-
-function Build-Project {
- param(
- [Parameter(Mandatory=$true)]
- [string] $Platform
- )
-
- Invoke-Exe { C:\sr\stack.exe build --install-ghc --arch $Platform }
-}
-
-if (Test-AppVeyor) {
- $cwd = pwd
- $Platform = $env:PLATFORM
-}
-
-Install-Stack -Platform $Platform
-Build-Project -Platform $Platform
-
-if (Test-AppVeyor) {
- cd $cwd
-}
+param( + [string] $Platform = $null +) + +$ErrorActionPreference = "Stop"; + +function Invoke-Exe { + param( + [ScriptBlock] $Cmd, + [int[]] $AllowedExitCodes = @(0) + ) + + $backupErrorActionPreference = $script:ErrorActionPreference + $script:ErrorActionPreference = 'Continue' + + try { + & $Cmd + if ($AllowedExitCodes -notcontains $LastExitCode) { + throw "External command failed with exit code ${LastExitCode}: $Cmd" + } + } finally { + $script:ErrorActionPreference = $backupErrorActionPreference + } +} + +function Test-AppVeyor { + return Test-Path env:APPVEYOR +} + +function Get-StackUrl { + param( + [Parameter(Mandatory=$true)] + [string] $Platform + ) + + if ($Platform -eq 'x86_64') { + return 'https://get.haskellstack.org/stable/windows-x86_64.zip' + } else { + return 'https://get.haskellstack.org/stable/windows-i386.zip' + } +} + +function Install-Stack { + param( + [Parameter(Mandatory=$true)] + [string] $Platform + ) + + Invoke-Exe { curl.exe --silent --show-error --output C:\stack.zip --location --insecure -- $(Get-StackUrl -Platform $Platform) } + Invoke-Exe { 7z.exe x -oC:\sr C:\stack.zip } + $env:STACK_ROOT = 'C:\sr' +} + +function Build-Project { + param( + [Parameter(Mandatory=$true)] + [string] $Platform + ) + + Invoke-Exe { C:\sr\stack.exe build --install-ghc --arch $Platform } +} + +if (Test-AppVeyor) { + $cwd = pwd + $Platform = $env:PLATFORM +} + +Install-Stack -Platform $Platform +Build-Project -Platform $Platform + +if (Test-AppVeyor) { + cd $cwd +} |