Alias platform parameter to architecture to align to arcade (#1256)
authorJuan Hoyos <juan.hoyos@microsoft.com>
Thu, 18 Jun 2020 17:07:31 +0000 (10:07 -0700)
committerGitHub <noreply@github.com>
Thu, 18 Jun 2020 17:07:31 +0000 (10:07 -0700)
eng/Build-Native.cmd
eng/build.ps1
eng/build.sh

index 3389991565e236d2cf113ca0c587bba672336582..a48a6a96b5f9cb9a1654171ea625d8eb78ee98c8 100644 (file)
@@ -342,7 +342,7 @@ echo.
 echo All arguments are optional. The options are:
 echo.
 echo.-? -h -help --help: view this message.
-echo -architecture <x64|x86|arm|arm64>
-echo -configuration <debug|release>
-echo -verbosity <q[uiet]|m[inimal]|n[ormal]|d[etailed]|diag[nostic]>
+echo -architecture ^<x64^|x86^|arm^|arm64^>.
+echo -configuration ^<debug^|release^>
+echo -verbosity ^<q[uiet]^|m[inimal]^|n[ormal]^|d[etailed]^|diag[nostic]^>
 goto ExitWithError
index 6d3769d8f341fafaa4602a1397ee71adf044a83d..fc7de3c8ddca3927e090ac79e6a60bfdc915de06 100644 (file)
@@ -1,40 +1,27 @@
 [CmdletBinding(PositionalBinding=$false)]
 Param(
-  [string][Alias('c')] $configuration = "Debug",
-  [string] $architecture = "<auto>",
-  [string][Alias('v')] $verbosity = "minimal",
-  [switch][Alias('t')] $test,
-  [switch] $ci,
-  [switch] $skipmanaged,
-  [switch] $skipnative,
-  [string] $privatebuildpath = "",
-  [switch] $cleanupprivatebuild,
-  [ValidatePattern("(default|\d+\.\d+.\d+(-[a-z0-9\.]+)?)")][string] $dotnetruntimeversion = 'default',
-  [ValidatePattern("(default|\d+\.\d+.\d+(-[a-z0-9\.]+)?)")][string] $dotnetruntimedownloadversion= 'default',
-  [string] $runtimesourcefeed = '',
-  [string] $runtimesourcefeedkey = '',
-  [Parameter(ValueFromRemainingArguments=$true)][String[]] $remainingargs
+    [ValidateSet("x86","x64","arm","arm64")][string][Alias('a', "platform")]$architecture = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant(),
+    [ValidateSet("Debug","Release")][string][Alias('c')] $configuration = "Debug",
+    [string][Alias('v')] $verbosity = "minimal",
+    [switch][Alias('t')] $test,
+    [switch] $ci,
+    [switch] $skipmanaged,
+    [switch] $skipnative,
+    [string] $privatebuildpath = "",
+    [switch] $cleanupprivatebuild,
+    [ValidatePattern("(default|\d+\.\d+.\d+(-[a-z0-9\.]+)?)")][string] $dotnetruntimeversion = 'default',
+    [ValidatePattern("(default|\d+\.\d+.\d+(-[a-z0-9\.]+)?)")][string] $dotnetruntimedownloadversion= 'default',
+    [string] $runtimesourcefeed = '',
+    [string] $runtimesourcefeedkey = '',
+    [Parameter(ValueFromRemainingArguments=$true)][String[]] $remainingargs
 )
 
 Set-StrictMode -Version Latest
 $ErrorActionPreference = "Stop"
 
-function Get-Architecture([string]$arch) {
-    switch ($arch.ToLower()) {
-        { $_ -eq "<auto>" } { return Get-Architecture($env:PROCESSOR_ARCHITECTURE) }
-        { ($_ -eq "amd64") -or ($_ -eq "x64") } { return "x64" }
-        { $_ -eq "x86" } { return "x86" }
-        { $_ -eq "arm" } { return "arm" }
-        { $_ -eq "arm64" } { return "arm64" }
-        default { throw "Architecture not supported." }
-    }
-}
-
-$architecture = Get-Architecture($architecture)
-
 $crossbuild = $false
 if (($architecture -eq "arm") -or ($architecture -eq "arm64")) {
-    $processor = Get-Architecture($env:PROCESSOR_ARCHITECTURE)
+    $processor = @([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())
     if ($architecture -ne $processor) {
         $crossbuild = $true
     }
index 9dcb0f8df2cc4534f6497c720dc9c3ca984aae04..d989034f9ef8014de2935ce7feb03b0f64431028 100755 (executable)
@@ -224,7 +224,7 @@ while :; do
             shift
             ;;
 
-        -architecture)
+        -architecture|-a|-platform)
             __BuildArch="$(to_lowercase "$2")"
             shift
             ;;