-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathConsoleGuiTools.build.ps1
More file actions
63 lines (51 loc) · 2.21 KB
/
ConsoleGuiTools.build.ps1
File metadata and controls
63 lines (51 loc) · 2.21 KB
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
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 }
# Copy all DLLs except PowerShell SDK dependencies (those are provided by PowerShell itself)
Get-ChildItem "./publish/*.dll" | Where-Object {
$_.Name -notlike "System.Management.Automation.dll" -and
$_.Name -notlike "Microsoft.PowerShell.Commands.Diagnostics.dll" -and
$_.Name -notlike "Microsoft.Management.Infrastructure.CimCmdlets.dll"
} | ForEach-Object {
Copy-Item -Force -Path $_.FullName -Destination ../../module
}
# Copy the module manifest
Copy-Item -Force -Path "./publish/Microsoft.PowerShell.ConsoleGuiTools.psd1" -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 Test {
Invoke-BuildExec { & dotnet test --configuration $Configuration }
}
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, Test