forked from emgarten/Sleet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
77 lines (62 loc) · 1.76 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
param (
[switch]$SkipTests,
[switch]$SkipPack,
[ValidateSet("Debug", "Release")]
[string]$Configuration = "Release",
[string]$StorageTestAccount,
[switch]$UseDevStorage,
[string]$AWSAccessKeyId,
[string]$AWSSecretAccessKey,
[string]$AWSDefaultRegion
)
$RepoName = "Sleet"
$RepoRoot = $PSScriptRoot
pushd $RepoRoot
# Load common build script helper methods
. "$PSScriptRoot\build\common\common.ps1"
# Set test account if available
if ($StorageTestAccount)
{
Write-Host "SLEET_TEST_ACCOUNT set"
$env:SLEET_TEST_ACCOUNT=$StorageTestAccount
}
if ($UseDevStorage)
{
Write-Host "SLEET_TEST_ACCOUNT set to dev storage"
$env:SLEET_TEST_ACCOUNT="UseDevelopmentStorage=true"
}
# Set AWS S3 storage test values
if ($AWSAccessKeyId) {
Write-Host "Setting AWS_ACCESS_KEY_ID"
$env:AWS_ACCESS_KEY_ID=$AWSAccessKeyId
}
if ($AWSSecretAccessKey) {
Write-Host "Setting AWS_SECRET_ACCESS_KEY"
$env:AWS_SECRET_ACCESS_KEY=$AWSSecretAccessKey
}
if ($AWSDefaultRegion) {
Write-Host "Setting AWS_DEFAULT_REGION"
$env:AWS_DEFAULT_REGION=$AWSDefaultRegion
}
# Download tools
Install-DotnetCLI $RepoRoot
Install-NuGetExe $RepoRoot
# Clean and write git info
Remove-Artifacts $RepoRoot
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:Clean;WriteGitInfo", "/p:Configuration=$Configuration")
# Restore
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:Restore", "/p:Configuration=$Configuration")
# Run main build
$buildTargets = "Build"
if (-not $SkipPack)
{
$buildTargets += ";Pack"
}
if (-not $SkipTests)
{
$buildTargets += ";Test"
}
# Run build.proj
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:$buildTargets", "/p:Configuration=$Configuration")
popd
Write-Host "Success!"