Skip to content

Commit 971ebdb

Browse files
akoeplingerViktorHoferhoyosjs
authored
Don't assume first argument in build.ps1 is subset (#97330)
* Don't assume first argument in build.ps1 is subset We assumed the first argument to the build script is the subset, but that doesn't work if you have `build.cmd /p:SomeProperty=value` like we have in the VMR. Instead do what build.sh does and check whether the first argument looks like a valid subset string and only use it in that case. Fixes dotnet/source-build#3790 * Update eng/build.ps1 Co-authored-by: Juan Hoyos <19413848+hoyosjs@users.noreply.github.com> --------- Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com> Co-authored-by: Juan Hoyos <19413848+hoyosjs@users.noreply.github.com>
1 parent ccdaf39 commit 971ebdb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

eng/build.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Param(
1212
[string]$testscope,
1313
[switch]$testnobuild,
1414
[ValidateSet("x86","x64","arm","arm64","wasm")][string[]][Alias('a')]$arch = @([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()),
15-
[Parameter(Position=0)][string][Alias('s')]$subset,
15+
[string][Alias('s')]$subset,
1616
[ValidateSet("Debug","Release","Checked")][string][Alias('rc')]$runtimeConfiguration,
1717
[ValidateSet("Debug","Release")][string][Alias('lc')]$librariesConfiguration,
1818
[ValidateSet("CoreCLR","Mono")][string][Alias('rf')]$runtimeFlavor,
@@ -130,6 +130,13 @@ if ($help) {
130130
exit 0
131131
}
132132

133+
# check the first argument if subset is not explicitly passed in
134+
if (-not $PSBoundParameters.ContainsKey("subset") -and $properties.Length -gt 0 -and $properties[0] -match '^[a-zA-Z\.\+]+$') {
135+
$subset = $properties[0]
136+
$PSBoundParameters.Add("subset", $subset)
137+
$properties = $properties | Select-Object -Skip 1
138+
}
139+
133140
if ($subset -eq 'help') {
134141
Invoke-Expression "& `"$PSScriptRoot/common/build.ps1`" -restore -build /p:subset=help /clp:nosummary"
135142
exit 0

0 commit comments

Comments
 (0)