@@ -54,6 +54,10 @@ The toolchain snapshot to build the early components with.
54
54
. PARAMETER PinnedSHA256
55
55
The SHA256 for the pinned toolchain.
56
56
57
+ . PARAMETER PinnedToolchainVariant
58
+ The toolchain variant to use while building the toolchain. Defaults to
59
+ `Asserts`.
60
+
57
61
. PARAMETER AndroidNDKVersion
58
62
The version number of the Android NDK to be used.
59
63
@@ -102,6 +106,9 @@ in batch file format instead of executing them.
102
106
. PARAMETER HostArchName
103
107
The architecture where the toolchain will execute.
104
108
109
+ . PARAMETER Variant
110
+ The toolchain variant to build. Defaults to `Asserts`.
111
+
105
112
. EXAMPLE
106
113
PS> .\Build.ps1
107
114
@@ -127,6 +134,8 @@ param(
127
134
[ValidatePattern (" ^[A-Fa-f0-9]{64}$" )]
128
135
[string ] $PinnedSHA256 = " " ,
129
136
[string ] $PinnedVersion = " " ,
137
+ [ValidateSet (" Asserts" , " NoAsserts" )]
138
+ [string ] $PinnedToolchainVariant = " Asserts" ,
130
139
[string ] $PythonVersion = " 3.9.10" ,
131
140
[ValidatePattern (" ^r(?:[1-9]|[1-9][0-9])(?:[a-z])?$" )]
132
141
[string ] $AndroidNDKVersion = " r26b" ,
@@ -149,6 +158,8 @@ param(
149
158
[string ] $BuildTo = " " ,
150
159
[ValidateSet (" AMD64" , " ARM64" )]
151
160
[string ] $HostArchName = $ (if ($env: PROCESSOR_ARCHITEW6432 -ne $null ) { " $env: PROCESSOR_ARCHITEW6432 " } else { " $env: PROCESSOR_ARCHITECTURE " }),
161
+ [ValidateSet (" Asserts" , " NoAsserts" )]
162
+ [string ] $Variant = " Asserts" ,
152
163
[switch ] $Clean ,
153
164
[switch ] $DebugInfo ,
154
165
[switch ] $EnableCaching ,
@@ -237,7 +248,7 @@ $ArchX64 = @{
237
248
ExperimentalSDKInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk" ;
238
249
XCTestInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\XCTest-development" ;
239
250
SwiftTestingInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\Testing-development" ;
240
- ToolchainInstallRoot = " $BinaryCache \x64\toolchains\$ProductVersion +Asserts " ;
251
+ ToolchainInstallRoot = " $BinaryCache \x64\toolchains\$ProductVersion +$Variant " ;
241
252
Cache = @ {};
242
253
}
243
254
@@ -271,7 +282,7 @@ $ArchARM64 = @{
271
282
SDKInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\SDKs\Windows.sdk" ;
272
283
ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk" ;
273
284
XCTestInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\XCTest-development" ;
274
- ToolchainInstallRoot = " $BinaryCache \arm64\toolchains\$ProductVersion +Asserts " ;
285
+ ToolchainInstallRoot = " $BinaryCache \arm64\toolchains\$ProductVersion +$Variant " ;
275
286
SwiftTestingInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\Testing-development" ;
276
287
Cache = @ {};
277
288
}
@@ -404,7 +415,7 @@ $LibraryRoot = "$ImageRoot\Library"
404
415
405
416
# For dev productivity, install the host toolchain directly using CMake.
406
417
# This allows iterating on the toolchain using ninja builds.
407
- $HostArch.ToolchainInstallRoot = " $ ( Get-InstallDir $HostArch ) \Toolchains\$ProductVersion +Asserts "
418
+ $HostArch.ToolchainInstallRoot = " $ ( Get-InstallDir $HostArch ) \Toolchains\$ProductVersion +$Variant "
408
419
409
420
# Resolve the architectures received as argument
410
421
$AndroidSDKArchs = @ ($AndroidSDKs | ForEach-Object {
@@ -934,10 +945,13 @@ function Fetch-Dependencies {
934
945
}
935
946
936
947
function Get-PinnedToolchainTool () {
937
- if (Test-Path " $BinaryCache \toolchains\${PinnedToolchain} \LocalApp\Programs\Swift\Toolchains\$ ( Get-PinnedToolchainVersion ) +Asserts\usr\bin" ) {
938
- return " $BinaryCache \toolchains\${PinnedToolchain} \LocalApp\Programs\Swift\Toolchains\$ ( Get-PinnedToolchainVersion ) +Asserts\usr\bin"
948
+ $ToolchainsRoot = [IO.Path ]::Combine(" $BinaryCache " , " toolchains" , " $PinnedToolchain " , " LocalApp" , " Programs" , " Swift" , " Toolchains" )
949
+ $VariantToolchainPath = [IO.Path ]::Combine($ToolchainsRoot , " $ ( Get-PinnedToolchainVersion ) +$PinnedToolchainVariant " , " usr" , " bin" )
950
+ if (Test-Path $VariantToolchainPath ) {
951
+ return $VariantToolchainPath
939
952
}
940
- return " $BinaryCache \toolchains\${PinnedToolchain} \Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin"
953
+
954
+ return " $BinaryCache \toolchains\${PinnedToolchain} \Library\Developer\Toolchains\unknown-$PinnedToolchainVariant -development.xctoolchain\usr\bin"
941
955
}
942
956
943
957
function Get-PinnedToolchainSDK () {
@@ -1670,9 +1684,10 @@ function Build-Compilers() {
1670
1684
LLDB_TABLEGEN = (Join-Path - Path $BuildTools - ChildPath " lldb-tblgen.exe" );
1671
1685
LLDB_TEST_MAKE = " $BinaryCache \GnuWin32Make-4.4.1\bin\make.exe" ;
1672
1686
LLVM_CONFIG_PATH = (Join-Path - Path $BuildTools - ChildPath " llvm-config.exe" );
1687
+ LLVM_ENABLE_ASSERTIONS = $ (if ($Variant -eq " Asserts" ) { " YES" } else { " NO" })
1673
1688
LLVM_EXTERNAL_SWIFT_SOURCE_DIR = " $SourceCache \swift" ;
1674
- LLVM_NATIVE_TOOL_DIR = $BuildTools ;
1675
1689
LLVM_HOST_TRIPLE = $BuildArch.LLVMTarget ;
1690
+ LLVM_NATIVE_TOOL_DIR = $BuildTools ;
1676
1691
LLVM_TABLEGEN = (Join-Path $BuildTools - ChildPath " llvm-tblgen.exe" );
1677
1692
LLVM_USE_HOST_TOOLS = " NO" ;
1678
1693
Python3_EXECUTABLE = (Get-PythonExecutable );
@@ -1690,9 +1705,11 @@ function Build-Compilers() {
1690
1705
SWIFT_ENABLE_SYNCHRONIZATION = " YES" ;
1691
1706
SWIFT_ENABLE_VOLATILE = " YES" ;
1692
1707
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = " $SourceCache \swift-corelibs-libdispatch" ;
1693
- SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE = " $SourceCache \swift-syntax" ;
1694
1708
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = " $SourceCache \swift-experimental-string-processing" ;
1695
1709
SWIFT_PATH_TO_SWIFT_SDK = (Get-PinnedToolchainSDK );
1710
+ SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE = " $SourceCache \swift-syntax" ;
1711
+ SWIFT_STDLIB_ASSERTIONS = " NO" ;
1712
+ SWIFTSYNTAX_ENABLE_ASSERTIONS = " NO" ;
1696
1713
" cmark-gfm_DIR" = " $ ( $Arch.ToolchainInstallRoot ) \usr\lib\cmake" ;
1697
1714
})
1698
1715
}
@@ -3102,7 +3119,7 @@ Fetch-Dependencies
3102
3119
if ($Clean ) {
3103
3120
10 ..[HostComponent ].getEnumValues()[-1 ] | ForEach-Object { Remove-Item - Force - Recurse " $BinaryCache \$_ " - ErrorAction Ignore }
3104
3121
# In case of a previous test run, clear out the swiftmodules as they are not a stable format.
3105
- Remove-Item - Force - Recurse - Path " $ ( $HostARch .ToolchainInstallRoot ) \usr\lib\swift\windows\*.swiftmodule" - ErrorAction Ignore
3122
+ Remove-Item - Force - Recurse - Path " $ ( $HostArch .ToolchainInstallRoot ) \usr\lib\swift\windows\*.swiftmodule" - ErrorAction Ignore
3106
3123
foreach ($Arch in $WindowsSDKArchs ) {
3107
3124
0 ..[TargetComponent ].getEnumValues()[-1 ] | ForEach-Object { Remove-Item - Force - Recurse " $BinaryCache \$ ( $Arch.BuildID + $_ ) " - ErrorAction Ignore }
3108
3125
}
0 commit comments