Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements to build script #2183

Merged
merged 4 commits into from
May 30, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
param (
[switch] $Load,
[switch] $Clean,
[switch] $Inline
[switch] $Inline,
[switch] $Import
)

$ErrorActionPreference = 'Stop'
Expand Down Expand Up @@ -267,9 +268,9 @@ if (-not $inline) {
}

foreach ($f in $files) {
$lines = Get-Content $f

if ($inline) {
$lines = Get-Content $f

$relativePath = ($f.FullName -replace ([regex]::Escape($PSScriptRoot))).TrimStart('\').TrimStart('/')
$null = $sb.AppendLine("# file $relativePath")
$noBuild = $false
Expand Down Expand Up @@ -301,13 +302,15 @@ foreach ($f in $files) {
}
}

$sb.ToString() | Set-Content $PSScriptRoot/bin/Pester.psm1 -Encoding UTF8
$sb.ToString() | Set-Content "$PSScriptRoot/bin/Pester.psm1" -Encoding UTF8

$powershell = Get-Process -Id $PID | Select-Object -ExpandProperty Path

if ($Load) {
& $powershell -c "'Load: ' + (Measure-Command { Import-Module $PSScriptRoot/bin/Pester.psm1 -ErrorAction Stop}).TotalMilliseconds"
& $powershell -c "'Load: ' + (Measure-Command { Import-Module `"$PSScriptRoot/bin/Pester.psd1`" -ErrorAction Stop}).TotalMilliseconds + 'ms'"
fflaten marked this conversation as resolved.
Show resolved Hide resolved
if (0 -ne $LASTEXITCODE) {
throw "load failed!"
}
}

if ($Import) { Import-Module "$PSScriptRoot/bin/Pester.psd1" -Force }