Skip to content

Commit 3115f38

Browse files
jeffdavcompnerd
andauthored
utils: cleanup compares against null in build.ps1 (#79533)
* utils: cleanup compares against null in build.ps1 * Further cleanup. Co-authored-by: Saleem Abdulrasool <[email protected]>
1 parent 1af236e commit 3115f38

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

utils/build.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ param
130130
[string[]] $AndroidSDKs = @(),
131131
[string[]] $WindowsSDKs = @("X64","X86","Arm64"),
132132
[string] $ProductVersion = "0.0.0",
133-
[string] $ToolchainIdentifier = $(if (${env:TOOLCHAIN_VERSION}) { "${env:TOOLCHAIN_VERSION}" } else { "${env:USERNAME}.development" }),
133+
[string] $ToolchainIdentifier = $(if ($Env:TOOLCHAIN_VERSION) { $Env:TOOLCHAIN_VERSION } else { "$Env:USERNAME.development" }),
134134
[string] $PinnedBuild = "",
135135
[ValidatePattern("^[A-Fa-f0-9]{64}$")]
136136
[string] $PinnedSHA256 = "",
@@ -158,7 +158,7 @@ param
158158
"ZLib")]
159159
[string] $BuildTo = "",
160160
[ValidateSet("AMD64", "ARM64")]
161-
[string] $HostArchName = $(if ($env:PROCESSOR_ARCHITEW6432 -ne $null) { "$env:PROCESSOR_ARCHITEW6432" } else { "$env:PROCESSOR_ARCHITECTURE" }),
161+
[string] $HostArchName = $(if ($Env:PROCESSOR_ARCHITEW6432) { $Env:PROCESSOR_ARCHITEW6432 } else { $Env:PROCESSOR_ARCHITECTURE }),
162162
[ValidateSet("Asserts", "NoAsserts")]
163163
[string] $Variant = "Asserts",
164164
[switch] $Clean,
@@ -174,15 +174,14 @@ Set-StrictMode -Version 3.0
174174

175175
# Avoid being run in a "Developer" shell since this script launches its own sub-shells targeting
176176
# different architectures, and these variables cause confusion.
177-
if ($null -ne $env:VSCMD_ARG_HOST_ARCH -or $null -ne $env:VSCMD_ARG_TGT_ARCH) {
177+
if ($Env:VSCMD_ARG_HOST_ARCH -or $Env:VSCMD_ARG_TGT_ARCH) {
178178
throw "At least one of VSCMD_ARG_HOST_ARCH and VSCMD_ARG_TGT_ARCH is set, which is incompatible with this script. Likely need to run outside of a Developer shell."
179179
}
180180

181181
# Prevent elsewhere-installed swift modules from confusing our builds.
182182
$env:SDKROOT = ""
183183

184-
$BuildArchName = $env:PROCESSOR_ARCHITEW6432
185-
if ($null -eq $BuildArchName) { $BuildArchName = $env:PROCESSOR_ARCHITECTURE }
184+
$BuildArchName = if ($Env:PROCESSOR_ARCHITEW6432) { $Env:PROCESSOR_ARCHITEW6432 } else { $Env:PROCESSOR_ARCHITECTURE }
186185

187186
if ($PinnedBuild -eq "") {
188187
switch ($BuildArchName) {
@@ -3268,7 +3267,8 @@ if ($Stage) {
32683267
}
32693268

32703269
if (-not $IsCrossCompiling) {
3271-
if ($Test -ne $null -and (Compare-Object $Test @("clang", "lld", "lldb", "llvm", "swift") -PassThru -IncludeEqual -ExcludeDifferent) -ne $null) {
3270+
$CompilersTests = @("clang", "lld", "lldb", "llvm", "swift")
3271+
if ($Test | Where-Object { $CompilersTests -contains $_ }) {
32723272
$Tests = @{
32733273
"-TestClang" = $Test -contains "clang";
32743274
"-TestLLD" = $Test -contains "lld";

0 commit comments

Comments
 (0)