7
7
)
8
8
9
9
$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
+ }
10
18
11
19
function Get-BuildInputs ($project ) {
12
20
pushd $buildRoot / $project
@@ -122,14 +130,13 @@ task makeModule {
122
130
$destinationDirBinaries = $destinationDir
123
131
if ($Framework -eq " netstandard1.6" ) {
124
132
$destinationDirBinaries = " $destinationDir \coreclr"
125
- } elseif ($Configuration -match ' PSv3' ) {
133
+ }
134
+ elseif ($Configuration -match ' PSv3' ) {
126
135
$destinationDirBinaries = " $destinationDir \PSv3"
127
136
}
128
137
129
138
Function CopyToDestinationDir ($itemsToCopy , $destination ) {
130
- if (-not (Test-Path $destination )) {
131
- New-Item - ItemType Directory $destination - Force
132
- }
139
+ CreateIfNotExists($destination )
133
140
foreach ($file in $itemsToCopy ) {
134
141
Copy-Item - Path $file - Destination (Join-Path $destination (Split-Path $file - Leaf)) - Force
135
142
}
@@ -150,3 +157,45 @@ task makeModule {
150
157
task cleanModule {
151
158
Remove-Item - Path out/ - Recurse - Force
152
159
}
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