Skip to content

Commit 7ff21a5

Browse files
committed
build.ps1: isolate bootstrapping macros
Isolate the macros used for building the SDK and the macros built for distribution. This extricates the macros from the SDK build which is required for removing the legacy SDK build.
1 parent 92352b8 commit 7ff21a5

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

utils/build.ps1

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,8 @@ function Invoke-BuildStep {
756756
enum Project {
757757
BuildTools
758758
RegsGen2
759+
BootstrapFoundationMacros
760+
BootstrapTestingMacros
759761

760762
CDispatch
761763
Compilers
@@ -2975,7 +2977,7 @@ function Build-Foundation {
29752977
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
29762978
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
29772979
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
2978-
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform FoundationMacros)\bin"
2980+
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform BootstrapFoundationMacros)\bin"
29792981
}
29802982
}
29812983

@@ -3084,7 +3086,7 @@ function Build-Testing([Hashtable] $Platform) {
30843086
CMAKE_INSTALL_BINDIR = $Platform.BinaryDir;
30853087
dispatch_DIR = (Get-ProjectCMakeModules $Platform Dispatch);
30863088
Foundation_DIR = (Get-ProjectCMakeModules $Platform DynamicFoundation);
3087-
SwiftTesting_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform TestingMacros)\TestingMacros.dll";
3089+
SwiftTesting_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform BootstrapTestingMacros)\TestingMacros.dll";
30883090
SwiftTesting_INSTALL_NESTED_SUBDIR = "YES";
30893091
}
30903092
}
@@ -3135,7 +3137,7 @@ function Install-SDK([Hashtable[]] $Platforms, [OS] $OS = $Platforms[0].OS, [str
31353137
}
31363138
}
31373139

3138-
function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) {
3140+
function Build-SDK([Hashtable] $Platform) {
31393141
if ($IncludeDS2) {
31403142
Invoke-BuildStep Build-DS2 $Platform
31413143
}
@@ -3149,10 +3151,6 @@ function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) {
31493151
# Libraries
31503152
Invoke-BuildStep Build-Runtime $Platform
31513153
Invoke-BuildStep Build-Dispatch $Platform
3152-
if ($IncludeMacros) {
3153-
Invoke-BuildStep Build-FoundationMacros $Platform
3154-
Invoke-BuildStep Build-TestingMacros $Platform
3155-
}
31563154
Invoke-BuildStep Build-Foundation $Platform
31573155
Invoke-BuildStep Build-Sanitizers $Platform
31583156
Invoke-BuildStep Build-XCTest $Platform
@@ -3229,7 +3227,7 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
32293227
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
32303228
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
32313229
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
3232-
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform FoundationMacros)\bin"
3230+
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform BootstrapFoundationMacros)\bin"
32333231
}
32343232

32353233
Build-CMakeProject `
@@ -3261,7 +3259,7 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
32613259
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
32623260
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
32633261
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
3264-
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform FoundationMacros)\bin"
3262+
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform BootstrapFoundationMacros)\bin"
32653263
}
32663264
}
32673265

@@ -3959,7 +3957,28 @@ if (-not $SkipBuild) {
39593957
Invoke-BuildStep Build-CDispatch $HostPlatform
39603958
Invoke-BuildStep Build-Compilers $HostPlatform -Variant "Asserts"
39613959

3962-
Invoke-BuildStep Build-SDK $BuildPlatform -IncludeMacros
3960+
# Build Macros
3961+
Build-CMakeProject `
3962+
-Src $SourceCache\swift-foundation\Sources\FoundationMacros `
3963+
-Bin (Get-ProjectBinaryCache $BuildPlatform BootstrapFoundationMacros) `
3964+
-BuildTargets default `
3965+
-Platform $BuildPlatform `
3966+
-UsePinnedCompilers Swift `
3967+
-SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS) `
3968+
-Defines @{
3969+
SwiftSyntax_DIR = (Get-ProjectCMakeModules $BuildPlatform Compilers);
3970+
}
3971+
3972+
Build-CMakeProject `
3973+
-Src $SourceCache\swift-testing\Sources\TestingMacros `
3974+
-Bin (Get-ProjectBinaryCache $BuildPlatform BootstrapTestingMacros) `
3975+
-BuildTargets default `
3976+
-Platform $BuildPlatform `
3977+
-UsePinnedCompilers Swift `
3978+
-SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS) `
3979+
-Defines @{
3980+
SwiftSyntax_DIR = (Get-ProjectCMakeModules $BuildPlatform Compilers);
3981+
}
39633982

39643983
foreach ($SDK in $WindowsSDKVersions) {
39653984
switch ($SDK) {

0 commit comments

Comments
 (0)