Skip to content

Commit 2664653

Browse files
authored
Update build as we move help content to PowerShell-Docs (#1537)
1 parent 1f28287 commit 2664653

14 files changed

+261
-1510
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!-- Anything that looks like this is a comment and can't be seen after the Pull Request is created. -->
2+
3+
# PR Summary
4+
5+
<!-- Summarize your PR between here and the checklist. -->
6+
7+
## PR Checklist
8+
9+
- [ ] PR has a meaningful title
10+
- Use the present tense and imperative mood when describing your changes
11+
- [ ] Summarized changes
12+
- [ ] Make sure you've added one or more new tests
13+
- **User-facing changes**
14+
- [ ] Not Applicable
15+
- **OR**
16+
- [ ] Documentation needed at [PowerShell-Docs](https://github.com/MicrosoftDocs/PowerShell-Docs)
17+
- [ ] Doc Issue filed: <!-- Number/link of that issue here -->

.vsts-ci/releaseBuild.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ jobs:
4646
Write-Host ("sending: " + $vstsCommandString)
4747
Write-Host "##$vstsCommandString"
4848
}
49+
Write-Host "PS Version: $($($PSVersionTable.PSVersion))"
4950
$(Build.SourcesDirectory)\build.ps1 -Bootstrap
50-
$(Build.SourcesDirectory)\build.ps1 -Configuration Release -Framework net461
51+
$(Build.SourcesDirectory)\build.ps1 -Configuration Release -Framework net461 -CheckHelpContent
5152
# Get module version
5253
$psd1Data = Import-PowerShellDataFile -Path $(Build.SourcesDirectory)\bin\Release\PSReadLine\PSReadLine.psd1
5354
$moduleVersion = $psd1Data.ModuleVersion

PSReadLine.build.ps1

Lines changed: 20 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
[CmdletBinding()]
1818
param(
19-
[switch]$Install,
20-
2119
[ValidateSet("Debug", "Release")]
2220
[string]$Configuration = (property Configuration Release),
2321

2422
[ValidateSet("net461", "netcoreapp2.1")]
25-
[string]$Framework
23+
[string]$Framework,
24+
25+
[switch]$CheckHelpContent
2626
)
2727

2828
Import-Module "$PSScriptRoot/tools/helper.psm1"
@@ -41,50 +41,6 @@ function ConvertTo-CRLF([string] $text) {
4141
$text.Replace("`r`n","`n").Replace("`n","`r`n")
4242
}
4343

44-
$buildMamlParams = @{
45-
Inputs = { Get-ChildItem docs/*.md }
46-
Outputs = "$targetDir/en-US/Microsoft.PowerShell.PSReadLine2.dll-help.xml"
47-
}
48-
49-
<#
50-
Synopsis: Generate maml help from markdown
51-
#>
52-
task BuildMamlHelp @buildMamlParams {
53-
platyPS\New-ExternalHelp docs -Force -OutputPath $targetDir/en-US/Microsoft.PowerShell.PSReadLine2.dll-help.xml
54-
}
55-
56-
$buildAboutTopicParams = @{
57-
Inputs = {
58-
Get-ChildItem docs/about_PSReadLine.help.txt
59-
"PSReadLine/bin/$Configuration/$Framework/Microsoft.PowerShell.PSReadLine2.dll"
60-
"$PSScriptRoot/tools/GenerateFunctionHelp.ps1"
61-
"$PSScriptRoot/tools/CheckHelp.ps1"
62-
}
63-
Outputs = "$targetDir/en-US/about_PSReadLine.help.txt"
64-
}
65-
66-
<#
67-
Synopsis: Generate about topic with function help
68-
#>
69-
task BuildAboutTopic @buildAboutTopicParams {
70-
# This step loads the dll that was just built, so only do that in another process
71-
# so the file isn't locked in any way for the rest of the build.
72-
$psExePath = Get-PSExePath
73-
74-
$generatedFunctionHelpFile = New-TemporaryFile
75-
& $psExePath -NoProfile -NonInteractive -File $PSScriptRoot/tools/GenerateFunctionHelp.ps1 $Configuration $generatedFunctionHelpFile.FullName
76-
assert ($LASTEXITCODE -eq 0) "Generating function help failed"
77-
78-
$functionDescriptions = Get-Content -Raw $generatedFunctionHelpFile
79-
$aboutTopic = Get-Content -Raw $PSScriptRoot/docs/about_PSReadLine.help.txt
80-
$newAboutTopic = $aboutTopic -replace '{{FUNCTION_DESCRIPTIONS}}', $functionDescriptions
81-
$newAboutTopic = $newAboutTopic -replace "`r`n","`n"
82-
$newAboutTopic | Out-File -FilePath $targetDir\en-US\about_PSReadLine.help.txt -NoNewline -Encoding ascii
83-
84-
& $psExePath -NoProfile -NonInteractive -File $PSScriptRoot/tools/CheckHelp.ps1 $Configuration
85-
assert ($LASTEXITCODE -eq 0) "Checking help and function signatures failed"
86-
}
87-
8844
$binaryModuleParams = @{
8945
Inputs = { Get-ChildItem PSReadLine/*.cs, PSReadLine/PSReadLine.csproj, PSReadLine/PSReadLineResources.resx }
9046
Outputs = "PSReadLine/bin/$Configuration/$Framework/Microsoft.PowerShell.PSReadLine2.dll"
@@ -138,10 +94,25 @@ Synopsis: Run the unit tests
13894
#>
13995
task RunTests BuildMainModule, BuildXUnitTests, { Start-TestRun -Configuration $Configuration -Framework $Framework }
14096

97+
<#
98+
Synopsis: Check if the help content is in sync.
99+
#>
100+
task CheckHelpContent -If $CheckHelpContent {
101+
# This step loads the dll that was just built, so only do that in another process
102+
# so the file isn't locked in any way for the rest of the build.
103+
$psExePath = Get-PSExePath
104+
& $psExePath -NoProfile -NonInteractive -File $PSScriptRoot/tools/CheckHelp.ps1 $Configuration
105+
assert ($LASTEXITCODE -eq 0) "Checking help and function signatures failed"
106+
}
107+
141108
<#
142109
Synopsis: Copy all of the files that belong in the module to one place in the layout for installation
143110
#>
144-
task LayoutModule BuildMainModule, BuildMamlHelp, {
111+
task LayoutModule BuildMainModule, {
112+
if (-not (Test-Path $targetDir -PathType Container)) {
113+
New-Item $targetDir -ItemType Directory -Force > $null
114+
}
115+
145116
$extraFiles =
146117
'License.txt',
147118
'PSReadLine/Changes.txt',
@@ -192,7 +163,7 @@ task LayoutModule BuildMainModule, BuildMamlHelp, {
192163
{
193164
$file.IsReadOnly = $false
194165
}
195-
}, BuildAboutTopic
166+
}, CheckHelpContent
196167

197168
<#
198169
Synopsis: Zip up the binary for release.

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ cache:
1111
- '%HOMEDRIVE%%HOMEPATH%\.nuget\packages -> tools\helper.psm1'
1212

1313
install:
14-
- pwsh: ./build.ps1 -Bootstrap
14+
- pwsh: |
15+
Write-Host "PS Version: $($($PSVersionTable.PSVersion))"
16+
./build.ps1 -Bootstrap
1517
1618
build_script:
1719
- pwsh: |
1820
./build.ps1 -Configuration Release -Framework net461
19-
platyPS\Get-HelpPreview .\bin\Release\PSReadLine\en-US\Microsoft.PowerShell.PSReadLine2.dll-help.xml > .\bin\Release\PSReadLine.txt
2021
2122
test_script:
2223
- pwsh: ./build.ps1 -Test -Configuration Release -Framework net461
2324

2425
artifacts:
2526
- path: .\bin\Release\PSReadLine.zip
26-
- path: .\bin\Release\PSReadLine.txt

az-ci/azure-devops-psreadline.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

az-ci/azure-pipelines.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

build.ps1

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,16 @@
3131
#>
3232
[CmdletBinding()]
3333
param(
34-
[switch]
35-
$Clean,
36-
37-
[switch]
38-
$Bootstrap,
39-
40-
[switch]
41-
$Test,
34+
[switch] $Clean,
35+
[switch] $Bootstrap,
36+
[switch] $Test,
37+
[switch] $CheckHelpContent,
4238

4339
[ValidateSet("Debug", "Release")]
44-
[string]
45-
$Configuration = "Debug",
40+
[string] $Configuration = "Debug",
4641

4742
[ValidateSet("net461", "netcoreapp2.1")]
48-
[string]
49-
$Framework
43+
[string] $Framework
5044
)
5145

5246
# Clean step
@@ -66,10 +60,6 @@ if ($Bootstrap) {
6660
Write-Log "Validate and install missing prerequisits for building ..."
6761

6862
Install-Dotnet
69-
if (-not (Get-Module -Name platyPS -ListAvailable)) {
70-
Write-Log -Warning "Module 'platyPS' is missing. Installing 'platyPS' ..."
71-
Install-Module -Name platyPS -Scope CurrentUser -Force
72-
}
7363
if (-not (Get-Module -Name InvokeBuild -ListAvailable)) {
7464
Write-Log -Warning "Module 'InvokeBuild' is missing. Installing 'InvokeBuild' ..."
7565
Install-Module -Name InvokeBuild -Scope CurrentUser -Force
@@ -80,16 +70,15 @@ if ($Bootstrap) {
8070

8171
# Common step required by both build and test
8272
Find-Dotnet
83-
if (-not (Get-Module -Name platyPS -ListAvailable)) {
84-
throw "Cannot find the 'platyPS' module. Please specify '-Bootstrap' to install build dependencies."
85-
}
8673
if (-not (Get-Module -Name InvokeBuild -ListAvailable)) {
8774
throw "Cannot find the 'InvokeBuild' module. Please specify '-Bootstrap' to install build dependencies."
8875
}
8976

9077
# Build/Test step
9178
$buildTask = if ($Test) { "RunTests" } else { "ZipRelease" }
92-
9379
$arguments = @{ Task = $buildTask; Configuration = $Configuration }
80+
9481
if ($Framework) { $arguments.Add("Framework", $Framework) }
82+
if ($CheckHelpContent) { $arguments.Add("CheckHelpContent", $true) }
83+
9584
Invoke-Build @arguments

docs/Get-PSReadLineKeyHandler.md

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)