From f2c4e6b87d88e7022c5fcd2b6fc1ad9db25ddda5 Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Wed, 26 Jun 2024 15:14:17 +0100 Subject: [PATCH 1/4] Sketch a default architecture environment variable --- eng/build.ps1 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index 1f72dabed00e5f..5ab47aa27b9d21 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -11,7 +11,7 @@ Param( [switch]$coverage, [string]$testscope, [switch]$testnobuild, - [ValidateSet("x86","x64","arm","arm64","wasm")][string[]][Alias('a')]$arch = @([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()), + [ValidateSet("x86","x64","arm","arm64","wasm")][string[]][Alias('a')]$arch, [switch]$cross = $false, [string][Alias('s')]$subset, [ValidateSet("Debug","Release","Checked")][string][Alias('rc')]$runtimeConfiguration, @@ -27,11 +27,19 @@ Param( [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties ) +function Get-Default-Arch() { + if ($env:DOTNET_RUNTIME_DEFAULT_ARCH) { + return $env:DOTNET_RUNTIME_DEFAULT_ARCH + } + + return [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant() +} + function Get-Help() { Write-Host "Common settings:" Write-Host " -arch (-a) Target platform: x86, x64, arm, arm64, or wasm." Write-Host " Pass a comma-separated list to build for multiple architectures." - Write-Host (" [Default: {0} (Depends on your console's architecture.)]" -f [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) + Write-Host (" [Default: {0} (Depends on your console's architecture or the DOTNET_RUNTIME_DEFAULT_ARCH environment variable.)]" -f @(Get-Default-Arch)) Write-Host " -binaryLog (-bl) Output binary log." Write-Host " -configuration (-c) Build configuration: Debug, Release or Checked." Write-Host " Checked is exclusive to the CLR subset. It is the same as Debug, except code is" @@ -143,6 +151,10 @@ if ($subset -eq 'help') { exit 0 } +if (-not $arch) { + $arch = Get-Default-Arch +} + # Lower-case the passed in OS string. if ($os) { $os = $os.ToLowerInvariant() From f6cad7c4c590af713619bb83621bf734f7f46161 Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Fri, 5 Jul 2024 21:21:57 +0100 Subject: [PATCH 2/4] Update eng/build.ps1 --- eng/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index 5ab47aa27b9d21..fe37ba7b15851e 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -28,7 +28,7 @@ Param( ) function Get-Default-Arch() { - if ($env:DOTNET_RUNTIME_DEFAULT_ARCH) { + if ($env:DOTNET_RUNTIME_BUILD_PS1_DEFAULT_ARCH) { return $env:DOTNET_RUNTIME_DEFAULT_ARCH } From 9236c95c4ddd12fe9bb08bb0278430f9faf98475 Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Fri, 5 Jul 2024 21:22:03 +0100 Subject: [PATCH 3/4] Update eng/build.ps1 --- eng/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index fe37ba7b15851e..d4109d9290bc76 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -39,7 +39,7 @@ function Get-Help() { Write-Host "Common settings:" Write-Host " -arch (-a) Target platform: x86, x64, arm, arm64, or wasm." Write-Host " Pass a comma-separated list to build for multiple architectures." - Write-Host (" [Default: {0} (Depends on your console's architecture or the DOTNET_RUNTIME_DEFAULT_ARCH environment variable.)]" -f @(Get-Default-Arch)) + Write-Host (" [Default: {0} (Depends on your console's architecture or the DOTNET_RUNTIME_BUILD_PS1_DEFAULT_ARCH environment variable.)]" -f @(Get-Default-Arch)) Write-Host " -binaryLog (-bl) Output binary log." Write-Host " -configuration (-c) Build configuration: Debug, Release or Checked." Write-Host " Checked is exclusive to the CLR subset. It is the same as Debug, except code is" From e372e61db503ed935bc97528971b2940bd4c91ef Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Fri, 5 Jul 2024 21:23:33 +0100 Subject: [PATCH 4/4] Update eng/build.ps1 --- eng/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index d4109d9290bc76..4b302ba70573ff 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -29,7 +29,7 @@ Param( function Get-Default-Arch() { if ($env:DOTNET_RUNTIME_BUILD_PS1_DEFAULT_ARCH) { - return $env:DOTNET_RUNTIME_DEFAULT_ARCH + return $env:DOTNET_RUNTIME_BUILD_PS1_DEFAULT_ARCH } return [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()