1- # I might've also stolen this from jborean93 ¯\_(ツ)_/¯
1+ using namespace System.IO
2+
3+ # I might've also stolen this from jborean93 ¯\_(ツ)_/¯
24[CmdletBinding ()]
35param (
46 [ValidateSet (' Debug' , ' Release' )]
57 [string ]
68 $Configuration = ' Debug'
79)
810
9- $modulePath = [IO. Path ]::Combine($PSScriptRoot , ' module' )
10- $manifestItem = Get-Item ([IO. Path ]::Combine($modulePath , ' *.psd1' ))
11+ $modulePath = [Path ]::Combine($PSScriptRoot , ' module' )
12+ $manifestItem = Get-Item ([Path ]::Combine($modulePath , ' *.psd1' ))
1113$ModuleName = $manifestItem.BaseName
1214
1315$testModuleManifestSplat = @ {
@@ -17,13 +19,13 @@ $testModuleManifestSplat = @{
1719}
1820$Manifest = Test-ModuleManifest @testModuleManifestSplat
1921$Version = $Manifest.Version
20- $BuildPath = [IO. Path ]::Combine($PSScriptRoot , ' output' )
21- $PowerShellPath = [IO. Path ]::Combine($PSScriptRoot , ' module' )
22- $CSharpPath = [IO. Path ]::Combine($PSScriptRoot , ' src' , $ModuleName )
23- $ReleasePath = [IO. Path ]::Combine($BuildPath , $ModuleName , $Version )
22+ $BuildPath = [Path ]::Combine($PSScriptRoot , ' output' )
23+ $PowerShellPath = [Path ]::Combine($PSScriptRoot , ' module' )
24+ $CSharpPath = [Path ]::Combine($PSScriptRoot , ' src' , $ModuleName )
25+ $ReleasePath = [Path ]::Combine($BuildPath , $ModuleName , $Version )
2426$IsUnix = $PSEdition -eq ' Core' -and -not $IsWindows
2527$UseNativeArguments = $PSVersionTable.PSVersion -gt ' 7.0'
26- ($csharpProjectInfo = [xml ]::new()).Load((Get-Item ([IO. Path ]::Combine($CSharpPath , ' *.csproj' ))).FullName)
28+ ($csharpProjectInfo = [xml ]::new()).Load((Get-Item ([Path ]::Combine($CSharpPath , ' *.csproj' ))).FullName)
2729$TargetFrameworks = @ (@ ($csharpProjectInfo.Project.PropertyGroup )[0 ].
2830 TargetFrameworks.Split(' ;' , [StringSplitOptions ]::RemoveEmptyEntries))
2931$PSFramework = $TargetFrameworks [0 ]
@@ -38,8 +40,8 @@ task Clean {
3840
3941task BuildDocs {
4042 $helpParams = @ {
41- Path = [IO. Path ]::Combine($PSScriptRoot , ' docs' , ' en-US' )
42- OutputPath = [IO. Path ]::Combine($ReleasePath , ' en-US' )
43+ Path = [Path ]::Combine($PSScriptRoot , ' docs' , ' en-US' )
44+ OutputPath = [Path ]::Combine($ReleasePath , ' en-US' )
4345 }
4446 New-ExternalHelp @helpParams | Out-Null
4547}
@@ -71,25 +73,25 @@ task BuildManaged {
7173
7274task CopyToRelease {
7375 $copyParams = @ {
74- Path = [IO. Path ]::Combine($PowerShellPath , ' *' )
76+ Path = [Path ]::Combine($PowerShellPath , ' *' )
7577 Destination = $ReleasePath
7678 Recurse = $true
7779 Force = $true
7880 }
7981 Copy-Item @copyParams
8082
8183 foreach ($framework in $TargetFrameworks ) {
82- $buildFolder = [IO. Path ]::Combine($CSharpPath , ' bin' , $Configuration , $framework , ' publish' )
83- $binFolder = [IO. Path ]::Combine($ReleasePath , ' bin' , $framework , $_.Name )
84+ $buildFolder = [Path ]::Combine($CSharpPath , ' bin' , $Configuration , $framework , ' publish' )
85+ $binFolder = [Path ]::Combine($ReleasePath , ' bin' , $framework , $_.Name )
8486 if (-not (Test-Path - LiteralPath $binFolder )) {
8587 New-Item - Path $binFolder - ItemType Directory | Out-Null
8688 }
87- Copy-Item ([IO. Path ]::Combine($buildFolder , ' *' )) - Destination $binFolder - Recurse
89+ Copy-Item ([Path ]::Combine($buildFolder , ' *' )) - Destination $binFolder - Recurse
8890 }
8991}
9092
9193task Package {
92- $nupkgPath = [IO. Path ]::Combine($BuildPath , " $ModuleName .$Version *.nupkg" )
94+ $nupkgPath = [Path ]::Combine($BuildPath , " $ModuleName .$Version *.nupkg" )
9395 if (Test-Path $nupkgPath ) {
9496 Remove-Item $nupkgPath - Force
9597 }
@@ -116,7 +118,7 @@ task Package {
116118task Analyze {
117119 $pssaSplat = @ {
118120 Path = $ReleasePath
119- Settings = [IO. Path ]::Combine($PSScriptRoot , ' ScriptAnalyzerSettings.psd1' )
121+ Settings = [Path ]::Combine($PSScriptRoot , ' ScriptAnalyzerSettings.psd1' )
120122 Recurse = $true
121123 ErrorAction = ' SilentlyContinue'
122124 }
@@ -128,18 +130,18 @@ task Analyze {
128130}
129131
130132task DoUnitTest {
131- $testsPath = [IO. Path ]::Combine($PSScriptRoot , ' tests' , ' units' )
133+ $testsPath = [Path ]::Combine($PSScriptRoot , ' tests' , ' units' )
132134 if (-not (Test-Path - LiteralPath $testsPath )) {
133135 Write-Host ' No unit tests found, skipping'
134136 return
135137 }
136138
137- $resultsPath = [IO. Path ]::Combine($BuildPath , ' TestResults' )
139+ $resultsPath = [Path ]::Combine($BuildPath , ' TestResults' )
138140 if (-not (Test-Path - LiteralPath $resultsPath )) {
139141 New-Item $resultsPath - ItemType Directory - ErrorAction Stop | Out-Null
140142 }
141143
142- $tempResultsPath = [IO. Path ]::Combine($resultsPath , ' TempUnit' )
144+ $tempResultsPath = [Path ]::Combine($resultsPath , ' TempUnit' )
143145 if (Test-Path - LiteralPath $tempResultsPath ) {
144146 Remove-Item - LiteralPath $tempResultsPath - Force - Recurse
145147 }
@@ -181,18 +183,18 @@ task DoUnitTest {
181183}
182184
183185task DoTest {
184- $pesterScript = [IO. Path ]::Combine($PSScriptRoot , ' tools' , ' PesterTest.ps1' )
186+ $pesterScript = [Path ]::Combine($PSScriptRoot , ' tools' , ' PesterTest.ps1' )
185187 if (-not (Test-Path $pesterScript )) {
186188 Write-Host ' No Pester tests found, skipping'
187189 return
188190 }
189191
190- $resultsPath = [IO. Path ]::Combine($BuildPath , ' TestResults' )
192+ $resultsPath = [Path ]::Combine($BuildPath , ' TestResults' )
191193 if (-not (Test-Path $resultsPath )) {
192194 New-Item $resultsPath - ItemType Directory - ErrorAction Stop | Out-Null
193195 }
194196
195- $resultsFile = [IO. Path ]::Combine($resultsPath , ' Pester.xml' )
197+ $resultsFile = [Path ]::Combine($resultsPath , ' Pester.xml' )
196198 if (Test-Path $resultsFile ) {
197199 Remove-Item $resultsFile - ErrorAction Stop - Force
198200 }
@@ -205,27 +207,27 @@ task DoTest {
205207 ' -ExecutionPolicy' , ' Bypass'
206208 }
207209 ' -File' , $pesterScript
208- ' -TestPath' , ([IO. Path ]::Combine($PSScriptRoot , ' tests' ))
210+ ' -TestPath' , ([Path ]::Combine($PSScriptRoot , ' tests' ))
209211 ' -OutputFile' , $resultsFile
210212 )
211213
212214 if ($Configuration -eq ' Debug' ) {
213- $unitCoveragePath = [IO. Path ]::Combine($resultsPath , ' UnitCoverage.json' )
215+ $unitCoveragePath = [Path ]::Combine($resultsPath , ' UnitCoverage.json' )
214216 $targetArgs = ' "' + ($arguments -join ' " "' ) + ' "'
215217
216218 if ($UseNativeArguments ) {
217- $watchFolder = [IO. Path ]::Combine($ReleasePath , ' bin' , $PSFramework )
219+ $watchFolder = [Path ]::Combine($ReleasePath , ' bin' , $PSFramework )
218220 }
219221 else {
220222 $targetArgs = ' "' + ($targetArgs -replace ' "' , ' \"' ) + ' "'
221- $watchFolder = ' "{0}"' -f ([IO. Path ]::Combine($ReleasePath , ' bin' , $PSFramework ))
223+ $watchFolder = ' "{0}"' -f ([Path ]::Combine($ReleasePath , ' bin' , $PSFramework ))
222224 }
223225
224226 $arguments = @ (
225227 $watchFolder
226228 ' --target' , $pwsh
227229 ' --targetargs' , $targetArgs
228- ' --output' , ([IO. Path ]::Combine($resultsPath , ' Coverage.xml' ))
230+ ' --output' , ([Path ]::Combine($resultsPath , ' Coverage.xml' ))
229231 ' --format' , ' cobertura'
230232 if (Test-Path - LiteralPath $unitCoveragePath ) {
231233 ' --merge-with' , $unitCoveragePath
0 commit comments