Update Build Paths
This commit is contained in:
+35
-25
@@ -1,23 +1,24 @@
|
|||||||
#Requires -Modules 'InvokeBuild'
|
#Requires -Modules 'InvokeBuild'
|
||||||
|
|
||||||
$version = "{0}" -f $(Get-Content .\version.txt)
|
$version = "{0}" -f $(Get-Content .\version.txt)
|
||||||
|
$moduleOutPath = "{0}\temp\{1}\ZertoApiWrapper" -f $BuildRoot, $version
|
||||||
|
|
||||||
#Define the default task
|
#Define the default task
|
||||||
task . CreateArtifacts
|
task . CreateArtifacts
|
||||||
|
|
||||||
#Region - Helper Functions
|
#Region - Helper Functions
|
||||||
function ImportSourceModule() {
|
function ImportSourceModule {
|
||||||
If (Get-Module -Name ZertoApiWrapper) {
|
If (Get-Module -Name ZertoApiWrapper) {
|
||||||
Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop
|
Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop
|
||||||
}
|
}
|
||||||
Import-Module "$BuildRoot\ZertoApiWrapper\ZertoApiWrapper.psd1" -ErrorAction Stop
|
Import-Module "$BuildRoot\ZertoApiWrapper\ZertoApiWrapper.psd1" -ErrorAction Stop
|
||||||
}
|
}
|
||||||
|
|
||||||
function ImportBuiltModule() {
|
function ImportBuiltModule {
|
||||||
If (Get-Module -Name ZertoApiWrapper) {
|
If (Get-Module -Name ZertoApiWrapper) {
|
||||||
Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop
|
Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop
|
||||||
}
|
}
|
||||||
Import-Module "$BuildRoot\temp\ZertoApiWrapper.psd1" -ErrorAction Stop
|
Import-Module ("{0}\ZertoApiWrapper.psd1" -f $moduleOutPath) -ErrorAction Stop
|
||||||
}
|
}
|
||||||
#EndRegion
|
#EndRegion
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, {
|
|||||||
|
|
||||||
task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, {
|
task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, {
|
||||||
$scriptAnalyzerParams = @{
|
$scriptAnalyzerParams = @{
|
||||||
Path = "$BuildRoot\temp\"
|
Path = $moduleOutPath
|
||||||
Severity = @('Error', 'Warning')
|
Severity = @('Error', 'Warning')
|
||||||
Recurse = $true
|
Recurse = $true
|
||||||
Verbose = $false
|
Verbose = $false
|
||||||
@@ -82,10 +83,10 @@ task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, {
|
|||||||
|
|
||||||
#Region - Clean Operations
|
#Region - Clean Operations
|
||||||
task CleanTemp {
|
task CleanTemp {
|
||||||
if (-not $(Test-Path "$BuildRoot\temp")) {
|
if (-not $(Test-Path $moduleOutPath)) {
|
||||||
New-Item -Path $BuildRoot -Name "temp" -ItemType "Directory"
|
New-Item -Path $moduleOutPath -ItemType "Directory"
|
||||||
}
|
}
|
||||||
Remove-Item -Recurse -Path "$BuildRoot\temp\*"
|
Remove-Item -Recurse -Path ("{0}\*" -f $moduleOutPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
task CleanPublish {
|
task CleanPublish {
|
||||||
@@ -116,7 +117,7 @@ task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, {
|
|||||||
#Region - Build Help System
|
#Region - Build Help System
|
||||||
$buildMamlParams = @{
|
$buildMamlParams = @{
|
||||||
Inputs = { Get-ChildItem docs\*.md }
|
Inputs = { Get-ChildItem docs\*.md }
|
||||||
Outputs = "$BuildRoot\temp\en-us\ZertoApiWrapper-help.xml"
|
Outputs = "{0}\en-us\ZertoApiWrapper-help.xml" -f $moduleOutPath
|
||||||
}
|
}
|
||||||
|
|
||||||
task BuildMamlHelp CheckPlatyPSInstalled, {
|
task BuildMamlHelp CheckPlatyPSInstalled, {
|
||||||
@@ -126,8 +127,8 @@ task BuildMamlHelp CheckPlatyPSInstalled, {
|
|||||||
platyPS\New-ExternalHelp .\docs -Force -OutputPath $buildMamlParams.Outputs
|
platyPS\New-ExternalHelp .\docs -Force -OutputPath $buildMamlParams.Outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
task UpdateMarkdownHelp CheckPlatyPSInstalled, {
|
task UpdateMarkdownHelp quickBuild, CheckPlatyPSInstalled, {
|
||||||
ImportSourceModule
|
ImportBuiltModule
|
||||||
Update-MarkdownHelpModule -Path docs -AlphabeticParamsOrder
|
Update-MarkdownHelpModule -Path docs -AlphabeticParamsOrder
|
||||||
}
|
}
|
||||||
#EndRegion
|
#EndRegion
|
||||||
@@ -138,7 +139,7 @@ task CreatePsd1ForRelease CleanTemp, {
|
|||||||
$releaseNotes = "Please review the [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/{0}) on GitHub." -f $version
|
$releaseNotes = "Please review the [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/{0}) on GitHub." -f $version
|
||||||
|
|
||||||
$ManifestParams = @{
|
$ManifestParams = @{
|
||||||
Path = "$BuildRoot\temp\ZertoApiWrapper.psd1"
|
Path = "{0}\ZertoApiWrapper.psd1" -f $moduleOutPath
|
||||||
RootModule = 'ZertoApiWrapper.psm1'
|
RootModule = 'ZertoApiWrapper.psm1'
|
||||||
ModuleVersion = $version
|
ModuleVersion = $version
|
||||||
GUID = '4c0b9e17-141b-4dd5-8549-fb21cccaa325'
|
GUID = '4c0b9e17-141b-4dd5-8549-fb21cccaa325'
|
||||||
@@ -161,25 +162,25 @@ task CreatePsd1ForRelease CleanTemp, {
|
|||||||
|
|
||||||
task CreatePsm1ForRelease CreatePsd1ForRelease, {
|
task CreatePsm1ForRelease CreatePsd1ForRelease, {
|
||||||
$emptyLine = ""
|
$emptyLine = ""
|
||||||
$psm1Path = "$BuildRoot\temp\ZertoApiWrapper.psm1"
|
$psm1Path = "{0}\ZertoApiWrapper.psm1" -f $moduleOutPath
|
||||||
$lines = '#------------------------------------------------------------#'
|
$lines = '#------------------------------------------------------------#'
|
||||||
$Private = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Private\*.ps1 -ErrorAction Stop )
|
$Private = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Private\*.ps1 -ErrorAction Stop )
|
||||||
$Public = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Public\*.ps1 -ErrorAction Stop )
|
$Public = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Public\*.ps1 -ErrorAction Stop )
|
||||||
Add-Content -Path $psm1Path -Value $lines
|
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
|
||||||
Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#"
|
Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#" -Encoding 'utf8'
|
||||||
Add-Content -Path $psm1Path -Value $lines
|
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
|
||||||
Add-Content -Path $psm1Path -Value $emptyLine
|
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
|
||||||
foreach ($file in $private) {
|
foreach ($file in $private) {
|
||||||
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw)
|
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8'
|
||||||
Add-Content -Path $psm1Path -Value $emptyLine
|
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
|
||||||
}
|
}
|
||||||
Add-Content -Path $psm1Path -Value $lines
|
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
|
||||||
Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#"
|
Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#" -Encoding 'utf8'
|
||||||
Add-Content -Path $psm1Path -Value $lines
|
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
|
||||||
Add-Content -Path $psm1Path -Value $emptyLine
|
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
|
||||||
foreach ($file in $public) {
|
foreach ($file in $public) {
|
||||||
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw)
|
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8'
|
||||||
Add-Content -Path $psm1Path -Value $emptyLine
|
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
|
||||||
}
|
}
|
||||||
# Add-Content -Path $psm1Path -Value $emptyLine
|
# Add-Content -Path $psm1Path -Value $emptyLine
|
||||||
# Add-Content -Path $psm1Path -Value "Export-ModuleMember -Function $exportString"
|
# Add-Content -Path $psm1Path -Value "Export-ModuleMember -Function $exportString"
|
||||||
@@ -188,7 +189,7 @@ task CreatePsm1ForRelease CreatePsd1ForRelease, {
|
|||||||
|
|
||||||
#Region - Artifacts \ Publish
|
#Region - Artifacts \ Publish
|
||||||
# Full Build Process - No Publishing
|
# Full Build Process - No Publishing
|
||||||
task CreateArtifacts CleanPublish, CleanTemp, AnalyzeSourceFiles, SourceFileTests, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, {
|
task CreateArtifacts CleanPublish, CleanTemp, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, {
|
||||||
if (-not $(Test-Path "$BuildRoot\publish")) {
|
if (-not $(Test-Path "$BuildRoot\publish")) {
|
||||||
New-Item -Path $BuildRoot -Name "publish" -ItemType Directory
|
New-Item -Path $BuildRoot -Name "publish" -ItemType Directory
|
||||||
}
|
}
|
||||||
@@ -201,3 +202,12 @@ task CreateArtifacts CleanPublish, CleanTemp, AnalyzeSourceFiles, SourceFileTest
|
|||||||
Copy-Item "$BuildRoot\build.ps1" "$BuildRoot\publish\build.ps1"
|
Copy-Item "$BuildRoot\build.ps1" "$BuildRoot\publish\build.ps1"
|
||||||
}
|
}
|
||||||
#EndRegion
|
#EndRegion
|
||||||
|
|
||||||
|
task build CleanPublish, CleanTemp, CreatePsm1ForRelease, AnalyzeBuiltFiles, BuiltFileTests, CreateArtifacts
|
||||||
|
task quickBuild CleanPublish, CleanTemp, CreatePsm1ForRelease, AnalyzeBuiltFiles, {
|
||||||
|
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||||
|
ImportBuiltModule
|
||||||
|
}
|
||||||
|
task release quickBuild, {
|
||||||
|
Publish-Module -Path $moduleOutPath -NuGetApiKey "1234" -WhatIf
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user