@@ -100,8 +100,8 @@ in batch file format instead of executing them.
100
100
. PARAMETER HostArchName
101
101
The architecture where the toolchain will execute.
102
102
103
- . PARAMETER Variant
104
- The toolchain variant to build. Defaults to `Asserts` .
103
+ . PARAMETER IncludeNoAsserts
104
+ If set, the no-assert toolchain variant is also build and included in the output .
105
105
106
106
. PARAMETER FoundationTestConfiguration
107
107
Whether to run swift-foundation and swift-corelibs-foundation tests in a debug or release configuration.
@@ -148,8 +148,7 @@ param
148
148
[string ] $Stage = " " ,
149
149
[ValidateSet (" AMD64" , " ARM64" )]
150
150
[string ] $HostArchName = $ (if ($env: PROCESSOR_ARCHITEW6432 ) { $env: PROCESSOR_ARCHITEW6432 } else { $env: PROCESSOR_ARCHITECTURE }),
151
- [ValidateSet (" Asserts" , " NoAsserts" )]
152
- [string ] $Variant = " Asserts" ,
151
+ [switch ] $IncludeNoAsserts = $false ,
153
152
[switch ] $Clean ,
154
153
[switch ] $DebugInfo ,
155
154
[ValidatePattern (' ^\d+(\.\d+)*$' )]
@@ -623,8 +622,10 @@ function Get-InstallDir([Hashtable] $Platform) {
623
622
624
623
# For dev productivity, install the host toolchain directly using CMake.
625
624
# This allows iterating on the toolchain using ninja builds.
626
- $HostPlatform.ToolchainInstallRoot = " $ ( Get-InstallDir $HostPlatform ) \Toolchains\$ProductVersion +$Variant "
627
- $BuildPlatform.ToolchainInstallRoot = " $ ( Get-InstallDir $BuildPlatform ) \Toolchains\$ProductVersion +$Variant "
625
+ $HostPlatform.ToolchainInstallRoot = " $ ( Get-InstallDir $HostPlatform ) \Toolchains\$ProductVersion +$PinnedToolchainVariant "
626
+ $HostPlatform.NoAssertsToolchainInstallRoot = " $ ( Get-InstallDir $HostPlatform ) \Toolchains\$ProductVersion +NoAsserts"
627
+ $BuildPlatform.ToolchainInstallRoot = " $ ( Get-InstallDir $BuildPlatform ) \Toolchains\$ProductVersion +$PinnedToolchainVariant "
628
+ $BuildPlatform.NoAssertsToolchainInstallRoot = " $ ( Get-InstallDir $BuildPlatform ) \Toolchains\$ProductVersion +NoAsserts"
628
629
629
630
# Build functions
630
631
function Invoke-BuildStep {
@@ -1694,7 +1695,7 @@ function Build-CMark([Hashtable] $Platform) {
1694
1695
Build-CMakeProject `
1695
1696
- Src $SourceCache \cmark `
1696
1697
- Bin (Get-CMarkBinaryCache $Platform ) `
1697
- - InstallTo " $ ( Get-InstallDir $Platform ) \Toolchains\$ProductVersion +$Variant \usr" `
1698
+ - InstallTo " $ ( Get-InstallDir $Platform ) \Toolchains\$ProductVersion +$PinnedToolchainVariant \usr" `
1698
1699
- Platform $Platform `
1699
1700
- Defines @ {
1700
1701
BUILD_SHARED_LIBS = " YES" ;
@@ -1737,7 +1738,7 @@ function Build-BuildTools([Hashtable] $Platform) {
1737
1738
SWIFT_INCLUDE_APINOTES = " NO" ;
1738
1739
SWIFT_INCLUDE_DOCS = " NO" ;
1739
1740
SWIFT_INCLUDE_TESTS = " NO" ;
1740
- " cmark-gfm_DIR" = " $ ( Get-InstallDir $Platform ) \Toolchains\$ProductVersion +$Variant \usr\lib\cmake" ;
1741
+ " cmark-gfm_DIR" = " $ ( Get-InstallDir $Platform ) \Toolchains\$ProductVersion +$PinnedToolchainVariant \usr\lib\cmake" ;
1741
1742
}
1742
1743
}
1743
1744
@@ -1773,7 +1774,7 @@ function Load-LitTestOverrides($Filename) {
1773
1774
}
1774
1775
}
1775
1776
1776
- function Get-CompilersDefines ([Hashtable ] $Platform , [switch ] $Test ) {
1777
+ function Get-CompilersDefines ([Hashtable ] $Platformm , [ string ] $Variant , [switch ] $Test ) {
1777
1778
$BuildTools = [IO.Path ]::Combine((Get-ProjectBinaryCache $BuildPlatform BuildTools), " bin" )
1778
1779
$PythonRoot = [IO.Path ]::Combine((Get-PythonPath $Platform ), " tools" )
1779
1780
$PythonLibName = " python{0}{1}" -f ([System.Version ]$PythonVersion ).Major, ([System.Version ]$PythonVersion ).Minor
@@ -1848,7 +1849,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [switch] $Test) {
1848
1849
}
1849
1850
}
1850
1851
1851
- function Build-Compilers ([Hashtable ] $Platform ) {
1852
+ function Build-Compilers ([Hashtable ] $Platform , [ string ] $Variant ) {
1852
1853
New-Item - ItemType SymbolicLink - Path " $BinaryCache \$ ( $HostPlatform.Triple ) \compilers" - Target " $BinaryCache \5" - ErrorAction Ignore
1853
1854
Build-CMakeProject `
1854
1855
- Src $SourceCache \llvm- project\llvm `
@@ -1859,7 +1860,7 @@ function Build-Compilers([Hashtable] $Platform) {
1859
1860
- UsePinnedCompilers Swift `
1860
1861
- BuildTargets @ (" install-distribution" ) `
1861
1862
- CacheScript $SourceCache \swift\cmake\caches\Windows- $ ($Platform.Architecture.LLVMName ).cmake `
1862
- - Defines (Get-CompilersDefines $Platform )
1863
+ - Defines (Get-CompilersDefines $Platform $Variant )
1863
1864
1864
1865
$Settings = @ {
1865
1866
FallbackLibrarySearchPaths = @ (" usr/bin" )
@@ -1869,10 +1870,10 @@ function Build-Compilers([Hashtable] $Platform) {
1869
1870
Write-PList - Settings $Settings - Path " $ ( $Platform.ToolchainInstallRoot ) \ToolchainInfo.plist"
1870
1871
}
1871
1872
1872
- function Test-Compilers ([Hashtable ] $Platform , [switch ] $TestClang , [switch ] $TestLLD , [switch ] $TestLLDB , [switch ] $TestLLVM , [switch ] $TestSwift ) {
1873
+ function Test-Compilers ([Hashtable ] $Platform , [string ] $Variant , [ switch ] $TestClang , [switch ] $TestLLD , [switch ] $TestLLDB , [switch ] $TestLLVM , [switch ] $TestSwift ) {
1873
1874
Invoke-IsolatingEnvVars {
1874
1875
$env: Path = " $ ( Get-CMarkBinaryCache $Platform ) \src;$ ( Get-ProjectBinaryCache $BuildPlatform Compilers) \tools\swift\libdispatch-windows-$ ( $Platform.Architecture.LLVMName ) -prefix\bin;$ ( Get-ProjectBinaryCache $BuildPlatform Compilers) \bin;$env: Path ;$VSInstallRoot \DIA SDK\bin\$ ( $HostPlatform.Architecture.VSName ) ;$UnixToolsBinDir "
1875
- $TestingDefines = Get-CompilersDefines $Platform - Test
1876
+ $TestingDefines = Get-CompilersDefines $Platform $Variant - Test
1876
1877
if ($TestLLVM ) { $Targets += @ (" check-llvm" ) }
1877
1878
if ($TestClang ) { $Targets += @ (" check-clang" ) }
1878
1879
if ($TestLLD ) { $Targets += @ (" check-lld" ) }
@@ -1984,19 +1985,26 @@ function Build-mimalloc() {
1984
1985
" ld.lld.exe" ,
1985
1986
" ld64.lld.exe"
1986
1987
)
1987
- foreach ($Tool in $Tools ) {
1988
- $Binary = [IO.Path ]::Combine($Platform.ToolchainInstallRoot , " usr" , " bin" , $Tool )
1988
+ $Binaries = $Tools | ForEach-Object {[IO.Path ]::Combine($Platform.ToolchainInstallRoot , " usr" , " bin" , $_ )}
1989
+ if ($IncludeNoAsserts ) {
1990
+ $NoAssertBinaries = $Tools `
1991
+ | ForEach-Object {[IO.Path ]::Combine($Platform.NoAssertsToolchainInstallRoot , " usr" , " bin" , $_ )} `
1992
+ | Where-Object { Test-Path $_ - PathType Leaf }
1993
+ $Binaries = $Binaries + $NoAssertBinaries
1994
+ }
1995
+ foreach ($Binary in $Binaries ) {
1996
+ $Name = [IO.Path ]::GetFileName($Binary )
1989
1997
# Binary-patch in place
1990
1998
Invoke-Program " $SourceCache \mimalloc\bin\minject$BuildSuffix " " -f" " -i" " $Binary "
1991
1999
# Log the import table
1992
- $LogFile = " $BinaryCache \$ ( $Platform.Triple ) \mimalloc\minject-log-$Tool .txt"
1993
- $ErrorFile = " $BinaryCache \$ ( $Platform.Triple ) \mimalloc\minject-log-$Tool -error.txt"
2000
+ $LogFile = " $BinaryCache \$ ( $Platform.Triple ) \mimalloc\minject-log-$Name .txt"
2001
+ $ErrorFile = " $BinaryCache \$ ( $Platform.Triple ) \mimalloc\minject-log-$Name -error.txt"
1994
2002
Invoke-Program " $SourceCache \mimalloc\bin\minject$BuildSuffix " " -l" " $Binary " - OutFile $LogFile - ErrorFile $ErrorFile
1995
2003
# Verify patching
1996
2004
$Found = Select-String - Path $LogFile - Pattern " mimalloc"
1997
2005
if (-not $Found ) {
1998
2006
Get-Content $ErrorFile
1999
- throw " Failed to patch mimalloc for $Tool "
2007
+ throw " Failed to patch mimalloc for $Name "
2000
2008
}
2001
2009
}
2002
2010
}
@@ -3232,8 +3240,8 @@ function Test-PackageManager() {
3232
3240
- Src $SrcDir `
3233
3241
- Bin " $BinaryCache \$ ( $HostPlatform.Triple ) \PackageManagerTests" `
3234
3242
- Platform $HostPlatform `
3235
- - Xcc " -I$ ( Get-InstallDir $Platform ) \Toolchains\$ProductVersion +$Variant \usr\include" `
3236
- - Xlinker " -L$ ( Get-InstallDir $Platform ) \Toolchains\$ProductVersion +$Variant \usr\lib"
3243
+ - Xcc " -I$ ( Get-InstallDir $Platform ) \Toolchains\$ProductVersion +$PinnedToolchainVariant \usr\include" `
3244
+ - Xlinker " -L$ ( Get-InstallDir $Platform ) \Toolchains\$ProductVersion +$PinnedToolchainVariant \usr\lib"
3237
3245
}
3238
3246
3239
3247
function Build-Installer ([Hashtable ] $Platform ) {
@@ -3245,6 +3253,7 @@ function Build-Installer([Hashtable] $Platform) {
3245
3253
BundleFlavor = " offline" ;
3246
3254
ImageRoot = " $ ( Get-InstallDir $Platform ) \" ;
3247
3255
INCLUDE_SWIFT_DOCC = $INCLUDE_SWIFT_DOCC ;
3256
+ INCLUDE_NOASSERTS = $IncludeNoAsserts
3248
3257
SWIFT_DOCC_BUILD = " $ ( Get-ProjectBinaryCache $HostPlatform DocC) \release" ;
3249
3258
SWIFT_DOCC_RENDER_ARTIFACT_ROOT = " ${SourceCache} \swift-docc-render-artifact" ;
3250
3259
}
@@ -3314,15 +3323,18 @@ if (-not $SkipBuild) {
3314
3323
Invoke-BuildStep Build-BuildTools $BuildPlatform
3315
3324
if ($IsCrossCompiling ) {
3316
3325
Invoke-BuildStep Build-XML2 $BuildPlatform
3317
- Invoke-BuildStep Build-Compilers $BuildPlatform
3326
+ Invoke-BuildStep Build-Compilers $BuildPlatform - Variant $PinnedToolchainVariant
3318
3327
}
3319
3328
if ($IncludeDS2 ) {
3320
3329
Invoke-BuildStep Build-RegsGen2 $BuildPlatform
3321
3330
}
3322
3331
3323
3332
Invoke-BuildStep Build-CMark $HostPlatform
3324
3333
Invoke-BuildStep Build-XML2 $HostPlatform
3325
- Invoke-BuildStep Build-Compilers $HostPlatform
3334
+ Invoke-BuildStep Build-Compilers $HostPlatform - Variant " Asserts"
3335
+ if ($IncludeNoAsserts ) {
3336
+ Invoke-BuildStep Build-Compilers $HostPlatform - Variant " NoAsserts"
3337
+ }
3326
3338
3327
3339
Invoke-BuildStep Build-SDK $BuildPlatform - IncludeMacros
3328
3340
@@ -3419,7 +3431,7 @@ if (-not $IsCrossCompiling) {
3419
3431
" -TestLLVM" = $Test -contains " llvm" ;
3420
3432
" -TestSwift" = $Test -contains " swift" ;
3421
3433
}
3422
- Invoke-BuildStep Test-Compilers $HostPlatform $Tests
3434
+ Invoke-BuildStep Test-Compilers $HostPlatform $PinnedToolchainVariant $ Tests
3423
3435
}
3424
3436
3425
3437
# FIXME(jeffdav): Invoke-BuildStep needs a platform dictionary, even though the Test-
0 commit comments