Skip to content

Commit 1c91fae

Browse files
committed
Minot test script fixes
1 parent b7594ff commit 1c91fae

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

Build/scripts/Invoke-CppTest.ps1

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,8 @@ function Build-FwBuildTasks {
148148
'/p:Platform=x64',
149149
'/nologo'
150150
)
151-
$cmd = "cd /d `\"$WorktreePath`\" && $msbuild $($args -join ' ')"
152-
cmd /c $cmd
153-
if ($LASTEXITCODE -ne 0) { throw "FwBuildTasks build failed with exit code $LASTEXITCODE" }
151+
$process = Start-Process -FilePath $msbuild -ArgumentList $args -WorkingDirectory $WorktreePath -NoNewWindow -Wait -PassThru
152+
if ($process.ExitCode -ne 0) { throw "FwBuildTasks build failed with exit code $($process.ExitCode)" }
154153
}
155154

156155
function Build-NativeArtifacts {
@@ -165,9 +164,8 @@ function Build-NativeArtifacts {
165164
'/nologo',
166165
'/m'
167166
)
168-
$cmd = "cd /d `\"$WorktreePath`\" && $msbuild $($args -join ' ')"
169-
cmd /c $cmd
170-
if ($LASTEXITCODE -ne 0) { throw "Native build failed with exit code $LASTEXITCODE" }
167+
$process = Start-Process -FilePath $msbuild -ArgumentList $args -WorkingDirectory $WorktreePath -NoNewWindow -Wait -PassThru
168+
if ($process.ExitCode -ne 0) { throw "Native build failed with exit code $($process.ExitCode)" }
171169
}
172170

173171
function Build-ViewsInterfacesArtifacts {
@@ -182,9 +180,8 @@ function Build-ViewsInterfacesArtifacts {
182180
'/nologo',
183181
'/v:minimal'
184182
)
185-
$cmd = "cd /d `\"$WorktreePath`\" && $msbuild $($args -join ' ')"
186-
cmd /c $cmd
187-
if ($LASTEXITCODE -ne 0) { throw "ViewsInterfaces build failed with exit code $LASTEXITCODE" }
183+
$process = Start-Process -FilePath $msbuild -ArgumentList $args -WorkingDirectory $WorktreePath -NoNewWindow -Wait -PassThru
184+
if ($process.ExitCode -ne 0) { throw "ViewsInterfaces build failed with exit code $($process.ExitCode)" }
188185
}
189186

190187
function Ensure-TestViewsPrerequisites {
@@ -251,9 +248,8 @@ function Invoke-Build {
251248
$msbuildCmd = "$msbuild $($msbuildArgs -join ' ')"
252249
Write-Host "(cd $WorktreePath) $msbuildCmd" -ForegroundColor Gray
253250

254-
$cmdLine = "cd /d `\"$WorktreePath`\" && $msbuildCmd"
255-
cmd /c $cmdLine
256-
if ($LASTEXITCODE -ne 0) { throw "MSBuild failed with exit code $LASTEXITCODE" }
251+
$process = Start-Process -FilePath $msbuild -ArgumentList $msbuildArgs -WorkingDirectory $WorktreePath -NoNewWindow -Wait -PassThru
252+
if ($process.ExitCode -ne 0) { throw "MSBuild failed with exit code $($process.ExitCode)" }
257253

258254
if ($localOutDir) {
259255
$script:LastLocalOutDir = $localOutDir
@@ -307,10 +303,18 @@ function Invoke-Build {
307303

308304
# VsDevCmd is already initialized by Initialize-VsDevEnvironment
309305

310-
$cmd = "cd /d `\"$makeDir`\" && nmake /nologo BUILD_CONFIG=$Configuration BUILD_TYPE=$buildType BUILD_ROOT=$WorktreePath\ BUILD_ARCH=x64 /f $makefile"
311-
Write-Host "cmd /c `\"$cmd`\"" -ForegroundColor Gray
312-
cmd /c $cmd
313-
if ($LASTEXITCODE -ne 0) { throw "NMake failed with exit code $LASTEXITCODE" }
306+
$nmakeArgs = @(
307+
'/nologo',
308+
"BUILD_CONFIG=$Configuration",
309+
"BUILD_TYPE=$buildType",
310+
"BUILD_ROOT=$WorktreePath\",
311+
'BUILD_ARCH=x64',
312+
'/f',
313+
$makefile
314+
)
315+
Write-Host "(cd $makeDir) nmake $($nmakeArgs -join ' ')" -ForegroundColor Gray
316+
$process = Start-Process -FilePath 'nmake' -ArgumentList $nmakeArgs -WorkingDirectory $makeDir -NoNewWindow -Wait -PassThru
317+
if ($process.ExitCode -ne 0) { throw "NMake failed with exit code $($process.ExitCode)" }
314318
}
315319

316320
Write-Host "`nBuild completed successfully." -ForegroundColor Green

0 commit comments

Comments
 (0)