-
Notifications
You must be signed in to change notification settings - Fork 53
/
Build.build.ps1
68 lines (57 loc) · 1.94 KB
/
Build.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
<#
.SYNOPSIS
./project.build.ps1
.EXAMPLE
Invoke-Build
.NOTES
0.5.0 - Parameterize
Add parameters to this script to control the build
#>
[CmdletBinding()]
param(
# dotnet build configuration parameter (Debug or Release)
[ValidateSet('Debug', 'Release')]
[string]$Configuration = 'Release',
# Add the clean task before the default build
[switch]$Clean,
# Collect code coverage when tests are run
[switch]$CollectCoverage,
# Which projects to build
[Alias("Projects")]
$dotnetProjects = @(),
# Which projects are test projects
[Alias("TestProjects")]
$dotnetTestProjects = @(),
# Further options to pass to dotnet
[Alias("Options")]
$dotnetOptions = @{
"-verbosity" = "minimal"
# "-runtime" = "linux-x64"
}
)
$InformationPreference = "Continue"
$ErrorView = 'DetailedView'
# The name of the module to publish
$script:PSModuleName = "TerminalBlocks"
# Use Env because Earthly can override it
$Env:OUTPUT_ROOT ??= Join-Path $BuildRoot Modules
$Tasks = "Tasks", "../Tasks", "../../Tasks" | Convert-Path -ErrorAction Ignore | Select-Object -First 1
Write-Information "$($PSStyle.Foreground.BrightCyan)Found shared tasks in $Tasks" -Tag "InvokeBuild"
## Self-contained build script - can be invoked directly or via Invoke-Build
if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') {
& "$Tasks/_Bootstrap.ps1"
Invoke-Build -File $MyInvocation.MyCommand.Path @PSBoundParameters -Result Result
if ($Result.Error) {
$Error[-1].ScriptStackTrace | Out-String
exit 1
}
exit 0
}
## The first task defined is the default task. Put the right values for your project type here...
if ($dotnetProjects -and $Clean) {
Add-BuildTask CleanBuild Clean, ($Task ?? "Test")
} elseif ($Clean) {
Add-BuildTask CleanBuild Clean, ($Task ?? "Test")
}
## Initialize the build variables, and import shared tasks, including DotNet tasks
. "$Tasks/_Initialize.ps1"