77)
88
99$resourceScript = Join-Path $BuildRoot " New-StronglyTypedCsFileForResx.ps1"
10+ $outPath = " $BuildRoot /out"
11+ $modulePath = " $outPath /PSScriptAnalyzer"
12+
13+ function CreateIfNotExists ([string ] $folderPath ) {
14+ if (-not (Test-Path $folderPath )) {
15+ New-Item - Path $folderPath - ItemType Directory - Verbose:$verbosity
16+ }
17+ }
1018
1119function Get-BuildInputs ($project ) {
1220 pushd $buildRoot / $project
@@ -122,14 +130,13 @@ task makeModule {
122130 $destinationDirBinaries = $destinationDir
123131 if ($Framework -eq " netstandard1.6" ) {
124132 $destinationDirBinaries = " $destinationDir \coreclr"
125- } elseif ($Configuration -match ' PSv3' ) {
133+ }
134+ elseif ($Configuration -match ' PSv3' ) {
126135 $destinationDirBinaries = " $destinationDir \PSv3"
127136 }
128137
129138 Function CopyToDestinationDir ($itemsToCopy , $destination ) {
130- if (-not (Test-Path $destination )) {
131- New-Item - ItemType Directory $destination - Force
132- }
139+ CreateIfNotExists($destination )
133140 foreach ($file in $itemsToCopy ) {
134141 Copy-Item - Path $file - Destination (Join-Path $destination (Split-Path $file - Leaf)) - Force
135142 }
@@ -150,3 +157,45 @@ task makeModule {
150157task cleanModule {
151158 Remove-Item - Path out/ - Recurse - Force
152159}
160+
161+
162+ $docsPath = Join-Path $BuildRoot ' docs'
163+ $outputDocsPath = Join-Path $modulePath ' en-US'
164+ $bdInputs = {Get-ChildItem $docsPath - File - Recurse}
165+ $bdOutputs = @ (
166+ " $outputDocsPath /about_PSScriptAnalyzer.help.txt" ,
167+ " $outputDocsPath /Microsoft.Windows.PowerShell.ScriptAnalyzer.dll-Help.xml"
168+ )
169+
170+ # $buildDocsParams = @{
171+ # Inputs = (Get-ChildItem $docsPath -File -Recurse)
172+ # Outputs = @(
173+ # "$outputDocsPath/about_PSScriptAnalyzer.help.txt",
174+ # "$outputDocsPath/Microsoft.Windows.PowerShell.ScriptAnalyzer.dll-Help.xml"
175+ # )
176+ # }
177+
178+ task buildDocs - Inputs $bdInputs - Outputs $bdOutputs {
179+ # todo move common variables to script scope
180+ $markdownDocsPath = Join-Path $docsPath ' markdown'
181+ CreateIfNotExists($outputDocsPath )
182+
183+ # copy the about help file
184+ Copy-Item - Path $docsPath \about_PSScriptAnalyzer.help.txt - Destination $outputDocsPath - Force
185+
186+ # Build documentation using platyPS
187+ if ((Get-Module PlatyPS - ListAvailable - Verbose:$verbosity ) -eq $null ) {
188+ throw " Cannot find PlatyPS. Please install it from https://www.powershellgallery.com."
189+ }
190+ if ((Get-Module PlatyPS - Verbose:$verbosity ) -eq $null ) {
191+ Import-Module PlatyPS - Verbose:$verbosity
192+ }
193+ if (-not (Test-Path $markdownDocsPath - Verbose:$verbosity )) {
194+ throw " Cannot find markdown documentation folder."
195+ }
196+ New-ExternalHelp - Path $markdownDocsPath - OutputPath $outputDocsPath - Force
197+ }
198+
199+ task cleanDocs {
200+
201+ }
0 commit comments