-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.ps1
43 lines (36 loc) · 1.42 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$CakeVersion = "0.37.0"
# Make sure tools folder exists
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
$ToolPath = Join-Path $PSScriptRoot "tools"
if (!(Test-Path $ToolPath)) {
Write-Verbose "Creating tools directory..."
New-Item -Path $ToolPath -Type directory | out-null
}
###########################################################################
# INSTALL CAKE
###########################################################################
Add-Type -AssemblyName System.IO.Compression.FileSystem
Function Unzip
{
param([string]$zipfile, [string]$outpath)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}
# Make sure Cake has been installed.
$CakePath = Join-Path $ToolPath "Cake.CoreCLR.$CakeVersion"
$CakeDllPath = Join-Path $CakePath "Cake.dll"
$CakeZipPath = Join-Path $ToolPath "Cake.zip"
if (!(Test-Path $CakeDllPath)) {
Write-Host "Installing Cake $CakeVersion..."
(New-Object System.Net.WebClient).DownloadFile("https://www.nuget.org/api/v2/package/Cake.CoreCLR/$CakeVersion", $CakeZipPath)
Unzip $CakeZipPath $CakePath
Remove-Item $CakeZipPath
}
###########################################################################
# RUN BUILD SCRIPT
###########################################################################
& dotnet "$CakeDllPath" ./build.cake --bootstrap
if ($LASTEXITCODE -eq 0)
{
& dotnet "$CakeDllPath" ./build.cake $args
}
exit $LASTEXITCODE