@@ -108,6 +108,12 @@ param(
108108 # joined with semicolons.
109109 [string []]$IncludePath = @ (),
110110
111+ # Unit scope names searched when resolving unqualified unit names (-NS flag).
112+ # Multiple names are joined with semicolons and passed as a single -NS argument.
113+ # Required for modern Delphi projects that use namespaced RTL units (e.g. System.SysUtils)
114+ # when building outside the IDE without a project .cfg file.
115+ [string []]$Namespace = @ (),
116+
111117 # Additional conditional defines (-D flag). Multiple defines are joined
112118 # with semicolons and passed as a single -D argument.
113119 [string []]$Define = @ (),
@@ -262,6 +268,7 @@ function Invoke-DccProject {
262268 [string ]$DcuOutputDir ,
263269 [string []]$UnitSearchPath = @ (),
264270 [string []]$IncludePath = @ (),
271+ [string []]$Namespace = @ (),
265272 [string []]$Define = @ (),
266273 [switch ]$ShowOutput
267274 )
@@ -286,6 +293,9 @@ function Invoke-DccProject {
286293 if ($UnitSearchPath.Count -gt 0 ) { $dccArgs += " -U$ ( $UnitSearchPath -join ' ;' ) " }
287294 if ($IncludePath.Count -gt 0 ) { $dccArgs += " -I$ ( $IncludePath -join ' ;' ) " }
288295
296+ # Unit scope names: multiple entries joined with semicolons into a single -NS flag
297+ if ($Namespace.Count -gt 0 ) { $dccArgs += " -NS$ ( $Namespace -join ' ;' ) " }
298+
289299 # Additional defines: multiple entries joined with semicolons into a single -D flag
290300 if ($Define.Count -gt 0 ) { $dccArgs += " -D$ ( $Define -join ' ;' ) " }
291301
@@ -343,6 +353,7 @@ try {
343353 - DcuOutputDir $DcuOutputDir `
344354 - UnitSearchPath $UnitSearchPath `
345355 - IncludePath $IncludePath `
356+ - Namespace $Namespace `
346357 - Define $Define `
347358 - ShowOutput:$ShowOutput
348359
@@ -359,6 +370,7 @@ try {
359370 dcuOutputDir = if ([string ]::IsNullOrWhiteSpace($DcuOutputDir )) { $null } else { $DcuOutputDir }
360371 unitSearchPath = if ($UnitSearchPath.Count -eq 0 ) { $null } else { $UnitSearchPath }
361372 includePath = if ($IncludePath.Count -eq 0 ) { $null } else { $IncludePath }
373+ namespace = if ($Namespace.Count -eq 0 ) { $null } else { $Namespace }
362374 exitCode = $buildResult.ExitCode
363375 success = ($buildResult.ExitCode -eq 0 )
364376 output = $buildResult.Output
0 commit comments