Skip to content

Commit 63c0bf3

Browse files
authored
Merge pull request #71732 from compnerd/platform
build: explicitly specify the platform that we are building for
2 parents c7c3eb2 + 2ab18d3 commit 63c0bf3

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

utils/build.ps1

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,11 @@ function Build-Compilers() {
10611061
}
10621062
}
10631063

1064-
function Build-LLVM($Arch) {
1064+
enum Platform {
1065+
Windows
1066+
}
1067+
1068+
function Build-LLVM([Platform]$Platform, $Arch) {
10651069
Build-CMakeProject `
10661070
-Src $SourceCache\llvm-project\llvm `
10671071
-Bin (Get-TargetProjectBinaryCache $Arch LLVM) `
@@ -1071,7 +1075,7 @@ function Build-LLVM($Arch) {
10711075
}
10721076
}
10731077

1074-
function Build-ZLib($Arch) {
1078+
function Build-ZLib([Platform]$Platform, $Arch) {
10751079
$ArchName = $Arch.ShortName
10761080

10771081
Build-CMakeProject `
@@ -1087,7 +1091,7 @@ function Build-ZLib($Arch) {
10871091
}
10881092
}
10891093

1090-
function Build-XML2($Arch) {
1094+
function Build-XML2([Platform]$Platform, $Arch) {
10911095
$ArchName = $Arch.ShortName
10921096

10931097
Build-CMakeProject `
@@ -1110,7 +1114,7 @@ function Build-XML2($Arch) {
11101114
}
11111115
}
11121116

1113-
function Build-CURL($Arch) {
1117+
function Build-CURL([Platform]$Platform, $Arch) {
11141118
$ArchName = $Arch.ShortName
11151119

11161120
Build-CMakeProject `
@@ -1203,7 +1207,7 @@ function Build-CURL($Arch) {
12031207
}
12041208
}
12051209

1206-
function Build-ICU($Arch) {
1210+
function Build-ICU([Platform]$Platform, $Arch) {
12071211
$ArchName = $Arch.ShortName
12081212

12091213
if (-not $ToBatch) {
@@ -1236,7 +1240,7 @@ function Build-ICU($Arch) {
12361240
})
12371241
}
12381242

1239-
function Build-Runtime($Arch) {
1243+
function Build-Runtime([Platform]$Platform, $Arch) {
12401244
Isolate-EnvVars {
12411245
$env:Path = "$($HostArch.BinaryCache)\cmark-gfm-0.29.0.gfm.13\src;$(Get-PinnedToolchainRuntime);${env:Path}"
12421246

@@ -1270,7 +1274,7 @@ function Build-Runtime($Arch) {
12701274
-OutFile "$($Arch.SDKInstallRoot)\SDKSettings.plist"
12711275
}
12721276

1273-
function Build-Dispatch($Arch, [switch]$Test = $false) {
1277+
function Build-Dispatch([Platform]$Platform, $Arch, [switch]$Test = $false) {
12741278
$Targets = if ($Test) { @("default", "ExperimentalTest") } else { @("default", "install") }
12751279

12761280
Build-CMakeProject `
@@ -1287,7 +1291,7 @@ function Build-Dispatch($Arch, [switch]$Test = $false) {
12871291
}
12881292
}
12891293

1290-
function Build-Foundation($Arch, [switch]$Test = $false) {
1294+
function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
12911295
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
12921296
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
12931297
$ShortArch = $Arch.ShortName
@@ -1336,7 +1340,7 @@ function Build-Foundation($Arch, [switch]$Test = $false) {
13361340
}
13371341
}
13381342

1339-
function Build-XCTest($Arch, [switch]$Test = $false) {
1343+
function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
13401344
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
13411345
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
13421346
$XCTestBinaryCache = Get-TargetProjectBinaryCache $Arch XCTest
@@ -1890,19 +1894,19 @@ if ($Clean) {
18901894
}
18911895
}
18921896

1893-
foreach ($Arch in $WindowsSDKArchs) {
1894-
if (-not $SkipBuild) {
1895-
Invoke-BuildStep Build-ZLib $Arch
1896-
Invoke-BuildStep Build-XML2 $Arch
1897-
Invoke-BuildStep Build-CURL $Arch
1898-
Invoke-BuildStep Build-ICU $Arch
1899-
Invoke-BuildStep Build-LLVM $Arch
1897+
if (-not $SkipBuild) {
1898+
foreach ($Arch in $WindowsSDKArchs) {
1899+
Invoke-BuildStep Build-ZLib Windows $Arch
1900+
Invoke-BuildStep Build-XML2 Windows $Arch
1901+
Invoke-BuildStep Build-CURL Windows $Arch
1902+
Invoke-BuildStep Build-ICU Windows $Arch
1903+
Invoke-BuildStep Build-LLVM Windows $Arch
19001904

19011905
# Build platform: SDK, Redist and XCTest
1902-
Invoke-BuildStep Build-Runtime $Arch
1903-
Invoke-BuildStep Build-Dispatch $Arch
1904-
Invoke-BuildStep Build-Foundation $Arch
1905-
Invoke-BuildStep Build-XCTest $Arch
1906+
Invoke-BuildStep Build-Runtime Windows $Arch
1907+
Invoke-BuildStep Build-Dispatch Windows $Arch
1908+
Invoke-BuildStep Build-Foundation Windows $Arch
1909+
Invoke-BuildStep Build-XCTest Windows $Arch
19061910
}
19071911
}
19081912

@@ -1963,9 +1967,15 @@ if ($Test -ne $null -and (Compare-Object $Test @("clang", "lld", "lldb", "llvm",
19631967
Build-Compilers $HostArch @Tests
19641968
}
19651969

1966-
if ($Test -contains "dispatch") { Build-Dispatch $HostArch -Test }
1967-
if ($Test -contains "foundation") { Build-Foundation $HostArch -Test }
1968-
if ($Test -contains "xctest") { Build-XCTest $HostArch -Test }
1970+
if ($Test -contains "dispatch") {
1971+
Build-Dispatch Windows $HostArch -Test
1972+
}
1973+
if ($Test -contains "foundation") {
1974+
Build-Foundation Windows $HostArch -Test
1975+
}
1976+
if ($Test -contains "xctest") {
1977+
Build-XCTest Windows $HostArch -Test
1978+
}
19691979
if ($Test -contains "llbuild") { Build-LLBuild $HostArch -Test }
19701980
if ($Test -contains "swiftpm") { Test-PackageManager $HostArch }
19711981

0 commit comments

Comments
 (0)