Skip to content

Commit eb6f8b4

Browse files
committed
Ensure unit++.lib
1 parent 666b1e1 commit eb6f8b4

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

Build/scripts/Invoke-CppTest.ps1

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,36 @@ function Build-ViewsInterfacesArtifacts {
186186
if ($process.ExitCode -ne 0) { throw "ViewsInterfaces build failed with exit code $($process.ExitCode)" }
187187
}
188188

189+
function Ensure-UnitPlusPlusLibrary {
190+
$unitLibPath = Join-Path $WorktreePath "Lib\$($Configuration.ToLower())\unit++.lib"
191+
if (Test-Path $unitLibPath) {
192+
return
193+
}
194+
195+
Write-Host "[INFO] Missing unit++.lib; building Unit++ library..." -ForegroundColor Yellow
196+
$unitProj = Join-Path $WorktreePath 'Lib\src\unit++\VS\unit++.vcxproj'
197+
if (-not (Test-Path $unitProj)) {
198+
throw "Unit++ project not found: $unitProj"
199+
}
200+
201+
$msbuild = Get-MsBuildExecutable
202+
$msbuildArgs = @(
203+
$unitProj,
204+
'/p:Configuration={0}' -f $Configuration,
205+
'/p:Platform=x64',
206+
'/v:minimal',
207+
'/nologo'
208+
)
209+
$process = Start-Process -FilePath $msbuild -ArgumentList $msbuildArgs -WorkingDirectory $WorktreePath -NoNewWindow -Wait -PassThru
210+
if ($process.ExitCode -ne 0) {
211+
throw "Unit++ build failed with exit code $($process.ExitCode)"
212+
}
213+
214+
if (-not (Test-Path $unitLibPath)) {
215+
throw "Unit++ build completed but library is still missing: $unitLibPath"
216+
}
217+
}
218+
189219
function Ensure-TestViewsPrerequisites {
190220
if ($TestProject -ne 'TestViews') { return }
191221
$fwKernelHeader = Join-Path $WorktreePath "Output\$Configuration\Common\FwKernelTlb.h"
@@ -203,12 +233,14 @@ function Invoke-Build {
203233
(Test-Path (Join-Path $outputDir 'DebugProcs.dll')),
204234
(Test-Path (Join-Path $outputDir 'icuin70.dll')),
205235
(Test-Path (Join-Path $outputDir 'icuuc70.dll'))
206-
) -notcontains $true
236+
) -contains $false
207237
if ($needsNative) {
208238
Write-Host "[INFO] Native runtime artifacts missing for $TestProject; building NativeBuild.csproj..." -ForegroundColor Yellow
209239
Build-NativeArtifacts
210240
}
211241

242+
Ensure-UnitPlusPlusLibrary
243+
212244
if ($BuildSystem -eq 'MSBuild') {
213245
$vcxproj = Join-Path $WorktreePath $config.VcxprojPath
214246

0 commit comments

Comments
 (0)