|
32 | 32 | $Script:TraceVerboseTimer = New-Object System.Diagnostics.Stopwatch |
33 | 33 | $Script:TraceVerboseTimer.Start() |
34 | 34 |
|
35 | | - |
36 | 35 | $ErrorActionPreference = "Stop" |
37 | 36 | Set-StrictMode -Version Latest |
38 | 37 |
|
@@ -241,13 +240,19 @@ function build { |
241 | 240 | } |
242 | 241 | $null = mkdir $ReleasePath -Force |
243 | 242 | $ReleaseModule = Join-Path $ReleasePath ${RootModule} |
244 | | - Trace-Message " Setting content for $ReleaseModule" |
245 | | - |
246 | 243 | $FunctionsToExport = Join-Path $SourcePath Public\*.ps1 -Resolve | % { [System.IO.Path]::GetFileNameWithoutExtension($_) } |
247 | | - Set-Content $ReleaseModule (( |
248 | | - (Get-Content (Join-Path $SourcePath Private\*.ps1) -Raw) + |
249 | | - (Get-Content (Join-Path $SourcePath Public\*.ps1) -Raw)) -join "`r`n`r`n`r`n") -Encoding UTF8 |
250 | 244 |
|
| 245 | + Trace-Message " Setting content for $ReleaseModule" |
| 246 | + try { |
| 247 | + Set-Content $ReleaseModule ( |
| 248 | + @( |
| 249 | + @(Get-Content $(Join-Path $SourcePath Private\*.ps1) -Raw) + |
| 250 | + @(Get-Content $(Join-Path $SourcePath Public\*.ps1) -Raw) |
| 251 | + ) -join "`r`n`r`n`r`n") -Encoding UTF8 |
| 252 | + } catch { |
| 253 | + Trace-Message " FAILED AT: $($_.InvocationInfo.PositionMessage)" |
| 254 | + Write-Error $_ -ErrorAction Stop |
| 255 | + } |
251 | 256 | # If there are any folders that aren't Public, Private, Tests, or Specs ... |
252 | 257 | $OtherFolders = Get-ChildItem $SourcePath -Directory -Exclude Public, Private, Tests, Specs |
253 | 258 | # Then we need to copy everything in them |
@@ -476,11 +481,9 @@ function Trace-Message { |
476 | 481 |
|
477 | 482 | # First call to Trace-Message, pass in our TraceTimer to make sure we time EVERYTHING. |
478 | 483 | Trace-Message "BUILDING: $ModuleName in $Path" -Stopwatch $TraceVerboseTimer |
479 | | - |
480 | 484 | Push-Location $Path |
481 | 485 |
|
482 | | -init |
483 | | - |
| 486 | +init # always runs |
484 | 487 | foreach($s in $step){ |
485 | 488 | Trace-Message "Invoking Step: $s" |
486 | 489 | &$s |
|
0 commit comments