forked from PowerShell/WindowsCompatibility
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.ps1
47 lines (37 loc) · 1.26 KB
/
Build.ps1
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
###########################################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#region Dependency checks
param(
[switch] $Clean
)
if ($null -eq (Get-Command New-ExternalHelp -ErrorAction SilentlyContinue))
{
throw "Please install PlatyPS using: Install-Module PlatyPS -Scope currentuser"
}
#endregion Dependency checks
$currentPath = Split-Path $MyInvocation.MyCommand.Path -Parent
$outputPath = Join-Path -Path $currentPath -ChildPath "bin"
if ($Clean)
{
Write-Verbose "Cleaning $outputPath" -Verbose
try
{
Remove-Item -Path $outputPath -Recurse -Force -ErrorAction Stop
}
catch [System.Management.Automation.ItemNotFoundException]
{
Write-Warning "$outputPath does not exist. Skipping clean."
}
}
if (-not (Test-Path -PathType Container $outputPath))
{
New-Item -ItemType Directory -Path $outputPath
}
foreach ($file in @('WindowsCompatibility.psd1','WindowsCompatibility.psm1'))
{
Copy-Item .\WindowsCompatibility\$file -Destination $outputPath
}
Write-Verbose "Converting help" -Verbose
New-ExternalHelp -OutputPath $outputPath -Path .\docs\Module\ -Force
Write-Verbose "Module saved to: $outputPath" -Verbose