-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.ps1
42 lines (33 loc) · 1.36 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
$CakeVersion = "0.29.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.
#https://www.nuget.org/api/v2/package
#'https://www.myget.org/F/cake/api/v2/package'
$NugetFeed = 'https://www.nuget.org/api/v2/package'
$CakePath = Join-Path $ToolPath "Cake.$CakeVersion/Cake.exe"
if (!(Test-Path $CakePath)) {
Write-Host "Installing Cake..."
(New-Object System.Net.WebClient).DownloadFile("$NugetFeed/Cake/$CakeVersion", "$ToolPath\Cake.zip")
Unzip "$ToolPath\Cake.zip" "$ToolPath/Cake.$CakeVersion"
Remove-Item "$ToolPath\Cake.zip"
}
###########################################################################
# RUN BUILD SCRIPT
###########################################################################
&"$CakePath" $args
exit $LASTEXITCODE