Skip to content

Commit 587dc93

Browse files
committed
WinARM64EC support, fix for capturing output
1 parent 62b89d1 commit 587dc93

4 files changed

Lines changed: 76 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ All notable changes to this project will be documented in this file.
88

99
- Change order of pscustomobject to display `output` first so the user doesn't have
1010
to scroll to see the rest of the result fields
11+
- Add `WinARM64EC` as a valid MSBuild platform value, with test coverage for
12+
passing it through to `/p:Platform=WinARM64EC`
13+
- Fix `-ShowOutput` so MSBuild output is streamed line-by-line while still
14+
being captured in the result object's `.output` property
15+
1116

1217
## [0.6.0] - 2026-04-01
1318

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ and the Delphi `RootDir` (and optionally the Platform and Config settings.)
2828

2929
```powershell
3030
delphi-msbuild.ps1 `
31-
-ProjectFile .\src\MyApp.dpr `
31+
-ProjectFile .\src\MyApp.dproj `
3232
-RootDir 'C:\Program Files (x86)\Embarcadero\Studio\23.0'
3333
```
3434

@@ -104,6 +104,7 @@ Valid values:
104104
- `iOSSimulator64`
105105
- `Android32`
106106
- `Android64`
107+
- `WinARM64EC`
107108

108109
## -Config
109110

@@ -232,8 +233,8 @@ delphi-inspect.ps1 -DetectLatest -Platform Win32 -BuildSystem MSBuild |
232233

233234
When set (meant for non-object pipeline usage)
234235

235-
- MSBuild output streams directly to stdout in real time.
236-
- The result object's `.output` property is `null`.
236+
- MSBuild output streams to the console in real time.
237+
- The result object's `.output` property still contains the full captured text.
237238
- On build failure, a `Write-Error` message is emitted to stderr.
238239

239240
When not set (default):
@@ -277,9 +278,9 @@ This allows downstream pipeline steps to consume the build result.
277278
| `unitSearchPath` | string[] | Value of `-UnitSearchPath`; `$null` when not supplied |
278279
| `exitCode` | int | MSBuild process exit code |
279280
| `success` | bool | `$true` when `exitCode` is 0 |
280-
| `output` | string | Captured MSBuild output; `$null` when `-ShowOutput` |
281+
| `output` | string | Captured MSBuild output |
281282

282-
Note: On fata errors before MSBuild is invoked (exit codes 2, 3, 4) no result
283+
Note: On fatal errors before MSBuild is invoked (exit codes 2, 3, 4) no result
283284
object is emitted.
284285

285286
------------------------------------------------------------------------
@@ -339,8 +340,8 @@ delphi-inspect.ps1 -DetectLatest -Platform Win32 -BuildSystem MSBuild |
339340
delphi-msbuild.ps1 -ProjectFile .\src\MyApp.dproj -ShowOutput
340341
```
341342

342-
MSBuild output appears on stdout as it runs. `$result.output` is
343-
`$null` in this mode.
343+
MSBuild output appears in the console as it runs. `$result.output` is still
344+
populated in this mode.
344345

345346
## Example 4) Normal -- feed result into a downstream step
346347

@@ -411,9 +412,9 @@ $result.output # captured MSBuild output containing error diagnostics
411412
```
412413

413414
Inspect `$result.output` to see the MSBuild error lines. When
414-
`-ShowOutput` is used, the output has already streamed to console and
415-
`$result.output` is `$null`; a `Write-Error` message is emitted to
416-
stderr instead.
415+
`-ShowOutput` is used, the output has already streamed to the console and
416+
is still available in `$result.output`; a `Write-Error` message is emitted
417+
to stderr as well.
417418

418419
------------------------------------------------------------------------
419420

source/delphi-msbuild.ps1

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ NOTES
3434
are Debug and Release.
3535
3636
MSBuild output is always captured and returned in the result object's
37-
.output property. Use -ShowOutput to also stream output to stdout in real
38-
time; .output is populated in both cases.
37+
.output property. Use -ShowOutput to also stream output to the console in
38+
real time; .output is populated in both cases.
3939
4040
Exit codes:
4141
0 success
@@ -65,7 +65,7 @@ param(
6565
[string]$RootDir,
6666

6767
[ValidateSet('Win32','Win64','macOS32','macOS64','macOSARM64','Linux64',
68-
'iOS32','iOSSimulator32','iOS64','iOSSimulator64','Android32','Android64')]
68+
'iOS32','iOSSimulator32','iOS64','iOSSimulator64','Android32','Android64','WinARM64EC')]
6969
[string]$Platform = 'Win32',
7070

7171
[string]$Config = 'Debug',
@@ -178,18 +178,27 @@ function Invoke-RsvarsEnvironment {
178178

179179
# Invoke msbuild.exe with the given arguments.
180180
# Returns [pscustomobject]@{ ExitCode; Output } where Output is always the
181-
# captured build text. When -ShowOutput is set the text is also written to
182-
# the host so the caller sees it in real time.
181+
# captured build text. When -ShowOutput is set each output line is also
182+
# written to the host as MSBuild emits it.
183183
# Separated into its own function so tests can mock it.
184184
function Invoke-MsbuildExe {
185185
param(
186186
[string[]]$Arguments,
187187
[switch]$ShowOutput
188188
)
189189

190-
$output = & msbuild.exe @Arguments 2>&1 | Out-String
191-
if ($ShowOutput) { Write-Host $output }
192-
return [pscustomobject]@{ ExitCode = $LASTEXITCODE; Output = $output }
190+
$outputLines = New-Object System.Collections.Generic.List[string]
191+
& msbuild.exe @Arguments 2>&1 | ForEach-Object {
192+
$line = [string]$_
193+
[void]$outputLines.Add($line)
194+
if ($ShowOutput) { Write-Host $line }
195+
}
196+
$exitCode = $LASTEXITCODE
197+
$output = $outputLines -join [Environment]::NewLine
198+
if ($outputLines.Count -gt 0) {
199+
$output += [Environment]::NewLine
200+
}
201+
return [pscustomobject]@{ ExitCode = $exitCode; Output = $output }
193202
}
194203

195204
# Assemble MSBuild arguments and invoke the build.

tests/pwsh/delphi-msbuild.Tests.ps1

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
2525
Describe 4 - Invoke-MsbuildProject:
2626
Passes correct MSBuild arguments to Invoke-MsbuildExe.
27+
Passes WinARM64EC platform through to MSBuild arguments.
2728
Forwards -ShowOutput switch to Invoke-MsbuildExe.
2829
Returns the result object from Invoke-MsbuildExe.
2930
ExeOutputDir adds /p:DCC_ExeOutput; omitted adds nothing.
@@ -254,6 +255,29 @@ Describe 'Invoke-MsbuildProject' {
254255

255256
}
256257

258+
Context 'WinARM64EC platform is passed correctly' {
259+
260+
BeforeAll {
261+
$script:capturedArgs = $null
262+
Mock Invoke-MsbuildExe {
263+
$script:capturedArgs = $Arguments
264+
return [pscustomobject]@{ ExitCode = 0; Output = '' }
265+
}
266+
267+
Invoke-MsbuildProject `
268+
-ProjectFile 'C:\Projects\MyApp.dproj' `
269+
-Platform 'WinARM64EC' `
270+
-Config 'Debug' `
271+
-Target 'Build' `
272+
-Verbosity 'normal'
273+
}
274+
275+
It 'passes /p:Platform=WinARM64EC' {
276+
$script:capturedArgs | Should -Contain '/p:Platform=WinARM64EC'
277+
}
278+
279+
}
280+
257281
Context 'returns the result object from Invoke-MsbuildExe' {
258282

259283
BeforeAll {
@@ -566,6 +590,25 @@ Describe 'Main flow -- pre-MSBuild validation (no MSBuild invoked)' {
566590

567591
}
568592

593+
Context 'accepts WinARM64EC before pre-MSBuild validation' {
594+
595+
BeforeAll {
596+
$script:result = Invoke-ToolProcess -ScriptPath $script:scriptPath -Arguments @(
597+
'-ProjectFile', 'C:\Fake\MyApp.dproj',
598+
'-Platform', 'WinARM64EC'
599+
)
600+
}
601+
602+
It 'continues past parameter binding and exits 3 for missing rootDir' {
603+
$script:result.ExitCode | Should -Be 3
604+
}
605+
606+
It 'stderr contains the missing rootDir message' {
607+
$script:result.StdErr -join ' ' | Should -Match 'root dir'
608+
}
609+
610+
}
611+
569612
Context 'exits 3 when rootDir directory does not exist on disk' {
570613

571614
BeforeAll {

0 commit comments

Comments
 (0)