Skip to content

Commit 60440be

Browse files
committed
build: setup a CMake based build for DocC
In local testing, this helps reduce the overall build times 7-8%. Stage the build conversion to allow us to measure the time savings on CI hosts.
1 parent b5627c9 commit 60440be

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

utils/build.ps1

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3974,13 +3974,38 @@ function Build-Inspect([Hashtable] $Platform) {
39743974
}
39753975
}
39763976

3977-
function Build-DocC() {
3978-
Build-SPMProject `
3979-
-Action Build `
3977+
function Build-SymbolKit([hashtable] $Platform) {
3978+
Build-CMakeProject `
3979+
-Src $SourceCache\swift-docc-symbolkit `
3980+
-Bin $(Get-ProjectBinaryCache $Platform SymbolKit) `
3981+
-BuildTargets default `
3982+
-Platform $Platform `
3983+
-UseBuiltCompilers C,Swift `
3984+
-SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) `
3985+
-Defines @{
3986+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3987+
}
3988+
}
3989+
3990+
function Build-DocC([hashtable] $Platform) {
3991+
Build-CMakeProject `
39803992
-Src $SourceCache\swift-docc `
3981-
-Bin $(Get-ProjectBinaryCache $BuildPlatform DocC) `
3982-
-Platform $BuildPlatform `
3983-
--product docc
3993+
-Bin (Get-ProjectBinaryCache $BuildPlatform DocC) `
3994+
-InstallTo "$($Platform.ToolchainInstallRoot)\usr" `
3995+
-Platform $Platform `
3996+
-UseBuiltCompilers C,Swift `
3997+
-SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) `
3998+
-Defines @{
3999+
BUILD_SHARED_LIBS = "YES";
4000+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
4001+
ArgumentParser_DIR = (Get-ProjectCMakeModules $Platform ArgumentParser);
4002+
SwiftASN1_DIR = (Get-ProjectCMakeModules $Platform ASN1);
4003+
SwiftCrypto_DIR = (Get-ProjectCMakeModules $Platform Crypto);
4004+
SwiftMarkdown_DIR = (Get-ProjectCMakeModules $Platform Markdown);
4005+
LMDB_DIR = (Get-ProjectCMakeModules $Platform LMDB);
4006+
SymbolKit_DIR = (Get-ProjectCMakeModules $Platform SymbolKit);
4007+
"cmark-gfm_DIR" = "$($Platform.ToolchainInstallRoot)\usr\lib\cmake";
4008+
}
39844009
}
39854010

39864011
function Test-PackageManager() {
@@ -4351,7 +4376,8 @@ if (-not $SkipBuild -and $IncludeNoAsserts) {
43514376
Build-NoAssertsToolchain
43524377
}
43534378

4354-
if (-not $SkipBuild -and -not $IsCrossCompiling) {
4379+
if (-not $SkipBuild) {
4380+
Invoke-BuildStep Build-SymbolKit $HostPlatform
43554381
Invoke-BuildStep Build-DocC $HostPlatform
43564382
}
43574383

0 commit comments

Comments
 (0)