Skip to content

Commit de4a52f

Browse files
committed
build: update build.ps1, use update-checkout for more dependencies
Update the build.ps1 to match the current state which introduces `-BuildTo` and updates most of the dependencies. Take the opportunity to migrate to update-checkout for the majority of the dependencies. The SQLite amalgamation and installer image are still fetched later, and ICU is still cloned in the CI wrapper.
1 parent 6589897 commit de4a52f

File tree

3 files changed

+80
-61
lines changed

3 files changed

+80
-61
lines changed

utils/build-windows-toolchain.bat

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,8 @@ setlocal enableextensions enabledelayedexpansion
123123
git config --global core.symlink true
124124

125125
:: FIXME(compnerd) avoid the fresh clone
126-
rd /s /q zlib libxml2 sqlite icu curl
127-
128-
git clone --quiet --no-tags --depth 1 --branch v1.2.11 https://github.com/madler/zlib
129-
git clone --quiet --no-tags --depth 1 --branch v2.9.12 https://github.com/gnome/libxml2
130-
git clone --quiet --no-tags --depth 1 --branch version-3.36.0 https://github.com/sqlite/sqlite
126+
rd /s /q icu
131127
git clone --quiet --no-tags --depth 1 --branch maint/maint-69 https://github.com/unicode-org/icu
132-
git clone --quiet --no-tags --depth 1 --branch curl-8_4_0 https://github.com/curl/curl
133128

134129
goto :eof
135130
endlocal

utils/build.ps1

Lines changed: 65 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ An array of names of projects to run tests for.
6969
.PARAMETER Stage
7070
The path to a directory where built msi's and the installer executable should be staged (for CI).
7171
72+
.PARAMETER BuildTo
73+
The name of a build step after which the script should terminate.
74+
For example: -BuildTo ToolsSupportCore
75+
7276
.PARAMETER ToBatch
7377
When set, runs the script in a special mode which outputs a listing of command invocations
7478
in batch file format instead of executing them.
@@ -98,6 +102,7 @@ param(
98102
[bool] $DefaultsLLD = $true,
99103
[string[]] $Test = @(),
100104
[string] $Stage = "",
105+
[string] $BuildTo = "",
101106
[switch] $ToBatch
102107
)
103108

@@ -234,6 +239,13 @@ $SDKArchs = @($SDKs | ForEach-Object {
234239
})
235240

236241
# Build functions
242+
function Invoke-BuildStep([string]$Name) {
243+
& $Name @Args
244+
if ($Name.Replace("Build-", "") -eq $BuildTo) {
245+
exit 0
246+
}
247+
}
248+
237249
function Get-ProjectBinaryCache($Arch, $ID) {
238250
return "$BinaryCache\" + ($Arch.BuildID + $ID)
239251
}
@@ -878,14 +890,14 @@ function Build-ZLib($Arch) {
878890

879891
Build-CMakeProject `
880892
-Src $SourceCache\zlib `
881-
-Bin "$($Arch.BinaryCache)\zlib-1.2.11" `
882-
-InstallTo $LibraryRoot\zlib-1.2.11\usr `
893+
-Bin "$($Arch.BinaryCache)\zlib-1.3" `
894+
-InstallTo $LibraryRoot\zlib-1.3\usr `
883895
-Arch $Arch `
884896
-BuildTargets default `
885897
-Defines @{
886898
BUILD_SHARED_LIBS = "NO";
887-
INSTALL_BIN_DIR = "$LibraryRoot\zlib-1.2.11\usr\bin\$ArchName";
888-
INSTALL_LIB_DIR = "$LibraryRoot\zlib-1.2.11\usr\lib\$ArchName";
899+
INSTALL_BIN_DIR = "$LibraryRoot\zlib-1.3\usr\bin\$ArchName";
900+
INSTALL_LIB_DIR = "$LibraryRoot\zlib-1.3\usr\lib\$ArchName";
889901
}
890902
}
891903

@@ -894,8 +906,8 @@ function Build-XML2($Arch) {
894906

895907
Build-CMakeProject `
896908
-Src $SourceCache\libxml2 `
897-
-Bin "$($Arch.BinaryCache)\libxml2-2.9.12" `
898-
-InstallTo "$LibraryRoot\libxml2-2.9.12\usr" `
909+
-Bin "$($Arch.BinaryCache)\libxml2-2.11.5" `
910+
-InstallTo "$LibraryRoot\libxml2-2.11.5\usr" `
899911
-Arch $Arch `
900912
-BuildTargets default `
901913
-Defines @{
@@ -946,8 +958,8 @@ function Build-CURL($Arch) {
946958
CURL_ZLIB = "YES";
947959
ENABLE_UNIX_SOCKETS = "NO";
948960
ENABLE_THREADED_RESOLVER = "NO";
949-
ZLIB_ROOT = "$LibraryRoot\zlib-1.2.11\usr";
950-
ZLIB_LIBRARY = "$LibraryRoot\zlib-1.2.11\usr\lib\$ArchName\zlibstatic.lib";
961+
ZLIB_ROOT = "$LibraryRoot\zlib-1.3\usr";
962+
ZLIB_LIBRARY = "$LibraryRoot\zlib-1.3\usr\lib\$ArchName\zlibstatic.lib";
951963
}
952964
}
953965

@@ -1076,11 +1088,11 @@ function Build-Foundation($Arch, [switch]$Test = $false) {
10761088
ICU_I18N_LIBRARY_RELEASE = "$LibraryRoot\icu-69.1\usr\lib\$ShortArch\sicuin69.lib";
10771089
ICU_ROOT = "$LibraryRoot\icu-69.1\usr";
10781090
ICU_UC_LIBRARY_RELEASE = "$LibraryRoot\icu-69.1\usr\lib\$ShortArch\sicuuc69.lib";
1079-
LIBXML2_LIBRARY = "$LibraryRoot\libxml2-2.9.12\usr\lib\$ShortArch\libxml2s.lib";
1080-
LIBXML2_INCLUDE_DIR = "$LibraryRoot\libxml2-2.9.12\usr\include\libxml2";
1091+
LIBXML2_LIBRARY = "$LibraryRoot\libxml2-2.11.5\usr\lib\$ShortArch\libxml2s.lib";
1092+
LIBXML2_INCLUDE_DIR = "$LibraryRoot\libxml2-2.11.5\usr\include\libxml2";
10811093
LIBXML2_DEFINITIONS = "/DLIBXML_STATIC";
1082-
ZLIB_LIBRARY = "$LibraryRoot\zlib-1.2.11\usr\lib\$ShortArch\zlibstatic.lib";
1083-
ZLIB_INCLUDE_DIR = "$LibraryRoot\zlib-1.2.11\usr\include";
1094+
ZLIB_LIBRARY = "$LibraryRoot\zlib-1.3\usr\lib\$ShortArch\zlibstatic.lib";
1095+
ZLIB_INCLUDE_DIR = "$LibraryRoot\zlib-1.3\usr\include";
10841096
dispatch_DIR = "$DispatchBinaryCache\cmake\modules";
10851097
} + $TestingDefines)
10861098
}
@@ -1189,13 +1201,13 @@ function Install-Platform($Arch) {
11891201
}
11901202

11911203
function Build-SQLite($Arch) {
1192-
$SrcPath = "$SourceCache\sqlite-3.36.0"
1204+
$SrcPath = "$SourceCache\sqlite-3.43.2"
11931205

11941206
# Download the sources
11951207
if (-not (Test-Path $SrcPath)) {
1196-
$ZipPath = "$env:TEMP\sqlite-amalgamation-3360000.zip"
1208+
$ZipPath = "$env:TEMP\sqlite-amalgamation-3430200.zip"
11971209
if (-not $ToBatch) { Remove-item $ZipPath -ErrorAction Ignore | Out-Null }
1198-
Invoke-Program curl.exe -- -sL https://sqlite.org/2021/sqlite-amalgamation-3360000.zip -o $ZipPath
1210+
Invoke-Program curl.exe -- -sL https://sqlite.org/2023/sqlite-amalgamation-3430200.zip -o $ZipPath
11991211

12001212
if (-not $ToBatch) { New-Item -Type Directory -Path $SrcPath -ErrorAction Ignore | Out-Null }
12011213
Invoke-Program "$UnixToolsBinDir\unzip.exe" -- -j -o $ZipPath -d $SrcPath
@@ -1225,8 +1237,8 @@ install(FILES sqlite3.h sqlite3ext.h DESTINATION include)
12251237

12261238
Build-CMakeProject `
12271239
-Src $SrcPath `
1228-
-Bin "$($Arch.BinaryCache)\sqlite-3.36.0" `
1229-
-InstallTo $LibraryRoot\sqlite-3.36.0\usr `
1240+
-Bin "$($Arch.BinaryCache)\sqlite-3.43.2" `
1241+
-InstallTo $LibraryRoot\sqlite-3.43.2\usr `
12301242
-Arch $Arch `
12311243
-BuildTargets default `
12321244
-Defines @{
@@ -1297,8 +1309,8 @@ function Build-LLBuild($Arch, [switch]$Test = $false) {
12971309
CMAKE_INSTALL_PREFIX = "$($Arch.ToolchainInstallRoot)\usr";
12981310
BUILD_SHARED_LIBS = "YES";
12991311
LLBUILD_SUPPORT_BINDINGS = "Swift";
1300-
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.36.0\usr\include";
1301-
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.36.0\usr\lib\SQLite3.lib";
1312+
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.43.2\usr\include";
1313+
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.43.2\usr\lib\SQLite3.lib";
13021314
})
13031315
}
13041316
}
@@ -1348,8 +1360,8 @@ function Build-Driver($Arch) {
13481360
LLBuild_DIR = "$BinaryCache\4\cmake\modules";
13491361
Yams_DIR = "$BinaryCache\5\cmake\modules";
13501362
ArgumentParser_DIR = "$BinaryCache\6\cmake\modules";
1351-
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.36.0\usr\include";
1352-
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.36.0\usr\lib\SQLite3.lib";
1363+
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.43.2\usr\include";
1364+
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.43.2\usr\lib\SQLite3.lib";
13531365
}
13541366
}
13551367

@@ -1435,8 +1447,8 @@ function Build-PackageManager($Arch) {
14351447
SwiftCollections_DIR = "$BinaryCache\9\cmake\modules";
14361448
SwiftASN1_DIR = "$BinaryCache\10\cmake\modules";
14371449
SwiftCertificates_DIR = "$BinaryCache\11\cmake\modules";
1438-
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.36.0\usr\include";
1439-
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.36.0\usr\lib\SQLite3.lib";
1450+
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.43.2\usr\include";
1451+
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.43.2\usr\lib\SQLite3.lib";
14401452
}
14411453
}
14421454

@@ -1596,23 +1608,23 @@ if (-not $SkipBuild) {
15961608

15971609
if (-not $SkipBuild) {
15981610
Ensure-SwiftToolchain $HostArch
1599-
Build-BuildTools $HostArch
1600-
Build-Compilers $HostArch
1611+
Invoke-BuildStep Build-BuildTools $HostArch
1612+
Invoke-BuildStep Build-Compilers $HostArch
16011613
}
16021614

16031615
foreach ($Arch in $SDKArchs) {
16041616
if (-not $SkipBuild) {
1605-
Build-ZLib $Arch
1606-
Build-XML2 $Arch
1607-
Build-CURL $Arch
1608-
Build-ICU $Arch
1609-
Build-LLVM $Arch
1617+
Invoke-BuildStep Build-ZLib $Arch
1618+
Invoke-BuildStep Build-XML2 $Arch
1619+
Invoke-BuildStep Build-CURL $Arch
1620+
Invoke-BuildStep Build-ICU $Arch
1621+
Invoke-BuildStep Build-LLVM $Arch
16101622

16111623
# Build platform: SDK, Redist and XCTest
1612-
Build-Runtime $Arch
1613-
Build-Dispatch $Arch
1614-
Build-Foundation $Arch
1615-
Build-XCTest $Arch
1624+
Invoke-BuildStep Build-Runtime $Arch
1625+
Invoke-BuildStep Build-Dispatch $Arch
1626+
Invoke-BuildStep Build-Foundation $Arch
1627+
Invoke-BuildStep Build-XCTest $Arch
16161628
}
16171629
}
16181630

@@ -1629,33 +1641,33 @@ if (-not $ToBatch) {
16291641
}
16301642

16311643
if (-not $SkipBuild) {
1632-
Build-SQLite $HostArch
1633-
Build-System $HostArch
1634-
Build-ToolsSupportCore $HostArch
1635-
Build-LLBuild $HostArch
1636-
Build-Yams $HostArch
1637-
Build-ArgumentParser $HostArch
1638-
Build-Driver $HostArch
1639-
Build-Crypto $HostArch
1640-
Build-Collections $HostArch
1641-
Build-ASN1 $HostArch
1642-
Build-Certificates $HostArch
1643-
Build-PackageManager $HostArch
1644-
Build-IndexStoreDB $HostArch
1645-
Build-Syntax $HostArch
1646-
Build-SourceKitLSP $HostArch
1644+
Invoke-BuildStep Build-SQLite $HostArch
1645+
Invoke-BuildStep Build-System $HostArch
1646+
Invoke-BuildStep Build-ToolsSupportCore $HostArch
1647+
Invoke-BuildStep Build-LLBuild $HostArch
1648+
Invoke-BuildStep Build-Yams $HostArch
1649+
Invoke-BuildStep Build-ArgumentParser $HostArch
1650+
Invoke-BuildStep Build-Driver $HostArch
1651+
Invoke-BuildStep Build-Crypto $HostArch
1652+
Invoke-BuildStep Build-Collections $HostArch
1653+
Invoke-BuildStep Build-ASN1 $HostArch
1654+
Invoke-BuildStep Build-Certificates $HostArch
1655+
Invoke-BuildStep Build-PackageManager $HostArch
1656+
Invoke-BuildStep Build-IndexStoreDB $HostArch
1657+
Invoke-BuildStep Build-Syntax $HostArch
1658+
Invoke-BuildStep Build-SourceKitLSP $HostArch
16471659
}
16481660

16491661
Install-HostToolchain
16501662

16511663
if (-not $SkipBuild) {
1652-
Build-Inspect $HostArch
1653-
Build-Format $HostArch
1654-
Build-DocC $HostArch
1664+
Invoke-BuildStep Build-Inspect $HostArch
1665+
Invoke-BuildStep Build-Format $HostArch
1666+
Invoke-BuildStep Build-DocC $HostArch
16551667
}
16561668

16571669
if (-not $SkipPackaging) {
1658-
Build-Installer
1670+
Invoke-BuildStep Build-Installer
16591671
}
16601672

16611673
if ($Test -contains "swift") { Build-Compilers $HostArch -Test }

utils/update_checkout/update-checkout-config.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,16 @@
8888
"llvm-project": {
8989
"remote": { "id": "apple/llvm-project" } },
9090
"wasi-libc": {
91-
"remote": { "id": "WebAssembly/wasi-libc" } }
91+
"remote": { "id": "WebAssembly/wasi-libc" } },
92+
"curl": {
93+
"remote": { "id": "curl/curl" }
94+
},
95+
"libxml2": {
96+
"remote": { "id": "gnome/libxml2" }
97+
},
98+
"zlib": {
99+
"remote": { "id": "madler/zlib" }
100+
}
92101
},
93102
"default-branch-scheme": "main",
94103
"branch-schemes": {
@@ -134,7 +143,10 @@
134143
"swift-nio": "2.31.2",
135144
"swift-nio-ssl": "2.15.0",
136145
"swift-experimental-string-processing": "swift/main",
137-
"wasi-libc": "wasi-sdk-20"
146+
"wasi-libc": "wasi-sdk-20",
147+
"curl": "curl-8_4_0",
148+
"libxml2": "v2.11.5",
149+
"zlib": "v1.3"
138150
}
139151
},
140152
"release/5.10": {

0 commit comments

Comments
 (0)