forked from thedavecarroll/BluebirdPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpsakeBuild.ps1
77 lines (57 loc) · 2.84 KB
/
psakeBuild.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
properties {
$PSBPreference.Build.CompileModule = $true
$PSBPreference.Build.CompileDirectories = 'Prepend', 'Classes', 'Private', 'Public', 'Append'
$PSBPreference.Build.CopyDirectories = 'resources'
$PSBPreference.Build.CompileScriptHeader = [System.Environment]::NewLine
$PSBPreference.Test.ScriptAnalysis.SettingsPath = [IO.Path]::Combine($env:BHProjectPath,'build','ScriptAnalyzerSettings.psd1')
}
task CompileApiEndpoint -Depends 'StageFiles' {
Import-Module $([IO.Path]::Combine($env:BHProjectPath,'build','BuildFunctions.psm1'))
Import-TwitterApiEndpoints -Path $([IO.Path]::Combine($env:BHProjectPath,'Endpoints')) |
ConvertTo-Json -Depth 20 |
Add-Content -Path $([IO.Path]::Combine($PSBPreference.Build.ModuleOutDir,'resources','TwitterApiEndpoints.json'))
} -Description 'Compile the Twitter API Endpoint JSON resource'
task GenerateExternalHelp {
$ExternalHelpPath = [IO.Path]::Combine($PSBPreference.Build.ModuleOutDir,(Get-UICulture).Name)
$NewExternalHelpParams = @{
Path = Get-ChildItem -Path $PSBPreference.Docs.RootDir -Include '*-*.md' -Recurse
OutputPath = $ExternalHelpPath
Force = $true
}
New-ExternalHelp @NewExternalHelpParams | Out-Null
$NewAboutHelpParams = @{
Path = $([IO.Path]::Combine($PSBPreference.Docs.RootDir,"about_$env:BHProjectName.md"))
OutputPath = $ExternalHelpPath
Force = $true
}
New-ExternalHelp @NewAboutHelpParams | Out-Null
Start-Sleep -Seconds 2
} -Description 'Generates MAML-based help from PlatyPS markdown files'
task AddFileListToManifest {
$FileListParentFolder = '{0}{1}' -f $PSBPreference.Build.ModuleOutDir,[IO.Path]::DirectorySeparatorChar
$UpdateManifestParams = @{
Path = [IO.Path]::Combine($PSBPreference.Build.ModuleOutDir,"$env:BHProjectName.psd1")
FileList = Get-ChildItem -Path $PSBPreference.Build.ModuleOutDir -File -Recurse | ForEach-Object {
$_.FullName.Replace($FileListParentFolder,'')
}
}
Update-ModuleManifest @UpdateManifestParams
} -Description 'Add files list to module manifest'
task DotNetBuild -Depends 'StageFiles' {
$OutputBinFolder = [IO.Path]::Combine($PSBPreference.Build.ModuleOutDir,'bin')
$DotNetSrcFolder = [IO.Path]::Combine($env:BHProjectPath,'src')
dotnet build $DotNetSrcFolder -o $OutputBinFolder
if ($LASTEXITCODE -ne 0) {
'DotNetBuild task failed' | Write-Error -ErrorAction Stop
}
} -Description 'Compile .Net Library'
<#
New Tasks
task UpdateChangeLog
task UpdateReleaseNotes -Depends UpdateChangeLog
task CreateReleaseAsset
task PublishReleaseToGitHub -Depends CreateReleaseAsset
https://github.com/microsoft/PowerShellForGitHub
#>
task Build -FromModule PowerShellBuild -depends @('CompileApiEndpoint','DotNetBuild','GenerateExternalHelp','AddFileListToManifest')
task default -depends Build