1616
1717[CmdletBinding ()]
1818param (
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
2828Import-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#>
13995task 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<#
142109Synopsis: 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<#
198169Synopsis: Zip up the binary for release.
0 commit comments