Skip to content

Commit dea29e2

Browse files
committed
utils: Consistent spelling of $Env in build.ps1.
1 parent cc14548 commit dea29e2

File tree

1 file changed

+52
-52
lines changed

1 file changed

+52
-52
lines changed

utils/build.ps1

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ if ($Env:VSCMD_ARG_HOST_ARCH -or $Env:VSCMD_ARG_TGT_ARCH) {
179179
}
180180

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

184184
$BuildArchName = if ($Env:PROCESSOR_ARCHITEW6432) { $Env:PROCESSOR_ARCHITEW6432 } else { $Env:PROCESSOR_ARCHITECTURE }
185185

@@ -201,15 +201,15 @@ if ($PinnedBuild -eq "") {
201201

202202
$CustomWinSDKRoot = $null # Overwritten if we download a Windows SDK from nuget
203203

204-
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
204+
$vswhere = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
205205
$VSInstallRoot = & $vswhere -nologo -latest -products "*" -all -prerelease -property installationPath
206206
$msbuild = "$VSInstallRoot\MSBuild\Current\Bin\$BuildArchName\MSBuild.exe"
207207

208208
# Hoist to global scope as this is used in two sites.
209209
$WiXVersion = "4.0.6"
210210

211-
# Avoid $env:ProgramFiles in case this script is running as x86
212-
$UnixToolsBinDir = "$env:SystemDrive\Program Files\Git\usr\bin"
211+
# Avoid $Env:ProgramFiles in case this script is running as x86
212+
$UnixToolsBinDir = "$Env:SystemDrive\Program Files\Git\usr\bin"
213213

214214
if ($Android -and ($AndroidSDKs.Length -eq 0)) {
215215
# Enable all android SDKs by default.
@@ -519,7 +519,7 @@ function Get-TargetInfo($Arch) {
519519
$CacheKey = "TargetInfo"
520520
if (-not $Arch.Cache.ContainsKey($CacheKey)) {
521521
Isolate-EnvVars {
522-
$env:Path = "$(Get-PinnedToolchainRuntime);$(Get-PinnedToolchainToolsDir);${env:Path}"
522+
$Env:Path = "$(Get-PinnedToolchainRuntime);$(Get-PinnedToolchainToolsDir);${Env:Path}"
523523
$TargetInfo = & swiftc -target $Arch.LLVMTarget -print-target-info
524524
if ($LastExitCode -ne 0) {
525525
throw "Unable to print target info for '$($Arch.LLVMTarget)'"
@@ -674,19 +674,19 @@ function Invoke-VsDevShell($Arch) {
674674
$WinSDKIncludePath = "$WinSDKVerIncludeRoot\ucrt;$WinSDKVerIncludeRoot\um;$WinSDKVerIncludeRoot\shared;$WinSDKVerIncludeRoot\winrt;$WinSDKVerIncludeRoot\cppwinrt"
675675
$WinSDKVerLibRoot = "$CustomWinSDKRoot\lib\$WinSDKVersion"
676676

677-
$env:WindowsLibPath = "$CustomWinSDKRoot\UnionMetadata\$WinSDKVersion;$CustomWinSDKRoot\References\$WinSDKVersion"
678-
$env:WindowsSdkBinPath = "$CustomWinSDKRoot\bin"
679-
$env:WindowsSDKLibVersion = "$WinSDKVersion\"
680-
$env:WindowsSdkVerBinPath = "$CustomWinSDKRoot\bin\$WinSDKVersion"
681-
$env:WindowsSDKVersion = "$WinSDKVersion\"
677+
$Env:WindowsLibPath = "$CustomWinSDKRoot\UnionMetadata\$WinSDKVersion;$CustomWinSDKRoot\References\$WinSDKVersion"
678+
$Env:WindowsSdkBinPath = "$CustomWinSDKRoot\bin"
679+
$Env:WindowsSDKLibVersion = "$WinSDKVersion\"
680+
$Env:WindowsSdkVerBinPath = "$CustomWinSDKRoot\bin\$WinSDKVersion"
681+
$Env:WindowsSDKVersion = "$WinSDKVersion\"
682682

683-
$env:EXTERNAL_INCLUDE += ";$WinSDKIncludePath"
684-
$env:INCLUDE += ";$WinSDKIncludePath"
685-
$env:LIB += ";$WinSDKVerLibRoot\ucrt\$($Arch.ShortName);$WinSDKVerLibRoot\um\$($Arch.ShortName)"
686-
$env:LIBPATH += ";$env:WindowsLibPath"
687-
$env:PATH += ";$env:WindowsSdkVerBinPath\$($Arch.ShortName);$env:WindowsSdkBinPath\$($Arch.ShortName)"
688-
$env:UCRTVersion = $WinSDKVersion
689-
$env:UniversalCRTSdkDir = $CustomWinSDKRoot
683+
$Env:EXTERNAL_INCLUDE += ";$WinSDKIncludePath"
684+
$Env:INCLUDE += ";$WinSDKIncludePath"
685+
$Env:LIB += ";$WinSDKVerLibRoot\ucrt\$($Arch.ShortName);$WinSDKVerLibRoot\um\$($Arch.ShortName)"
686+
$Env:LIBPATH += ";$Env:WindowsLibPath"
687+
$Env:PATH += ";$Env:WindowsSdkVerBinPath\$($Arch.ShortName);$Env:WindowsSdkBinPath\$($Arch.ShortName)"
688+
$Env:UCRTVersion = $WinSDKVersion
689+
$Env:UniversalCRTSdkDir = $CustomWinSDKRoot
690690
}
691691
}
692692
}
@@ -1066,15 +1066,15 @@ function Build-CMakeProject {
10661066
$DriverBinaryCache = Get-HostProjectBinaryCache Driver
10671067

10681068
if ($EnableCaching) {
1069-
$env:SCCACHE_DIRECT = "true"
1069+
$Env:SCCACHE_DIRECT = "true"
10701070
if ($Cache -eq "") {
1071-
$env:SCCACHE_DIR = "$BinaryCache\sccache"
1071+
$Env:SCCACHE_DIR = "$BinaryCache\sccache"
10721072
} else {
1073-
$env:SCCACHE_DIR = $Cache
1073+
$Env:SCCACHE_DIR = $Cache
10741074
}
10751075
}
10761076
if ($UseSwiftSwiftDriver) {
1077-
$env:SWIFT_DRIVER_SWIFT_FRONTEND_EXEC = ([IO.Path]::Combine($CompilersBinaryCache, "bin", "swift-frontend.exe"))
1077+
$Env:SWIFT_DRIVER_SWIFT_FRONTEND_EXEC = ([IO.Path]::Combine($CompilersBinaryCache, "bin", "swift-frontend.exe"))
10781078
}
10791079

10801080
# TODO(compnerd) workaround swiftc.exe symlink not existing.
@@ -1094,13 +1094,13 @@ function Build-CMakeProject {
10941094
# Set generic android options if we need to build an Android runtime component
10951095
# while building the compiler. Use an environment variable to pass it, to
10961096
# ensure that it can be accessed from the cmake cache file.
1097-
$env:NDKPATH = Get-AndroidNDKPath
1097+
$Env:NDKPATH = Get-AndroidNDKPath
10981098
}
10991099
if ($Platform -eq "Android") {
1100-
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
1100+
$vswhere = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
11011101
$VSInstallPath = & $vswhere -nologo -latest -products * -property installationPath
11021102
if (Test-Path "${VSInstallPath}\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin") {
1103-
$env:Path = "${VSInstallPath}\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;${VSInstallPath}\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;${env:Path}"
1103+
$Env:Path = "${VSInstallPath}\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;${VSInstallPath}\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;${Env:Path}"
11041104
TryAdd-KeyValue $Defines CMAKE_MAKE_PROGRAM "${VSInstallPath}\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe"
11051105
} else {
11061106
throw "Missing CMake and Ninja in the visual studio installation that are needed to build Android"
@@ -1340,9 +1340,9 @@ function Build-CMakeProject {
13401340
}
13411341

13421342
if ($UseBuiltCompilers.Contains("Swift")) {
1343-
$env:Path = "$($BuildArch.SDKInstallRoot)\usr\bin;$(Get-CMarkBinaryCache $BuildArch)\src;$($BuildArch.ToolchainInstallRoot)\usr\bin;$(Get-PinnedToolchainRuntime);${env:Path}"
1343+
$Env:Path = "$($BuildArch.SDKInstallRoot)\usr\bin;$(Get-CMarkBinaryCache $BuildArch)\src;$($BuildArch.ToolchainInstallRoot)\usr\bin;$(Get-PinnedToolchainRuntime);${Env:Path}"
13441344
} elseif ($UsePinnedCompilers.Contains("Swift")) {
1345-
$env:Path = "$(Get-PinnedToolchainRuntime);${env:Path}"
1345+
$Env:Path = "$(Get-PinnedToolchainRuntime);${Env:Path}"
13461346
}
13471347

13481348
if ($ToBatch) {
@@ -1421,9 +1421,9 @@ function Build-SPMProject {
14211421
$SDKInstallRoot = (Get-SwiftSDK Windows)
14221422
$RuntimeInstallRoot = [IO.Path]::Combine((Get-InstallDir $HostArch), "Runtimes", $ProductVersion)
14231423

1424-
$env:Path = "$RuntimeInstallRoot\usr\bin;$($HostArch.ToolchainInstallRoot)\usr\bin;${env:Path}"
1425-
$env:SDKROOT = $SDKInstallRoot
1426-
$env:SWIFTCI_USE_LOCAL_DEPS=1
1424+
$Env:Path = "$RuntimeInstallRoot\usr\bin;$($HostArch.ToolchainInstallRoot)\usr\bin;${Env:Path}"
1425+
$Env:SDKROOT = $SDKInstallRoot
1426+
$Env:SWIFTCI_USE_LOCAL_DEPS=1
14271427

14281428
$Arguments = @(
14291429
"--scratch-path", $Bin,
@@ -1611,7 +1611,7 @@ function Build-Compilers() {
16111611
$BuildTools = Join-Path -Path (Get-BuildProjectBinaryCache BuildTools) -ChildPath bin
16121612

16131613
if ($TestClang -or $TestLLD -or $TestLLDB -or $TestLLVM -or $TestSwift) {
1614-
$env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$CompilersBinaryCache\tools\swift\libdispatch-windows-$($Arch.LLVMName)-prefix\bin;$CompilersBinaryCache\bin;$env:Path;$VSInstallRoot\DIA SDK\bin\$($HostArch.VSName);$UnixToolsBinDir"
1614+
$Env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$CompilersBinaryCache\tools\swift\libdispatch-windows-$($Arch.LLVMName)-prefix\bin;$CompilersBinaryCache\bin;$Env:Path;$VSInstallRoot\DIA SDK\bin\$($HostArch.VSName);$UnixToolsBinDir"
16151615
$Targets = @()
16161616
$TestingDefines = @{
16171617
SWIFT_BUILD_DYNAMIC_SDK_OVERLAY = "YES";
@@ -1638,8 +1638,8 @@ function Build-Compilers() {
16381638
# Override some test results with llvm-lit.
16391639
$TestsToXFail=Select-LitTestOverrides "xfail"
16401640
$TestsToSkip=Select-LitTestOverrides "skip"
1641-
$env:LIT_XFAIL=$TestsToXFail -join ";"
1642-
$env:LIT_FILTER_OUT="($($TestsToSkip -join '|'))"
1641+
$Env:LIT_XFAIL=$TestsToXFail -join ";"
1642+
$Env:LIT_FILTER_OUT="($($TestsToSkip -join '|'))"
16431643

16441644
# Transitive dependency of _lldb.pyd
16451645
$RuntimeBinaryCache = Get-TargetProjectBinaryCache $Arch Runtime
@@ -1771,7 +1771,7 @@ function Build-mimalloc() {
17711771
Isolate-EnvVars {
17721772
Invoke-VsDevShell $Arch
17731773
# Avoid hard-coding the VC tools version number
1774-
$VCRedistDir = (Get-ChildItem "${env:VCToolsRedistDir}\$($HostArch.ShortName)" -Filter "Microsoft.VC*.CRT").FullName
1774+
$VCRedistDir = (Get-ChildItem "${Env:VCToolsRedistDir}\$($HostArch.ShortName)" -Filter "Microsoft.VC*.CRT").FullName
17751775
if ($VCRedistDir) {
17761776
TryAdd-KeyValue $Properties VCRedistDir "$VCRedistDir\"
17771777
}
@@ -2091,7 +2091,7 @@ function Build-Runtime([Platform]$Platform, $Arch) {
20912091
}
20922092

20932093
Isolate-EnvVars {
2094-
$env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
2094+
$Env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$(Get-PinnedToolchainRuntime);${Env:Path}"
20952095

20962096
$CompilersBinaryCache = if ($IsCrossCompiling) {
20972097
Get-BuildProjectBinaryCache Compilers
@@ -2149,7 +2149,7 @@ function Build-ExperimentalRuntime {
21492149
}
21502150

21512151
Isolate-EnvVars {
2152-
$env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
2152+
$Env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$(Get-PinnedToolchainRuntime);${Env:Path}"
21532153

21542154
Build-CMakeProject `
21552155
-Src $SourceCache\swift\Runtimes\Core `
@@ -2200,7 +2200,7 @@ function Build-Dispatch([Platform]$Platform, $Arch, [switch]$Test = $false) {
22002200
if ($Test) {
22012201
$Targets = @("default", "ExperimentalTest")
22022202
$InstallPath = ""
2203-
$env:CTEST_OUTPUT_ON_FAILURE = "YES"
2203+
$Env:CTEST_OUTPUT_ON_FAILURE = "YES"
22042204
} else {
22052205
$Targets = @("install")
22062206
$InstallPath = "$($Arch.SDKInstallRoot)\usr"
@@ -2242,12 +2242,12 @@ function Build-Foundation {
22422242

22432243
$ShortArch = $Arch.LLVMName
22442244
Isolate-EnvVars {
2245-
$env:DISPATCH_INCLUDE_PATH="$($Arch.SDKInstallRoot)/usr/lib/swift"
2246-
$env:LIBXML_LIBRARY_PATH="$LibraryRoot/libxml2-2.11.5/usr/lib/$Platform/$ShortArch"
2247-
$env:LIBXML_INCLUDE_PATH="$LibraryRoot/libxml2-2.11.5/usr/include/libxml2"
2248-
$env:ZLIB_LIBRARY_PATH="$LibraryRoot/zlib-1.3.1/usr/lib/$Platform/$ShortArch"
2249-
$env:CURL_LIBRARY_PATH="$LibraryRoot/curl-8.9.1/usr/lib/$Platform/$ShortArch"
2250-
$env:CURL_INCLUDE_PATH="$LibraryRoot/curl-8.9.1/usr/include"
2245+
$Env:DISPATCH_INCLUDE_PATH="$($Arch.SDKInstallRoot)/usr/lib/swift"
2246+
$Env:LIBXML_LIBRARY_PATH="$LibraryRoot/libxml2-2.11.5/usr/lib/$Platform/$ShortArch"
2247+
$Env:LIBXML_INCLUDE_PATH="$LibraryRoot/libxml2-2.11.5/usr/include/libxml2"
2248+
$Env:ZLIB_LIBRARY_PATH="$LibraryRoot/zlib-1.3.1/usr/lib/$Platform/$ShortArch"
2249+
$Env:CURL_LIBRARY_PATH="$LibraryRoot/curl-8.9.1/usr/lib/$Platform/$ShortArch"
2250+
$Env:CURL_INCLUDE_PATH="$LibraryRoot/curl-8.9.1/usr/include"
22512251
Build-SPMProject `
22522252
-Action Test `
22532253
-Src $SourceCache\swift-corelibs-foundation `
@@ -2371,7 +2371,7 @@ function Build-XCTest([Platform]$Platform, $Arch) {
23712371

23722372
function Test-XCTest {
23732373
Isolate-EnvVars {
2374-
$env:Path = "$(Get-TargetProjectBinaryCache $BuildArch XCTest);$(Get-TargetProjectBinaryCache $BuildArch DynamicFoundation)\bin;$(Get-TargetProjectBinaryCache $BuildArch Dispatch);$(Get-TargetProjectBinaryCache $BuildArch Runtime)\bin;${env:Path};$UnixToolsBinDir"
2374+
$Env:Path = "$(Get-TargetProjectBinaryCache $BuildArch XCTest);$(Get-TargetProjectBinaryCache $BuildArch DynamicFoundation)\bin;$(Get-TargetProjectBinaryCache $BuildArch Dispatch);$(Get-TargetProjectBinaryCache $BuildArch Runtime)\bin;${Env:Path};$UnixToolsBinDir"
23752375

23762376
Build-CMakeProject `
23772377
-Src $SourceCache\swift-corelibs-xctest `
@@ -2597,9 +2597,9 @@ function Build-LLBuild($Arch, [switch]$Test = $false) {
25972597
FILECHECK_EXECUTABLE = ([IO.Path]::Combine((Get-BuildProjectBinaryCache BuildTools), "bin", "FileCheck.exe"));
25982598
LIT_EXECUTABLE = "$SourceCache\llvm-project\llvm\utils\lit\lit.py";
25992599
}
2600-
$env:Path = "$env:Path;$UnixToolsBinDir"
2601-
$env:AR = ([IO.Path]::Combine((Get-HostProjectBinaryCache Compilers), "bin", "llvm-ar.exe"))
2602-
$env:CLANG = ([IO.Path]::Combine((Get-HostProjectBinaryCache Compilers), "bin", "clang.exe"))
2600+
$Env:Path = "$Env:Path;$UnixToolsBinDir"
2601+
$Env:AR = ([IO.Path]::Combine((Get-HostProjectBinaryCache Compilers), "bin", "llvm-ar.exe"))
2602+
$Env:CLANG = ([IO.Path]::Combine((Get-HostProjectBinaryCache Compilers), "bin", "clang.exe"))
26032603
$InstallPath = ""
26042604
} else {
26052605
$Targets = @()
@@ -2822,7 +2822,7 @@ function Test-Format {
28222822
)
28232823

28242824
Isolate-EnvVars {
2825-
$env:SWIFTFORMAT_BUILD_ONLY_TESTS=1
2825+
$Env:SWIFTFORMAT_BUILD_ONLY_TESTS=1
28262826
# Testing swift-format is faster in serial mode than in parallel mode, probably because parallel test execution
28272827
# launches a process for every test class and the process launching overhead on Windows is greater than any
28282828
# gains from parallel test execution.
@@ -2951,17 +2951,17 @@ function Test-SourceKitLSP {
29512951
)
29522952

29532953
Isolate-EnvVars {
2954-
$env:SOURCEKIT_LSP_BUILD_ONLY_TESTS=1
2954+
$Env:SOURCEKIT_LSP_BUILD_ONLY_TESTS=1
29552955

29562956
# CI doesn't contain any sensitive information. Log everything.
2957-
$env:SOURCEKIT_LSP_LOG_PRIVACY_LEVEL="sensitive"
2957+
$Env:SOURCEKIT_LSP_LOG_PRIVACY_LEVEL="sensitive"
29582958

29592959
# Log with the highest log level to simplify debugging of CI failures.
2960-
$env:SOURCEKIT_LSP_LOG_LEVEL="debug"
2960+
$Env:SOURCEKIT_LSP_LOG_LEVEL="debug"
29612961

29622962
# The Windows build doesn't build the SourceKit plugins into the SwiftPM build directory (it builds them using CMake).
29632963
# Tell the tests where to find the just-built plugins.
2964-
$env:SOURCEKIT_LSP_TEST_PLUGIN_PATHS="$($HostArch.ToolchainInstallRoot)\usr\lib"
2964+
$Env:SOURCEKIT_LSP_TEST_PLUGIN_PATHS="$($HostArch.ToolchainInstallRoot)\usr\lib"
29652965

29662966
Build-SPMProject `
29672967
-Action TestParallel `
@@ -3121,7 +3121,7 @@ function Build-Installer($Arch) {
31213121
Isolate-EnvVars {
31223122
Invoke-VsDevShell $Arch
31233123
# Avoid hard-coding the VC tools version number
3124-
$VCRedistDir = (Get-ChildItem "${env:VCToolsRedistDir}\$($HostArch.ShortName)" -Filter "Microsoft.VC*.CRT").FullName
3124+
$VCRedistDir = (Get-ChildItem "${Env:VCToolsRedistDir}\$($HostArch.ShortName)" -Filter "Microsoft.VC*.CRT").FullName
31253125
if ($VCRedistDir) {
31263126
$Properties["VCRedistDir"] = "$VCRedistDir\"
31273127
}

0 commit comments

Comments
 (0)