-
Notifications
You must be signed in to change notification settings - Fork 38
/
Build.ps1
44 lines (37 loc) · 1.65 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
[CmdletBinding()]
param (
[Parameter(HelpMessage="The action to execute.")]
[ValidateSet("Build", "Test", "Pack", "BuildSite", "DevelopSite")]
[string] $Action = "Build",
[Parameter(HelpMessage="The msbuild configuration to use.")]
[ValidateSet("Debug", "Release")]
[string] $Configuration = "Debug",
[switch] $SkipClean
)
function RunCommand {
param ([string] $CommandExpr)
Write-Verbose " $CommandExpr"
Invoke-Expression $CommandExpr
}
$rootDir = $PSScriptRoot
$srcDir = Join-Path -Path $rootDir -ChildPath 'src'
$testDir = Join-Path -Path $rootDir -ChildPath 'test'
switch ($Action) {
"Test" { $projectdir = Join-Path -Path $testDir -ChildPath 'Falco.Tests' }
"Pack" { $projectDir = Join-Path -Path $srcDir -ChildPath 'Falco' }
"BuildSite" { $projectDir = Join-Path -Path $rootDir -ChildPath 'site' }
"DevelopSite" { $projectDir = Join-Path -Path $rootDir -ChildPath 'site' }
Default { $projectDir = Join-Path -Path $srcDir -ChildPath 'Falco' }
}
if (!$SkipClean.IsPresent)
{
RunCommand "dotnet restore $projectDir --force --force-evaluate --nologo --verbosity quiet"
RunCommand "dotnet clean $projectDir -c $Configuration --nologo --verbosity quiet"
}
switch ($Action) {
"Test" { RunCommand "dotnet test `"$projectDir`"" }
"Pack" { RunCommand "dotnet pack `"$projectDir`" -c $Configuration --include-symbols --include-source" }
"BuildSite" { RunCommand "dotnet build `"$projectDir`" -t:Generate" }
"DevelopSite" { RunCommand "dotnet build `"$projectDir`" -t:Develop" }
Default { RunCommand "dotnet build `"$projectDir`" -c $Configuration" }
}