-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathbuild.ps1
45 lines (38 loc) · 1.21 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
#!/usr/bin/env pwsh
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
param (
[Parameter(HelpMessage="Remove earlier built versions")][switch]$Clean,
[Parameter(HelpMessage="Run the tests")][switch]$Test,
[Parameter(HelpMessage="Create a .nupkg")][switch]$Pack,
[Parameter(HelpMessage="Build only for netstandard2.0")][switch]$CoreOnly
)
Write-Progress -Activity "Importing module"
import-module $PSScriptRoot/PowerShellStandard.psm1 -force
if ( $Clean ) {
Start-Clean
return
}
# It would be great if there were targeting frameworks for net452
# on non-Windows platforms, but for now, if you're linux or macOS
# we'll build only core
if ( $IsLinux -or $IsMacOS ) {
$CoreOnly = $true
}
Write-Progress -Activity "Starting Build"
if ( $Pack ) {
if ( $CoreOnly ) {
Write-Warning "Must build both netstandard2.0 and net452 to build package"
throw "Build on a Windows system with netstandard and net452 target platforms"
}
Export-NuGetPackage
}
else {
Start-Build -CoreOnly:$CoreOnly
}
if ( $Test ) {
if ( $psversiontable.psversion.major -lt 6 ) {
throw "Must run tests on PowerShell Core 6 or above"
}
Invoke-Test -CoreOnly:$CoreOnly
}