Skip to content

Commit 47f680f

Browse files
committed
build.ps1: organise script options
Organise the build options which have grown organically. We have a number of options that are co-dependent but were spread apart. Ideally, we would like to minimise the options. There are a number of "options" which are less so user-configurable options but rather options to allow migration (e.g. python version, sccache version). There are some options which are temporary and would be ideal to simply drop at some point (`IncludeDS2` should always be true, `IncludeNoAsserts` should become toolchain variants to build, and `FoundationTestConfiguration` is meant to be a CI configuration).
1 parent 2f2051d commit 47f680f

File tree

1 file changed

+47
-24
lines changed

1 file changed

+47
-24
lines changed

utils/build.ps1

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,49 +117,72 @@ PS> .\Build.ps1 -WindowsSDKArchitectures x64 -ProductVersion 1.2.3 -Test foundat
117117
[CmdletBinding(PositionalBinding = $false)]
118118
param
119119
(
120+
# Build Paths
120121
[System.IO.FileInfo] $SourceCache = "S:\SourceCache",
121122
[System.IO.FileInfo] $BinaryCache = "S:\b",
122123
[System.IO.FileInfo] $ImageRoot = "S:",
123-
[ValidateSet("codeview", "dwarf")]
124-
[string] $CDebugFormat = "dwarf",
125-
[ValidateSet("codeview", "dwarf")]
126-
[string] $SwiftDebugFormat = "dwarf",
127-
[ValidateRange(1, 36)]
128-
[int] $AndroidAPILevel = 28,
129-
[string[]] $AndroidSDKVersions = @("Android", "AndroidExperimental"),
130-
[string[]] $AndroidSDKArchitectures = @("aarch64", "armv7", "i686", "x86_64"),
131-
[string[]] $WindowsSDKVersions = @("Windows", "WindowsExperimental"),
132-
[string[]] $WindowsSDKArchitectures = @("X64","X86","Arm64"),
133-
[string] $ProductVersion = "0.0.0",
134-
[string] $ToolchainIdentifier = $(if ($env:TOOLCHAIN_VERSION) { $env:TOOLCHAIN_VERSION } else { "$env:USERNAME.development" }),
124+
[string] $Stage = "",
125+
126+
# (Pinned) Bootstrap Toolchain
135127
[string] $PinnedBuild = "",
136128
[ValidatePattern("^([A-Fa-f0-9]{64}|)$")]
137129
[string] $PinnedSHA256 = "",
138130
[string] $PinnedVersion = "",
131+
132+
# Build Caching
133+
[switch] $EnableCaching,
134+
[ValidatePattern('^\d+(\.\d+)*$')]
135+
[string] $SCCacheVersion = "0.10.0",
136+
137+
# SBoM Support
138+
[switch] $IncludeSBoM = $false,
139+
[string] $SyftVersion = "1.29.1",
140+
141+
# Dependencies
139142
[ValidatePattern('^\d+(\.\d+)*$')]
140143
[string] $PythonVersion = "3.9.10",
144+
145+
# Toolchain Version Info
146+
[string] $ProductVersion = "0.0.0",
147+
[string] $ToolchainIdentifier = $(if ($env:TOOLCHAIN_VERSION) { $env:TOOLCHAIN_VERSION } else { "$env:USERNAME.development" }),
148+
149+
# Toolchain Cross-compilation
150+
[ValidateSet("AMD64", "ARM64")]
151+
[string] $HostArchName = $(if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE }),
152+
153+
# Debug Information
154+
[switch] $DebugInfo,
155+
[ValidateSet("codeview", "dwarf")]
156+
[string] $CDebugFormat = "dwarf",
157+
[ValidateSet("codeview", "dwarf")]
158+
[string] $SwiftDebugFormat = "dwarf",
159+
160+
# Android SDK Options
161+
[switch] $Android = $false,
141162
[ValidatePattern("^r(?:[1-9]|[1-9][0-9])(?:[a-z])?$")]
142163
[string] $AndroidNDKVersion = "r27c",
164+
[ValidateRange(1, 36)]
165+
[int] $AndroidAPILevel = 28,
166+
[string[]] $AndroidSDKVersions = @("Android", "AndroidExperimental"),
167+
[string[]] $AndroidSDKArchitectures = @("aarch64", "armv7", "i686", "x86_64"),
168+
169+
# Windows SDK Options
143170
[ValidatePattern("^\d+\.\d+\.\d+(?:-\w+)?")]
144171
[string] $WinSDKVersion = "",
145-
[switch] $Android = $false,
172+
[string[]] $WindowsSDKVersions = @("Windows", "WindowsExperimental"),
173+
[string[]] $WindowsSDKArchitectures = @("X64","X86","Arm64"),
174+
175+
# Incremental Build Support
176+
[switch] $Clean,
146177
[switch] $SkipBuild = $false,
147178
[switch] $SkipPackaging = $false,
148-
[switch] $IncludeDS2 = $false,
149-
[switch] $IncludeSBoM = $false,
150179
[string[]] $Test = @(),
151-
[string] $Stage = "",
152-
[ValidateSet("AMD64", "ARM64")]
153-
[string] $HostArchName = $(if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE }),
180+
181+
[switch] $IncludeDS2 = $false,
154182
[switch] $IncludeNoAsserts = $false,
155-
[switch] $Clean,
156-
[switch] $DebugInfo,
157-
[ValidatePattern('^\d+(\.\d+)*$')]
158-
[string] $SCCacheVersion = "0.10.0",
159-
[string] $SyftVersion = "1.29.1",
160-
[switch] $EnableCaching,
161183
[ValidateSet("debug", "release")]
162184
[string] $FoundationTestConfiguration = "debug",
185+
163186
[switch] $Summary,
164187
[switch] $ToBatch
165188
)

0 commit comments

Comments
 (0)