forked from PowerShell/ConsoleGuiTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConsoleGuiTools.build.ps1
56 lines (47 loc) · 1.88 KB
/
ConsoleGuiTools.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
param(
[ValidateSet("Debug", "Release")]
[string]$Configuration = "Debug"
)
task FindDotNet -Before Clean, Build {
Assert (Get-Command dotnet -ErrorAction SilentlyContinue) "The dotnet CLI was not found, please install it: https://aka.ms/dotnet-cli"
$DotnetVersion = dotnet --version
Assert ($?) "The required .NET SDK was not found, please install it: https://aka.ms/dotnet-cli"
Write-Host "Using dotnet $DotnetVersion at path $((Get-Command dotnet).Source)" -ForegroundColor Green
}
task Clean {
Remove-BuildItem ./module, ./out
Push-Location src/Microsoft.PowerShell.ConsoleGuiTools
Invoke-BuildExec { & dotnet clean }
Pop-Location
}
task Build {
New-Item -ItemType Directory -Force ./module | Out-Null
Push-Location src/Microsoft.PowerShell.ConsoleGuiTools
Invoke-BuildExec { & dotnet publish --configuration $Configuration --output publish }
$Assets = $(
"./publish/Microsoft.PowerShell.ConsoleGuiTools.dll",
"./publish/Microsoft.PowerShell.ConsoleGuiTools.psd1",
"./publish/Microsoft.PowerShell.OutGridView.Models.dll",
"./publish/Terminal.Gui.dll",
"./publish/NStack.dll")
$Assets | ForEach-Object {
Copy-Item -Force -Path $_ -Destination ../../module
}
Pop-Location
$Assets = $(
"./README.md",
"./LICENSE.txt",
"./NOTICE.txt")
$Assets | ForEach-Object {
Copy-Item -Force -Path $_ -Destination ./module
}
New-ExternalHelp -Path docs/Microsoft.PowerShell.ConsoleGuiTools -OutputPath module/en-US -Force
}
task Package {
New-Item -ItemType Directory -Force ./out | Out-Null
if (-Not (Get-PSResourceRepository -Name ConsoleGuiTools -ErrorAction SilentlyContinue)) {
Register-PSResourceRepository -Name ConsoleGuiTools -Uri ./out
}
Publish-PSResource -Path ./module -Repository ConsoleGuiTools -Verbose
}
task . Clean, Build