diff --git a/cmake/caches/Runtime-Android-aarch64.cmake b/cmake/caches/Runtime-Android-aarch64.cmake deleted file mode 100644 index f622e900c9350..0000000000000 --- a/cmake/caches/Runtime-Android-aarch64.cmake +++ /dev/null @@ -1,24 +0,0 @@ - -set(SWIFT_HOST_VARIANT_SDK ANDROID CACHE STRING "") -set(SWIFT_HOST_VARIANT_ARCH aarch64 CACHE STRING "") - -# NOTE(compnerd) disable the tools, we are trying to build just the standard -# library. -set(SWIFT_INCLUDE_TOOLS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build tests since the tests require the toolchain -set(SWIFT_INCLUDE_TESTS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build docs since that requires perl -set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "") - -# NOTE(compnerd) these are part of the toolchain, not the runtime. -set(SWIFT_BUILD_SOURCEKIT NO CACHE BOOL "") - -# NOTE(compnerd) build with the compiler specified, not a just built compiler. -set(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER YES CACHE BOOL "") - -set(SWIFT_SDK_ANDROID_ARCHITECTURES aarch64 CACHE STRING "") - -# NOTE(compnerd) this is lollipop, which seems to still have decent usage. -set(SWIFT_ANDROID_API_LEVEL 21 CACHE STRING "") diff --git a/cmake/caches/Runtime-Android-armv7.cmake b/cmake/caches/Runtime-Android-armv7.cmake deleted file mode 100644 index a9c3b23e75198..0000000000000 --- a/cmake/caches/Runtime-Android-armv7.cmake +++ /dev/null @@ -1,24 +0,0 @@ - -set(SWIFT_HOST_VARIANT_SDK ANDROID CACHE STRING "") -set(SWIFT_HOST_VARIANT_ARCH armv7 CACHE STRING "") - -# NOTE(compnerd) disable the tools, we are trying to build just the standard -# library. -set(SWIFT_INCLUDE_TOOLS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build tests since the tests require the toolchain -set(SWIFT_INCLUDE_TESTS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build docs since that requires perl -set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "") - -# NOTE(compnerd) these are part of the toolchain, not the runtime. -set(SWIFT_BUILD_SOURCEKIT NO CACHE BOOL "") - -# NOTE(compnerd) build with the compiler specified, not a just built compiler. -set(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER YES CACHE BOOL "") - -set(SWIFT_SDK_ANDROID_ARCHITECTURES armv7 CACHE STRING "") - -# NOTE(compnerd) this is lollipop, which seems to still have decent usage. -set(SWIFT_ANDROID_API_LEVEL 21 CACHE STRING "") diff --git a/cmake/caches/Runtime-Android-i686.cmake b/cmake/caches/Runtime-Android-i686.cmake deleted file mode 100644 index 66d3063709924..0000000000000 --- a/cmake/caches/Runtime-Android-i686.cmake +++ /dev/null @@ -1,24 +0,0 @@ - -set(SWIFT_HOST_VARIANT_SDK ANDROID CACHE STRING "") -set(SWIFT_HOST_VARIANT_ARCH i686 CACHE STRING "") - -# NOTE(compnerd) disable the tools, we are trying to build just the standard -# library. -set(SWIFT_INCLUDE_TOOLS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build tests since the tests require the toolchain -set(SWIFT_INCLUDE_TESTS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build docs since that requires perl -set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "") - -# NOTE(compnerd) these are part of the toolchain, not the runtime. -set(SWIFT_BUILD_SOURCEKIT NO CACHE BOOL "") - -# NOTE(compnerd) build with the compiler specified, not a just built compiler. -set(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER YES CACHE BOOL "") - -set(SWIFT_SDK_ANDROID_ARCHITECTURES i686 CACHE STRING "") - -# NOTE(compnerd) this is lollipop, which seems to still have decent usage. -set(SWIFT_ANDROID_API_LEVEL 21 CACHE STRING "") diff --git a/cmake/caches/Runtime-Android-x86_64.cmake b/cmake/caches/Runtime-Android-x86_64.cmake deleted file mode 100644 index 8780313aaa3ca..0000000000000 --- a/cmake/caches/Runtime-Android-x86_64.cmake +++ /dev/null @@ -1,24 +0,0 @@ - -set(SWIFT_HOST_VARIANT_SDK ANDROID CACHE STRING "") -set(SWIFT_HOST_VARIANT_ARCH x86_64 CACHE STRING "") - -# NOTE(compnerd) disable the tools, we are trying to build just the standard -# library. -set(SWIFT_INCLUDE_TOOLS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build tests since the tests require the toolchain -set(SWIFT_INCLUDE_TESTS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build docs since that requires perl -set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "") - -# NOTE(compnerd) these are part of the toolchain, not the runtime. -set(SWIFT_BUILD_SOURCEKIT NO CACHE BOOL "") - -# NOTE(compnerd) build with the compiler specified, not a just built compiler. -set(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER YES CACHE BOOL "") - -set(SWIFT_SDK_ANDROID_ARCHITECTURES x86_64 CACHE STRING "") - -# NOTE(compnerd) this is lollipop, which seems to still have decent usage. -set(SWIFT_ANDROID_API_LEVEL 21 CACHE STRING "") diff --git a/cmake/caches/Runtime-Windows-aarch64.cmake b/cmake/caches/Runtime-Windows-aarch64.cmake deleted file mode 100644 index 4be155854c868..0000000000000 --- a/cmake/caches/Runtime-Windows-aarch64.cmake +++ /dev/null @@ -1,20 +0,0 @@ - -set(SWIFT_HOST_VARIANT_SDK WINDOWS CACHE STRING "") -set(SWIFT_HOST_VARIANT_ARCH aarch64 CACHE STRING "") - -# NOTE(compnerd) disable the tools, we are trying to build just the standard -# library. -set(SWIFT_INCLUDE_TOOLS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build tests since the tests require the toolchain -set(SWIFT_INCLUDE_TESTS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build docs since that requires perl -set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "") - -# NOTE(compnerd) these are part of the toolchain, not the runtime. -set(SWIFT_BUILD_SOURCEKIT NO CACHE BOOL "") - -# NOTE(compnerd) build with the compiler specified, not a just built compiler. -set(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER YES CACHE BOOL "") - diff --git a/cmake/caches/Runtime-Windows-i686.cmake b/cmake/caches/Runtime-Windows-i686.cmake deleted file mode 100644 index f78742e603a8a..0000000000000 --- a/cmake/caches/Runtime-Windows-i686.cmake +++ /dev/null @@ -1,20 +0,0 @@ - -set(SWIFT_HOST_VARIANT_SDK WINDOWS CACHE STRING "") -set(SWIFT_HOST_VARIANT_ARCH i686 CACHE STRING "") - -# NOTE(compnerd) disable the tools, we are trying to build just the standard -# library. -set(SWIFT_INCLUDE_TOOLS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build tests since the tests require the toolchain -set(SWIFT_INCLUDE_TESTS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build docs since that requires perl -set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "") - -# NOTE(compnerd) these are part of the toolchain, not the runtime. -set(SWIFT_BUILD_SOURCEKIT NO CACHE BOOL "") - -# NOTE(compnerd) build with the compiler specified, not a just built compiler. -set(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER YES CACHE BOOL "") - diff --git a/cmake/caches/Runtime-Windows-x86_64.cmake b/cmake/caches/Runtime-Windows-x86_64.cmake deleted file mode 100644 index 687c62a2b643a..0000000000000 --- a/cmake/caches/Runtime-Windows-x86_64.cmake +++ /dev/null @@ -1,19 +0,0 @@ - -set(SWIFT_HOST_VARIANT_SDK WINDOWS CACHE STRING "") -set(SWIFT_HOST_VARIANT_ARCH x86_64 CACHE STRING "") - -# NOTE(compnerd) disable the tools, we are trying to build just the standard -# library. -set(SWIFT_INCLUDE_TOOLS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build tests since the tests require the toolchain -set(SWIFT_INCLUDE_TESTS NO CACHE BOOL "") - -# NOTE(compnerd) cannot build docs since that requires perl -set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "") - -# NOTE(compnerd) these are part of the toolchain, not the runtime. -set(SWIFT_BUILD_SOURCEKIT NO CACHE BOOL "") - -# NOTE(compnerd) build with the compiler specified, not a just built compiler. -set(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER YES CACHE BOOL "") diff --git a/utils/build.ps1 b/utils/build.ps1 index 74e9c465903ff..9f4ab9c932439 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -85,7 +85,7 @@ Default: 28 .PARAMETER AndroidSDKVersions An array of SDKs to build for the Android OS. -Default: @("Android", "AndroidExperimental") +Default: @("Android") .PARAMETER AndroidSDKArchitectures An array of architectures for which the Android Swift SDK should be built. @@ -101,7 +101,7 @@ If no such Windows SDK is installed, it will be downloaded from nuget. .PARAMETER WindowsSDKVersions An array of SDKs to build for the Windows OS. -Default: @("Windows", "WindowsExperimental") +Default: @("Windows") .PARAMETER WindowsSDKArchitectures An array of architectures for which the Windows Swift SDK should be built. @@ -191,7 +191,8 @@ param [string[]] $AndroidSDKArchitectures = @("aarch64", "armv7", "i686", "x86_64"), [ValidateSet("dynamic", "static")] [string[]] $AndroidSDKLinkModes = @("dynamic", "static"), - [string[]] $AndroidSDKVersions = @("Android", "AndroidExperimental"), + [string[]] $AndroidSDKVersions = @("Android"), + [ValidateSet("Android")] [string] $AndroidSDKVersionDefault = "Android", # Windows SDK Options @@ -201,7 +202,8 @@ param [string[]] $WindowsSDKArchitectures = @("X64","X86","Arm64"), [ValidateSet("dynamic", "static")] [string[]] $WindowsSDKLinkModes = @("dynamic", "static"), - [string[]] $WindowsSDKVersions = @("Windows", "WindowsExperimental"), + [string[]] $WindowsSDKVersions = @("Windows"), + [ValidateSet("Windows")] [string] $WindowsSDKVersionDefault = "Windows", # Incremental Build Support @@ -269,14 +271,14 @@ if ($UseHostToolchain -is [string]) { $DefaultPinned = @{ AMD64 = @{ - PinnedBuild = "https://download.swift.org/swift-6.1.2-release/windows10/swift-6.1.2-RELEASE/swift-6.1.2-RELEASE-windows10.exe"; - PinnedSHA256 = "92A0323ED7DD333C3B05E6E0E428F3A91C77D159F6CCFC8626A996F2ACE09A0B"; - PinnedVersion = "6.1.2"; + PinnedBuild = "https://ci-external.swift.org/job/swift-main-windows-toolchain/1656/artifact/build/artifacts/installer.exe"; + PinnedSHA256 = "13841E44438D4EF1C40544B5AD97B8D549C0B2DA0E66BAEC5039EE48404D0D9A"; + PinnedVersion = "0.0.0"; }; ARM64 = @{ - PinnedBuild = "https://download.swift.org/swift-6.1.2-release/windows10-arm64/swift-6.1.2-RELEASE/swift-6.1.2-RELEASE-windows10-arm64.exe"; - PinnedSHA256 = "121FB407E578178F82DCCF39A4D03527873D8F7611A801A8FC26DA52503A0C5C"; - PinnedVersion = "6.1.2"; + PinnedBuild = "https://download.swift.org/development/windows10-arm64/swift-DEVELOPMENT-SNAPSHOT-2025-09-21-a/swift-DEVELOPMENT-SNAPSHOT-2025-09-21-a-windows10-arm64.exe" + PinnedSHA256 = ""; + PinnedVersion = "0.0.0"; }; } @@ -835,6 +837,7 @@ enum Project { RegsGen2 BootstrapFoundationMacros BootstrapTestingMacros + EarlySwiftDriver CDispatch Compilers @@ -863,35 +866,31 @@ enum Project { DocC brotli - LLVM - Runtime - Dispatch - DynamicFoundation XCTest Testing ClangBuiltins ClangRuntime SwiftInspect - ExperimentalDynamicRuntime - ExperimentalDynamicOverlay - ExperimentalDynamicStringProcessing - ExperimentalDynamicSynchronization - ExperimentalDynamicDistributed - ExperimentalDynamicObservation - ExperimentalDynamicDispatch - ExperimentalDynamicDifferentiation - ExperimentalDynamicVolatile - ExperimentalDynamicFoundation - ExperimentalStaticRuntime - ExperimentalStaticOverlay - ExperimentalStaticStringProcessing - ExperimentalStaticSynchronization - ExperimentalStaticDistributed - ExperimentalStaticObservation - ExperimentalStaticDifferentiation - ExperimentalStaticVolatile - ExperimentalStaticDispatch - ExperimentalStaticFoundation + DynamicRuntime + DynamicOverlay + DynamicStringProcessing + DynamicSynchronization + DynamicDistributed + DynamicObservation + DynamicDispatch + DynamicDifferentiation + DynamicVolatile + DynamicFoundation + StaticRuntime + StaticOverlay + StaticStringProcessing + StaticSynchronization + StaticDistributed + StaticObservation + StaticDifferentiation + StaticVolatile + StaticDispatch + StaticFoundation } function Get-ProjectBinaryCache([Hashtable] $Platform, [Project] $Project) { @@ -1435,7 +1434,7 @@ function Get-PinnedToolchainToolsDir() { "unknown-Asserts-development.xctoolchain", "usr", "bin") } -function Get-PinnedToolchainSDK([OS] $OS = $BuildPlatform.OS, [string] $Identifier = $OS.ToString()) { +function Get-PinnedToolchainSDK([OS] $OS = $BuildPlatform.OS, [string] $Identifier = "$($OS.ToString())Experimental") { $ToolchainName = $PinnedToolchain.TrimStart("swift-").TrimEnd("-a-windows10") return [IO.Path]::Combine("$BinaryCache\", "toolchains", $ToolchainName, @@ -1451,6 +1450,14 @@ function Get-PinnedToolchainRuntime() { "usr", "bin") } +function Get-PinnedToolchainRedistributables() { + $ToolchainName = $PinnedToolchain.TrimStart("swift-").TrimEnd("-a-windows10") + + return [IO.Path]::Combine("$BinaryCache\", "toolchains", $ToolchainName, + "LocalApp", "Programs", "Swift", "Redistributables", (Get-PinnedToolchainVersion) + ) +} + function Get-PinnedToolchainVersion() { if (Test-Path variable:PinnedVersion) { return $PinnedVersion @@ -1676,7 +1683,7 @@ function Build-CMakeProject { } $SWIFTC = if ($UseBuiltCompilers.Contains("Swift")) { - [IO.Path]::Combine((Get-ProjectBinaryCache $BuildPlatform Compilers), "bin", "swiftc.exe") + [IO.Path]::Combine($BuildPlatform.ToolchainInstallRoot, "usr", "bin", "swiftc.exe") } elseif ($UsePinnedCompilers.Contains("Swift")) { Join-Path -Path (Get-PinnedToolchainToolsDir) -ChildPath "swiftc.exe" } @@ -1684,9 +1691,6 @@ function Build-CMakeProject { Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER $SWIFTC Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_TARGET $Platform.Triple - # TODO(compnerd): remove this once we have the early swift-driver - Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_USE_OLD_DRIVER "YES" - [string[]] $SwiftFlags = @(); $SwiftFlags += if ($SwiftSDK) { @@ -1796,16 +1800,13 @@ function Build-CMakeProject { Add-KeyValueIfNew $Defines SWIFT_ANDROID_NDK_PATH "$AndroidNDKPath" $SWIFTC = if ($UseBuiltCompilers.Contains("Swift")) { - [IO.Path]::Combine((Get-ProjectBinaryCache $BuildPlatform Compilers), "bin", "swiftc.exe") + [IO.Path]::Combine($BuildPlatform.ToolchainInstallRoot, "usr", "bin", "swiftc.exe") } else { Join-Path -Path (Get-PinnedToolchainToolsDir) -ChildPath "swiftc.exe" } Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER $SWIFTC Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_TARGET $Platform.Triple - # TODO(compnerd) remove this once we have the early swift-driver - Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_USE_OLD_DRIVER "YES" - [string[]] $SwiftFlags = @() $SwiftFlags += if ($SwiftSDK) { @@ -1907,9 +1908,9 @@ function Build-CMakeProject { } if ($UseBuiltCompilers.Contains("Swift")) { - $env:Path = "$([IO.Path]::Combine((Get-InstallDir $BuildPlatform), "Runtimes", $ProductVersion, "usr", "bin"));$(Get-CMarkBinaryCache $BuildPlatform)\src;$($BuildPlatform.ToolchainInstallRoot)\usr\bin;$(Get-PinnedToolchainRuntime);${env:Path}" + $env:Path = "$($BuildPlatform.ToolchainInstallRoot)\usr\bin;$(Get-PinnedToolchainRuntime);${env:Path}" } elseif ($UsePinnedCompilers.Contains("Swift")) { - $env:Path = "$(Get-PinnedToolchainRuntime);${env:Path}" + $env:Path = "$(Get-PinnedToolchainToolsDir);$(Get-PinnedToolchainRuntime);${env:Path}" } if ($ToBatch) { Write-Output "" @@ -1979,8 +1980,8 @@ function Build-SPMProject { Invoke-IsolatingEnvVars { $RuntimeInstallRoot = [IO.Path]::Combine((Get-InstallDir $BuildPlatform), "Runtimes", $ProductVersion) - $env:Path = "$RuntimeInstallRoot\usr\bin;$($BuildPlatform.ToolchainInstallRoot)\usr\bin;${env:Path}" - $env:SDKROOT = (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) + $env:Path = "$(Get-PinnedToolchainRuntime);$(Get-PinnedToolchainToolsDir);${env:Path}" + $env:SDKROOT = (Get-PinnedToolchainSDK -OS $Platform.OS) $env:SWIFTCI_USE_LOCAL_DEPS = "1" $Arguments = @( @@ -1988,6 +1989,7 @@ function Build-SPMProject { "--package-path", $Src, "-c", $Configuration ) + if ($DebugInfo) { if ($Platform.OS -eq [OS]::Windows -and $SwiftDebugFormat -eq "codeview") { $Arguments += @("-debug-info-format", "codeview") @@ -2119,6 +2121,26 @@ function Build-BuildTools([Hashtable] $Platform) { } } +function Build-EarlySwiftDriver { + Build-CMakeProject ` + -Src $SourceCache\swift-driver ` + -Bin (Get-ProjectBinaryCache $Platform EarlySwiftDriver) ` + -Platform $BuildPlatform ` + -UsePinnedCompilers C,CXX,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS -Identifier "$($BuildPlatform.OS)Experimental") ` + -BuildTargets default ` + -Defines @{ + BUILD_SHARED_LIBS = "NO"; + BUILD_TESTING = "NO"; + CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; + # TODO(compnerd) - remove `-Xfrontend -use-static-resource-dir` - this is inferred by the `-static-stdlib`. + CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir"); + SWIFT_DRIVER_BUILD_TOOLS = "NO"; + SQLite3_INCLUDE_DIR = "$SourceCache\swift-toolchain-sqlite\Sources\CSQLite\include"; + SQLite3_LIBRARY = "$(Get-ProjectBinaryCache $Platform SQLite)\SQLite3.lib"; + } +} + function Write-PList { [CmdletBinding(PositionalBinding = $false)] param @@ -2205,6 +2227,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch] return $TestDefines + $DebugDefines + @{ CLANG_TABLEGEN = (Join-Path -Path $BuildTools -ChildPath "clang-tblgen.exe"); CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path -Path $BuildTools -ChildPath "clang-tidy-confusable-chars-gen.exe"); + CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; CMAKE_Swift_FLAGS = $SwiftFlags; LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5"; LLDB_LIBXML2_VERSION = "2.11.5"; @@ -2238,6 +2261,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch] SWIFT_TOOLCHAIN_VERSION = "${ToolchainIdentifier}"; SWIFT_BUILD_SWIFT_SYNTAX = "YES"; SWIFT_CLANG_LOCATION = (Get-PinnedToolchainToolsDir); + SWIFT_EARLY_SWIFT_DRIVER_BUILD = "$(Get-ProjectBinaryCache $BuildPlatform EarlySwiftDriver)\bin"; SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY = "YES"; SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP = "YES"; SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING = "YES"; @@ -2293,21 +2317,20 @@ function Test-Compilers([Hashtable] $Platform, [string] $Variant, [switch] $Test Load-LitTestOverrides ([IO.Path]::GetFullPath([IO.Path]::Combine($PSScriptRoot, "..", "..", "llvm-project", "lldb", "test", "windows-swift-llvm-lit-test-overrides.txt"))) # Transitive dependency of _lldb.pyd - $RuntimeBinaryCache = Get-ProjectBinaryCache $BuildPlatform Runtime Copy-Item ` - -Path $RuntimeBinaryCache\bin\swiftCore.dll ` - -Destination "$(Get-ProjectBinaryCache $BuildPlatform Compilers)\lib\site-packages\lldb" + -Path "$(Get-ProjectBinaryCache $BuildPlatform DynamicRuntime)\core\swiftCore.dll" ` + -Destination "$(Get-ProjectBinaryCache $BuildPlatform Compilers)\lib\site-packages\lldb" # Runtime dependencies of repl_swift.exe - $SwiftRTSubdir = "lib\swift\windows" - Write-Host "Copying '$RuntimeBinaryCache\$SwiftRTSubdir\$($Platform.Architecture.LLVMName)\swiftrt.obj' to '$(Get-ProjectBinaryCache $BuildPlatform Compilers)\$SwiftRTSubdir'" + Write-Host "Copying '$(Get-ProjectBinaryCache $BuildPlatform DynamicRuntime)\runtime\CMakeFiles\swiftrt.dir\SwiftRT-COFF.cpp.obj' to '$(Get-ProjectBinaryCache $BuildPlatform Compilers)\lib\swift\windows\swiftrt.obj'" Copy-Item ` - -Path "$RuntimeBinaryCache\$SwiftRTSubdir\$($Platform.Architecture.LLVMName)\swiftrt.obj" ` - -Destination "$(Get-ProjectBinaryCache $BuildPlatform Compilers)\$SwiftRTSubdir" - Write-Host "Copying '$RuntimeBinaryCache\bin\swiftCore.dll' to '$(Get-ProjectBinaryCache $BuildPlatform Compilers)\bin'" + -Path "$(Get-ProjectBinaryCache $BuildPlatform DynamicRuntime)\runtime\CMakeFiles\swiftrt.dir\SwiftRT-COFF.cpp.obj" ` + -Destination "$(Get-ProjectBinaryCache $BuildPlatform Compilers)\lib\swift\windows\swiftrt.obj" + + Write-Host "Copying '$(Get-ProjectBinaryCache $BuildPlatform DynamicRuntime)\core\swiftCore.dll' to '$(Get-ProjectBinaryCache $BuildPlatform Compilers)\bin'" Copy-Item ` - -Path "$RuntimeBinaryCache\bin\swiftCore.dll" ` - -Destination "$(Get-ProjectBinaryCache $BuildPlatform Compilers)\bin" + -Path "$(Get-ProjectBinaryCache $BuildPlatform DynamicRuntime)\core\swiftCore.dll" ` + -Destination "$(Get-ProjectBinaryCache $BuildPlatform Compilers)\bin\" $TestingDefines += @{ LLDB_INCLUDE_TESTS = "YES"; @@ -2318,7 +2341,7 @@ function Test-Compilers([Hashtable] $Platform, [string] $Variant, [switch] $Test # gtest sharding breaks llvm-lit's --xfail and LIT_XFAIL inputs: https://github.com/llvm/llvm-project/issues/102264 LLVM_LIT_ARGS = "-v --no-gtest-sharding --time-tests"; # LLDB Unit tests link against this library - LLVM_UNITTEST_LINK_FLAGS = "$(Get-SwiftSDK -OS Windows -Identifier Windows)\usr\lib\swift\windows\$($Platform.Architecture.LLVMName)\swiftCore.lib"; + LLVM_UNITTEST_LINK_FLAGS = "$(Get-ProjectBinaryCache $BuildPlatform DynamicRuntime)\core\swiftCore.lib"; } } @@ -2433,17 +2456,6 @@ function Patch-mimalloc() { } } -function Build-LLVM([Hashtable] $Platform) { - Build-CMakeProject ` - -Src $SourceCache\llvm-project\llvm ` - -Bin (Get-ProjectBinaryCache $Platform LLVM) ` - -Platform $Platform ` - -UseBuiltCompilers C,CXX ` - -Defines @{ - LLVM_HOST_TRIPLE = $Platform.Triple; - } -} - function Build-CompilerRuntime([Hashtable] $Platform) { $LLVMBinaryCache = $(Get-ProjectBinaryCache $HostPlatform Compilers) @@ -2494,7 +2506,8 @@ function Build-Brotli([Hashtable] $Platform) { -Src $SourceCache\brotli ` -Bin "$(Get-ProjectBinaryCache $Platform brotli)" ` -Platform $Platform ` - -UseMSVCCompilers C ` + -UseMSVCCompilers $(if ($UseHostToolchain) { @("C") } else { @("") }) ` + -UsePinnedCompilers $(if ($UseHostToolchain) { @("") } else { @("C") }) ` -BuildTargets default ` -Defines @{ BUILD_SHARED_LIBS = "NO"; @@ -2684,50 +2697,11 @@ function Build-CURL([Hashtable] $Platform) { }) } -function Build-Runtime([Hashtable] $Platform) { - $PlatformDefines = @{} - if ($Platform.OS -eq [OS]::Android) { - $PlatformDefines += @{ - LLVM_ENABLE_LIBCXX = "YES"; - SWIFT_USE_LINKER = "lld"; - } - - if ((Get-AndroidNDK).ClangVersion -lt 18) { - $PlatformDefines += @{ - SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT = "YES"; - } - } - } - - Build-CMakeProject ` - -Src $SourceCache\swift ` - -Bin (Get-ProjectBinaryCache $Platform Runtime) ` - -InstallTo "$(Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK)\usr" ` - -Platform $Platform ` - -UseBuiltCompilers C,CXX,Swift ` - -SwiftSDK $null ` - -CacheScript $SourceCache\swift\cmake\caches\Runtime-$($Platform.OS.ToString())-$($Platform.Architecture.LLVMName).cmake ` - -Defines ($PlatformDefines + @{ - LLVM_DIR = "$(Get-ProjectBinaryCache $Platform LLVM)\lib\cmake\llvm"; - SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY = "YES"; - SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP = "YES"; - SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING = "YES"; - SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED = "YES"; - SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION = "YES"; - SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING = "YES"; - SWIFT_ENABLE_SYNCHRONIZATION = "YES"; - SWIFT_ENABLE_VOLATILE = "YES"; - SWIFT_NATIVE_SWIFT_TOOLS_PATH = ([IO.Path]::Combine((Get-ProjectBinaryCache $BuildPlatform Compilers), "bin")); - SWIFT_PATH_TO_LIBDISPATCH_SOURCE = "$SourceCache\swift-corelibs-libdispatch"; - SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = "$SourceCache\swift-experimental-string-processing"; - }) -} - function Test-Runtime([Hashtable] $Platform) { if ($IsCrossCompiling) { throw "Swift runtime tests are not supported when cross-compiling" } - if (-not (Test-Path (Get-ProjectBinaryCache $Platform Runtime))) { + if (-not (Test-Path (Get-ProjectBinaryCache $Platform DynamicRuntime))) { throw "Swift runtime tests are supposed to reconfigure the existing build" } $CompilersBinaryCache = Get-ProjectBinaryCache $BuildPlatform Compilers @@ -2742,7 +2716,7 @@ function Test-Runtime([Hashtable] $Platform) { $env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path};$UnixToolsBinDir" Build-CMakeProject ` -Src $SourceCache\swift ` - -Bin (Get-ProjectBinaryCache $Platform Runtime) ` + -Bin (Get-ProjectBinaryCache $Platform DynamicRuntime) ` -Platform $Platform ` -UseBuiltCompilers C,CXX,Swift ` -SwiftSDK $null ` @@ -2757,7 +2731,7 @@ function Test-Runtime([Hashtable] $Platform) { } } -function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $false) { +function Build-Runtime([Hashtable] $Platform, [switch] $Static = $false) { # TODO: remove this once the migration is completed. Invoke-IsolatingEnvVars { Invoke-VsDevShell $BuildPlatform @@ -2768,56 +2742,55 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa } Invoke-IsolatingEnvVars { - $env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}" - - $SDKRoot = Get-SwiftSDK -OS $Platform.OS -Identifier "$($Platform.OS)Experimental" + # $env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}" + $SDKRoot = Get-SwiftSDK -OS $Platform.OS $RuntimeBinaryCache = if ($Static) { - Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime + Get-ProjectBinaryCache $Platform StaticRuntime } else { - Get-ProjectBinaryCache $Platform ExperimentalDynamicRuntime + Get-ProjectBinaryCache $Platform DynamicRuntime } $OverlayBinaryCache = if ($Static) { - Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay + Get-ProjectBinaryCache $Platform StaticOverlay } else { - Get-ProjectBinarycache $Platform ExperimentalDynamicOverlay + Get-ProjectBinarycache $Platform DynamicOverlay } $StringProcessingBinaryCache = if ($Static) { - Get-ProjectBinarycache $Platform ExperimentalStaticStringProcessing + Get-ProjectBinarycache $Platform StaticStringProcessing } else { - Get-ProjectBinarycache $Platform ExperimentalDynamicStringProcessing + Get-ProjectBinarycache $Platform DynamicStringProcessing } $SynchronizationBinaryCache = if ($Static) { - Get-ProjectBinarycache $Platform ExperimentalStaticSynchronization + Get-ProjectBinarycache $Platform StaticSynchronization } else { - Get-ProjectBinarycache $Platform ExperimentalDynamicSynchronization + Get-ProjectBinarycache $Platform DynamicSynchronization } $DistributedBinaryCache = if ($Static) { - Get-ProjectBinarycache $Platform ExperimentalStaticDistributed + Get-ProjectBinarycache $Platform StaticDistributed } else { - Get-ProjectBinarycache $Platform ExperimentalDynamicDistributed + Get-ProjectBinarycache $Platform DynamicDistributed } $ObservationBinaryCache = if ($Static) { - Get-ProjectBinarycache $Platform ExperimentalStaticObservation + Get-ProjectBinarycache $Platform StaticObservation } else { - Get-ProjectBinaryCache $Platform ExperimentalDynamicObservation + Get-ProjectBinaryCache $Platform DynamicObservation } $DifferentiationBinaryCache = if ($Static) { - Get-ProjectBinarycache $Platform ExperimentalStaticDifferentiation + Get-ProjectBinarycache $Platform StaticDifferentiation } else { - Get-ProjectBinarycache $Platform ExperimentalDynamicDifferentiation + Get-ProjectBinarycache $Platform DynamicDifferentiation } $VolatileBinaryCache = if ($Static) { - Get-ProjectBinarycache $Platform ExperimentalStaticVolatile + Get-ProjectBinarycache $Platform StaticVolatile } else { - Get-ProjectBinaryCache $Platform ExperimentalDynamicVolatile + Get-ProjectBinaryCache $Platform DynamicVolatile } Build-CMakeProject ` @@ -3023,28 +2996,13 @@ function Write-SDKSettings([OS] $OS, [string] $Identifier = $OS.ToString()) { Write-PList -Settings $SDKSettings -Path "$(Get-SwiftSDK -OS $OS -Identifier $Identifier)\SDKSettings.plist" } -function Build-Dispatch([Hashtable] $Platform) { - $SwiftSDK = Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK - Build-CMakeProject ` - -Src $SourceCache\swift-corelibs-libdispatch ` - -Bin (Get-ProjectBinaryCache $Platform Dispatch) ` - -InstallTo "${SwiftSDK}\usr" ` - -Platform $Platform ` - -UseBuiltCompilers C,CXX,Swift ` - -SwiftSDK $SwiftSDK ` - -Defines @{ - ENABLE_SWIFT = "YES"; - dispatch_INSTALL_ARCH_SUBDIR = "YES"; - } -} - function Test-Dispatch { Invoke-IsolatingEnvVars { $env:CTEST_OUTPUT_ON_FAILURE = "YES" Build-CMakeProject ` -Src $SourceCache\swift-corelibs-libdispatch ` - -Bin (Get-ProjectBinaryCache $BuildPlatform Dispatch) ` + -Bin (Get-ProjectBinaryCache $BuildPlatform DynamicDispatch) ` -Platform $BuildPlatform ` -UseBuiltCompilers C,CXX,Swift ` -SwiftSDK (Get-SwiftSDK -OS $BuildPlatform.OS -Identifier $BuildPlatform.DefaultSDK) ` @@ -3055,48 +3013,6 @@ function Test-Dispatch { } } -function Build-Foundation([Hashtable] $Platform) { - $SwiftSDK = Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK - Build-CMakeProject ` - -Src $SourceCache\swift-corelibs-foundation ` - -Bin (Get-ProjectBinaryCache $Platform DynamicFoundation) ` - -InstallTo "${SwiftSDK}\usr" ` - -Platform $Platform ` - -UseBuiltCompilers C,CXX,Swift ` - -SwiftSDK $SwiftSDK ` - -Defines @{ - BUILD_SHARED_LIBS = "YES"; - # FIXME(compnerd) - workaround ARM64 build failure when cross-compiling. - CMAKE_NINJA_FORCE_RESPONSE_FILE = "YES"; - CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; - BROTLI_INCLUDE_DIR = "$SourceCache\brotli\c\include"; - BROTLICOMMON_LIBRARY = if ($Platform.OS -eq [OS]::Windows) { - "$(Get-ProjectBinaryCache $Platform brotli)\brotlicommon.lib" - } else { - "$(Get-ProjectBinaryCache $Platform brotli)\libbrotlicommon.a" - }; - BROTLIDEC_LIBRARY = if ($Platform.OS -eq [OS]::Windows) { - "$(Get-ProjectBinaryCache $Platform brotli)\brotlidec.lib" - } else { - "$(Get-ProjectBinaryCache $Platform brotli)\libbrotlidec.a" - } - FOUNDATION_BUILD_TOOLS = if ($Platform.OS -eq [OS]::Windows) { "YES" } else { "NO" }; - CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL"; - LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5"; - ZLIB_LIBRARY = if ($Platform.OS -eq [OS]::Windows) { - "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib" - } else { - "$BinaryCache\$($Platform.Triple)\usr\lib\libz.a" - }; - ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include"; - dispatch_DIR = (Get-ProjectCMakeModules $Platform Dispatch); - _SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation"; - _SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu"; - _SwiftCollections_SourceDIR = "$SourceCache\swift-collections"; - SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform BootstrapFoundationMacros)\bin" - } -} - function Test-Foundation { $ScratchPath = "$BinaryCache\$($BuildPlatform.Triple)\FoundationTests" @@ -3138,8 +3054,8 @@ function Build-FoundationMacros([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform FoundationMacros) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ SwiftSyntax_DIR = $SwiftSyntaxDir; } @@ -3170,23 +3086,9 @@ function Build-XCTest([Hashtable] $Platform) { function Test-XCTest { Invoke-IsolatingEnvVars { - $SwiftRuntime = if ($BuildPlatform.DefaultSDK -match "Experimental") { - [IO.Path]::Combine((Get-InstallDir $BuildPlatform), "Runtimes", "$ProductVersion.experimental"); - } else { - [IO.Path]::Combine((Get-InstallDir $BuildPlatform), "Runtimes", "$ProductVersion"); - } - - $DispatchBinaryCache = if ($BuildPlatform.DefaultSDK -match "Experimental") { - Get-ProjectBinaryCache $BuildPlatform ExperimentalDynamicDispatch - } else { - Get-ProjectBinaryCache $BuildPlatform Dispatch - } - - $FoundationBinaryCache = if ($BuildPlatform.DefaultSDK -match "Experimental") { - Get-ProjectBinaryCache $BuildPlatform ExperimentalDynamicFoundation - } else { - Get-ProjectBinaryCache $BuildPlatform DynamicFoundation - } + $SwiftRuntime = [IO.Path]::Combine((Get-InstallDir $BuildPlatform), "Runtimes", "$ProductVersion"); + $DispatchBinaryCache = Get-ProjectBinaryCache $BuildPlatform DynamicDispatch + $FoundationBinaryCache = Get-ProjectBinaryCache $BuildPlatform DynamicFoundation $env:Path = "$(Get-ProjectBinaryCache $BuildPlatform XCTest);${FoundationBinaryCache}\bin;${DispatchBinaryCache};${SwiftRuntime}\usr\bin;${env:Path};$UnixToolsBinDir" $env:SDKROOT = Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK @@ -3200,9 +3102,9 @@ function Test-XCTest { -BuildTargets default,check-xctest ` -Defines @{ ENABLE_TESTING = "YES"; - LLVM_DIR = "$(Get-ProjectBinaryCache $BuildPlatform LLVM)\lib\cmake\llvm"; + LLVM_DIR = "$(Get-ProjectBinaryCache $BuildPlatform Compilers)\lib\cmake\llvm"; XCTEST_PATH_TO_FOUNDATION_BUILD = $(Get-ProjectBinaryCache $BuildPlatform DynamicFoundation); - XCTEST_PATH_TO_LIBDISPATCH_BUILD = $(Get-ProjectBinaryCache $BuildPlatform Dispatch); + XCTEST_PATH_TO_LIBDISPATCH_BUILD = $(Get-ProjectBinaryCache $BuildPlatform DynamicDispatch); XCTEST_PATH_TO_LIBDISPATCH_SOURCE = "$SourceCache\swift-corelibs-libdispatch"; } } @@ -3278,32 +3180,22 @@ function Install-SDK([Hashtable[]] $Platforms, [OS] $OS = $Platforms[0].OS, [str } function Build-SDK([Hashtable] $Platform) { - # Third Party Dependencies - Invoke-BuildStep Build-LLVM $Platform - - # Libraries - Invoke-BuildStep Build-Runtime $Platform - Invoke-BuildStep Build-Dispatch $Platform - Invoke-BuildStep Build-Foundation $Platform -} - -function Build-ExperimentalSDK([Hashtable] $Platform) { Invoke-BuildStep Build-CDispatch $Platform if ($Platform.LinkModes.Contains("dynamic")) { - Invoke-BuildStep Build-ExperimentalRuntime $Platform + Invoke-BuildStep Build-Runtime $Platform } if ($Platform.LinkModes.Contains("static")) { - Invoke-BuildStep Build-ExperimentalRuntime $Platform -Static + Invoke-BuildStep Build-Runtime $Platform -Static } - $SDKROOT = Get-SwiftSDK -OS $Platform.OS -Identifier "$($Platform.OS)Experimental" + $SDKROOT = Get-SwiftSDK -OS $Platform.OS if ($Platform.LinkModes.Contains("dynamic")) { - Record-OperationTime $Platform "Build-ExperimentalDynamicDispatch" { + Record-OperationTime $Platform "Build-DynamicDispatch" { Build-CMakeProject ` -Src $SourceCache\swift-corelibs-libdispatch ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicDispatch) ` + -Bin (Get-ProjectBinaryCache $Platform DynamicDispatch) ` -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers C,CXX,Swift ` @@ -3317,10 +3209,10 @@ function Build-ExperimentalSDK([Hashtable] $Platform) { } } - Record-OperationTime $Platform "Build-ExperimentalDynamicFoundation" { + Record-OperationTime $Platform "Build-DynamicFoundation" { Build-CMakeProject ` -Src $SourceCache\swift-corelibs-foundation ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicFoundation) ` + -Bin (Get-ProjectBinaryCache $Platform DynamicFoundation) ` -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers ASM,C,CXX,Swift ` @@ -3341,7 +3233,7 @@ function Build-ExperimentalSDK([Hashtable] $Platform) { } else { "$BinaryCache\$($Platform.Triple)\usr\lib\libz.a" }; - dispatch_DIR = $(Get-ProjectCMakeModules $Platform ExperimentalDynamicDispatch); + dispatch_DIR = $(Get-ProjectCMakeModules $Platform DynamicDispatch); SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers); _SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation"; _SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu"; @@ -3352,10 +3244,10 @@ function Build-ExperimentalSDK([Hashtable] $Platform) { } if ($Platform.LinkModes.Contains("static")) { - Record-OperationTime $Platform "Build-ExperimentalStaticDispatch" { + Record-OperationTime $Platform "Build-StaticDispatch" { Build-CMakeProject ` -Src $SourceCache\swift-corelibs-libdispatch ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDispatch) ` + -Bin (Get-ProjectBinaryCache $Platform StaticDispatch) ` -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers C,CXX,Swift ` @@ -3369,10 +3261,10 @@ function Build-ExperimentalSDK([Hashtable] $Platform) { } } - Record-OperationTime $Platform "Build-ExperimentalStaticFoundation" { + Record-OperationTime $Platform "Build-StaticFoundation" { Build-CMakeProject ` -Src $SourceCache\swift-corelibs-foundation ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticFoundation) ` + -Bin (Get-ProjectBinaryCache $Platform StaticFoundation) ` -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers ASM,C,CXX,Swift ` @@ -3394,7 +3286,7 @@ function Build-ExperimentalSDK([Hashtable] $Platform) { } else { "$BinaryCache\$($Platform.Triple)\usr\lib\libz.a" }; - dispatch_DIR = $(Get-ProjectCMakeModules $Platform ExperimentalStaticDispatch); + dispatch_DIR = (Get-ProjectCMakeModules $Platform StaticDispatch); SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers); _SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation"; _SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu"; @@ -3423,8 +3315,8 @@ function Build-System([Hashtable] $Platform) { -Src $SourceCache\swift-system ` -Bin (Get-ProjectBinaryCache $Platform System) ` -Platform $Platform ` - -UseBuiltCompilers C,Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers C,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -BuildTargets default ` -Defines @{ BUILD_SHARED_LIBS = "NO"; @@ -3437,8 +3329,8 @@ function Build-Subprocess([Hashtable] $Platform) { -Src $sourceCache\swift-subprocess ` -Bin (Get-ProjectBinaryCache $Platform Subprocess) ` -Platform $Platform ` - -UseBuiltCompilers C,Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers C,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ BUILD_SHARED_LIBS = "NO"; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; @@ -3455,8 +3347,8 @@ function Build-Build([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform Build) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers C,CXX,Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers C,CXX,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines (@{ BUILD_SHARED_LIBS = "YES"; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; @@ -3476,14 +3368,11 @@ function Build-ToolsSupportCore([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform ToolsSupportCore) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers C,Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers C,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ BUILD_SHARED_LIBS = "YES"; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; - - Foundation_DIR = $(Get-ProjectCMakeModules $Platform DynamicFoundation); - XCTest_DIR = (Get-ProjectCMakeModules $Platform XCTest); } } @@ -3494,9 +3383,8 @@ function Build-LLBuild([Hashtable] $Platform) { -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` -UseMSVCCompilers $(if ($UseHostToolchain) { @("CXX") } else { @("") }) ` - -UsePinnedCompilers $(if ($UseHostToolchain) { @("") } else { @("CXX") }) ` - -UseBuiltCompilers Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers $(if ($UseHostToolchain) { @("Swift") } else { @("CXX", "Swift") }) ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ BUILD_SHARED_LIBS = "YES"; LLBUILD_SUPPORT_BINDINGS = "Swift"; @@ -3524,7 +3412,7 @@ function Test-LLBuild { -UseMSVCCompilers $(if ($UseHostToolchain) { @("CXX") } else { @("") }) ` -UsePinnedCompilers $(if ($UseHostToolchain) { @("") } else { @("CXX") }) ` -UseBuiltCompilers Swift ` - -SwiftSDK (Get-SwiftSDK -OS $BuildPlatform.OS -Identifier $BuildPlatform.DefaultSDK) ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS) ` -BuildTargets default,test-llbuild ` -Defines = @{ BUILD_SHARED_LIBS = "YES"; @@ -3543,8 +3431,8 @@ function Build-ArgumentParser([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform ArgumentParser) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ BUILD_SHARED_LIBS = "YES"; BUILD_TESTING = "NO"; @@ -3558,8 +3446,8 @@ function Build-Driver([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform Driver) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers C,CXX,Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers C,CXX,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ BUILD_SHARED_LIBS = "YES"; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; @@ -3580,8 +3468,8 @@ function Build-Crypto([Hashtable] $Platform) { -Src $SourceCache\swift-crypto ` -Bin (Get-ProjectBinaryCache $Platform Crypto) ` -Platform $Platform ` - -UseBuiltCompilers ASM, C, CXX, Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers ASM,C,CXX,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -BuildTargets default ` -Defines @{ BUILD_SHARED_LIBS = "NO"; @@ -3596,8 +3484,8 @@ function Build-Collections([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform Collections) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers C,Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers C,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ BUILD_SHARED_LIBS = "YES"; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; @@ -3609,8 +3497,8 @@ function Build-ASN1([Hashtable] $Platform) { -Src $SourceCache\swift-asn1 ` -Bin (Get-ProjectBinaryCache $Platform ASN1) ` -Platform $Platform ` - -UseBuiltCompilers Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -BuildTargets default ` -Defines @{ BUILD_SHARED_LIBS = "NO"; @@ -3623,8 +3511,8 @@ function Build-Certificates([Hashtable] $Platform) { -Src $SourceCache\swift-certificates ` -Bin (Get-ProjectBinaryCache $Platform Certificates) ` -Platform $Platform ` - -UseBuiltCompilers Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -BuildTargets default ` -Defines @{ BUILD_SHARED_LIBS = "NO"; @@ -3646,8 +3534,8 @@ function Build-PackageManager([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform PackageManager) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers C,Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers C,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ BUILD_SHARED_LIBS = "YES"; CMAKE_Swift_FLAGS = @("-DCRYPTO_v2"); @@ -3695,8 +3583,8 @@ function Build-Markdown([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform Markdown) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers C,Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers C,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ BUILD_SHARED_LIBS = "NO"; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; @@ -3712,9 +3600,8 @@ function Build-Format([Hashtable] $Platform) { -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` -UseMSVCCompilers $(if ($UseHostToolchain) { @("C") } else { @("") }) ` - -UsePinnedCompilers $(if ($UseHostToolchain) { @("") } else { @("C") }) ` - -UseBuiltCompilers Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers $(if ($UseHostToolchain) { @("Swift") } else { @("C", "Swift") }) ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ BUILD_SHARED_LIBS = "YES"; ArgumentParser_DIR = (Get-ProjectCMakeModules $Platform ArgumentParser); @@ -3773,12 +3660,12 @@ function Build-LMDB([Hashtable] $Platform) { } function Build-IndexStoreDB([Hashtable] $Platform) { - $SDKROOT = Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK + $SDKROOT = Get-PinnedToolchainSDK -OS $Platform.OS Build-CMakeProject ` -Src $SourceCache\indexstore-db ` -Bin (Get-ProjectBinaryCache $Platform IndexStoreDB) ` -Platform $Platform ` - -UseBuiltCompilers C,CXX,Swift ` + -UsePinnedCompilers C,CXX,Swift ` -SwiftSDK $SDKROOT ` -BuildTargets default ` -Defines @{ @@ -3796,8 +3683,8 @@ function Build-SourceKitLSP([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform SourceKitLSP) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers C,Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers C,Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; SwiftSyntax_DIR = (Get-ProjectCMakeModules $Platform Compilers); @@ -3908,13 +3795,61 @@ function Build-TestingMacros([Hashtable] $Platform) { -Bin (Get-ProjectBinaryCache $Platform TestingMacros) ` -InstallTo "$($Platform.ToolchainInstallRoot)\usr" ` -Platform $Platform ` - -UseBuiltCompilers Swift ` - -SwiftSDK (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK) ` + -UsePinnedCompilers Swift ` + -SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) ` -Defines @{ SwiftSyntax_DIR = (Get-ProjectCMakeModules $Platform Compilers); } } +function Extract-MSM([String] $MSM, [String] $Destination) { + Push-Location $Destination + + $Installer = New-Object -ComObject WindowsInstaller.Installer + $DB = $Installer.OpenDatabase($MSM, 0) # ReadOnly + + $View = $DB.OpenView("SELECT File, FileName FROM File") + $View.Execute() + + $FileMap = @{} + while ($Record = $View.Fetch()) { + $FileKey = $Record.StringData(1) + $FileName = $Record.StringData(2) + + # Handle long filename format (shortname|longname) + if ($FileName.Contains("|")) { + $FileName = $FileName.Split("|")[1] + } + + $FileMap[$FileKey] = $FileName + } + + $View.Close() + + $CAB = [System.IO.Path]::GetTempFileName() ` + | Rename-Item -NewName { $_ -replace "tmp$", "cab" } -PassThru + + Invoke-IsolatingEnvVars { + Invoke-VsDevShell $BuildPlatform + Remove-Item MergeModule.CABinet -ErrorAction SilentlyContinue -Force | Out-Null + Start-Process -FilePath "${env:WindowsSdkVerBinPath}\x86\MsiDb.exe" -ArgumentList @("-d", "`"$MSM`"", "-x", "MergeModule.CABinet") -Wait + Write-Host Move-Item MergeModule.CABinet $CAB -Force | Out-Null + Move-Item MergeModule.CABinet $CAB -Force | Out-Null + } + + # Extract CAB + foreach ($FileKey in $FileMap.Keys) { + $FileName = $FileMap[$FileKey] + $TargetPath = Join-Path $Destination $FileName + $TargetDirectory = Split-Path $TargetPath -Parent + Invoke-Program expand.exe "$CAB" "-F:$FileKey" $Destination.TrimEnd("\\") | Out-Null + Move-Item (Join-Path $Destination $FileKey) $TargetPath -Force | Out-Null + } + + Remove-Item $CAB -ErrorAction SilentlyContinue | Out-Null + Pop-Location +} + function Install-HostToolchain() { if ($ToBatch) { return } @@ -3953,14 +3888,18 @@ function Build-Inspect([Hashtable] $Platform) { $InstallPath = "$(Get-PlatformRoot $Platform.OS)\Developer\Library\$(Get-ModuleTriple $Platform)" } - $SDKROOT = Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK + $SDKROOT = if ($Platform.OS -eq [OS]::Android) { + Get-PinnedToolchainSDK -OS $Platform.OS -Identifier $Platform.OS + } else { + Get-PinnedToolchainSDK -OS $Platform.OS + } Build-CMakeProject ` -Src $SourceCache\swift\tools\swift-inspect ` -Bin (Get-ProjectBinaryCache $Platform SwiftInspect)` -InstallTo $InstallPath ` -Platform $Platform ` - -UseBuiltCompilers C,CXX,Swift ` + -UsePinnedCompilers C,CXX,Swift ` -SwiftSDK $SDKROOT ` -Defines @{ CMAKE_Swift_FLAGS = @( @@ -4006,7 +3945,7 @@ function Build-Installer([Hashtable] $Platform) { $Properties = @{ BundleFlavor = "offline"; ImageRoot = "$(Get-InstallDir $Platform)\"; - IncludeLegacySDK = if ($HostPlatform.DefaultSDK -match "Experimental") { "False" } else { "True" }; + RedistributablesDirectory = (Get-PinnedToolchainRedistributables); INCLUDE_SWIFT_DOCC = $INCLUDE_SWIFT_DOCC; SWIFT_DOCC_BUILD = "$(Get-ProjectBinaryCache $HostPlatform DocC)\release"; SWIFT_DOCC_RENDER_ARTIFACT_ROOT = "${SourceCache}\swift-docc-render-artifact"; @@ -4032,7 +3971,6 @@ function Build-Installer([Hashtable] $Platform) { $Properties["ToolchainVariants"] = "`"asserts$(if ($IncludeNoAsserts) { ";noasserts" })`""; foreach ($Build in $WindowsSDKBuilds) { $Properties["WindowsRuntime$($Build.Architecture.ShortName.ToUpperInvariant())"] = [IO.Path]::Combine((Get-InstallDir $Build), "Runtimes", "$ProductVersion"); - $Properties["WindowsExperimentalRuntime$($Build.Architecture.ShortName.ToUpperInvariant())"] = [IO.Path]::Combine((Get-InstallDir $Build), "Runtimes", "$ProductVersion.experimental"); } Build-WiXProject bundle\installer.wixproj -Platform $Platform -Bundle -Properties $Properties @@ -4113,6 +4051,8 @@ if (-not $SkipBuild) { Invoke-BuildStep Build-CMark $BuildPlatform Invoke-BuildStep Build-BuildTools $BuildPlatform + Invoke-BuildStep Build-SQLite $BuildPlatform + Invoke-BuildStep Build-EarlySwiftDriver $BuildPlatform if ($IsCrossCompiling) { Invoke-BuildStep Build-XML2 $BuildPlatform Invoke-BuildStep Build-Compilers $BuildPlatform -Variant "Asserts" @@ -4125,6 +4065,9 @@ if (-not $SkipBuild) { Invoke-BuildStep Build-XML2 $HostPlatform Invoke-BuildStep Build-CDispatch $HostPlatform Invoke-BuildStep Build-Compilers $HostPlatform -Variant "Asserts" + + Extract-MSM "$(Get-PinnedToolchainRedistributables)\rtl.shared.$($HostPlatform.Architecture.VSName).msm" "$($HostPlatform.ToolchainInstallRoot)\usr\bin\" + $KnownPlatforms.Values | Where-Object { switch ($_.OS) { Windows { $Windows } @@ -4170,51 +4113,26 @@ if (-not $SkipBuild) { Invoke-BuildStep Build-CURL $Build } - foreach ($SDK in $WindowsSDKVersions) { - switch ($SDK) { - Windows { - $SDKROOT = Get-SwiftSDK -OS Windows -Identifier Windows - foreach ($Build in $WindowsSDKBuilds) { - Invoke-BuildStep Build-SDK $Build - - Get-ChildItem "${SDKROOT}\usr\lib\swift\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object { - Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" - Move-Item $_.FullName "${SDKROOT}\usr\lib\swift\windows\$($Build.Architecture.LLVMName)\" | Out-Null - } - - # FIXME(compnerd) how do we select which SDK is meant to be re-distributed? - Copy-Directory "${SDKROOT}\usr\bin" "$([IO.Path]::Combine((Get-InstallDir $Build), "Runtimes", $ProductVersion, "usr"))" - } - - Install-SDK $WindowsSDKBuilds - Write-SDKSettings Windows - } - - WindowsExperimental { - $SDKROOT = Get-SwiftSDK -OS Windows -Identifier WindowsExperimental - foreach ($Build in $WindowsSDKBuilds) { - Invoke-BuildStep Build-ExperimentalSDK $Build - - Get-ChildItem "${SDKROOT}\usr\lib\swift\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object { - Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" - Move-Item $_.FullName "${SDKROOT}\usr\lib\swift\windows\$($Build.Architecture.LLVMName)\" | Out-Null - } - - Get-ChildItem "${SDKROOT}\usr\lib\swift_static\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object { - Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" - Move-Item $_.FullName "${SDKROOT}\usr\lib\swift_static\windows\$($Build.Architecture.LLVMName)\" | Out-Null - } + $SDKROOT = Get-SwiftSDK -OS Windows + foreach ($Build in $WindowsSDKBuilds) { + Invoke-BuildStep Build-SDK $Build - # FIXME(compnerd) how do we select which SDK is meant to be re-distributed? - Copy-Directory "${SDKROOT}\usr\bin" "$([IO.Path]::Combine((Get-InstallDir $Build), "Runtimes", "$ProductVersion.experimental", "usr"))" - } + Get-ChildItem -ErrorAction Ignore "${SDKROOT}\usr\lib\swift\windows" -Filter "*.lib" -File | ForEach-Object { + Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" + Move-Item $_.FullName "${SDKROOT}\usr\lib\swift\windows\$($Build.Architecture.LLVMName)\" | Out-Null + } - Install-SDK $WindowsSDKBuilds -Identifier WindowsExperimental - Write-SDKSettings Windows -Identifier WindowsExperimental - } + Get-ChildItem -ErrorAction Ignore "${SDKROOT}\usr\lib\swift_static\windows" -Filter "*.lib" -File | ForEach-Object { + Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" + Move-Item $_.FullName "${SDKROOT}\usr\lib\swift_static\windows\$($Build.Architecture.LLVMName)\" | Out-Null } + + Copy-Directory "${SDKROOT}\usr\bin" "$([IO.Path]::Combine((Get-InstallDir $Build), "Runtimes", "$ProductVersion", "usr"))" } + Install-SDK $WindowsSDKBuilds + Write-SDKSettings Windows + foreach ($Build in $WindowsSDKBuilds) { Invoke-BuildStep Build-XCTest $Build Invoke-BuildStep Build-Testing $Build @@ -4226,10 +4144,8 @@ if (-not $SkipBuild) { # Copy static dependencies foreach ($Build in $WindowsSDKBuilds) { - if (-not $Build.LinkModes.Contains("static")) { continue } - - $SDKROOT = Get-SwiftSDK -OS $Build.OS -Identifier "$($Build.OS)Experimental" $SwiftResourceDir = "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)" + New-Item -ErrorAction Ignore -ItemType Directory -Path "${SwiftResourceDir}" | Out-Null Copy-Item -Force -Path "$(Get-ProjectBinaryCache $Build brotli)\brotlicommon.lib" -Destination "${SwiftResourceDir}\brotlicommon.lib" | Out-Null Copy-Item -Force -Path "$(Get-ProjectBinaryCache $Build brotli)\brotlidec.lib" -Destination "${SwiftResourceDir}\brotlidec.lib" | Out-Null Copy-Item -Force -Path "${BinaryCache}\$($Build.Triple)\curl\lib\libcurl.lib" -Destination "${SwiftResourceDir}\libcurl.lib" | Out-Null @@ -4250,45 +4166,24 @@ if (-not $SkipBuild) { Invoke-BuildStep Build-CURL $Build } - foreach ($SDK in $AndroidSDKVersions) { - switch ($SDK) { - Android { - $SDKROOT = Get-SwiftSDK -OS Android -Identifier Android - foreach ($Build in $AndroidSDKBuilds) { - Invoke-BuildStep Build-SDK $Build - - Get-ChildItem "${SDKROOT}\usr\lib\swift\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object { - Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" - Move-Item $_.FullName "${SDKROOT}\usr\lib\swift\android\$($Build.Architecture.LLVMName)\" | Out-Null - } - } - - Install-SDK $AndroidSDKBuilds - Write-SDKSettings Android - } - - AndroidExperimental { - $SDKROOT = Get-SwiftSDK Android -Identifier AndroidExperimental - foreach ($Build in $AndroidSDKBuilds) { - Invoke-BuildStep Build-ExperimentalSDK $Build - - Get-ChildItem "${SDKROOT}\usr\lib\swift\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object { - Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" - Move-Item $_.FullName "${SDKROOT}\usr\lib\swift\android\$($Build.Architecture.LLVMName)\" | Out-Null - } + $SDKROOT = Get-SwiftSDK Android + foreach ($Build in $AndroidSDKBuilds) { + Invoke-BuildStep Build-SDK $Build - Get-ChildItem "${SDKROOT}\usr\lib\swift_static\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object { - Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" - Move-Item $_.FullName "${SDKROOT}\usr\lib\swift_static\android\$($Build.Architecture.LLVMName)\" | Out-Null - } - } + Get-ChildItem -ErrorAction Ignore "${SDKROOT}\usr\lib\swift\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object { + Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" + Move-Item $_.FullName "${SDKROOT}\usr\lib\swift\android\$($Build.Architecture.LLVMName)\" | Out-Null + } - Install-SDK $AndroidSDKBuilds -Identifiers AndroidExperimental - Write-SDKSettings Android -Identifier AndroidExperimental - } + Get-ChildItem -ErrorAction Ignore "${SDKROOT}\usr\lib\swift_static\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object { + Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" + Move-Item $_.FullName "${SDKROOT}\usr\lib\swift_static\android\$($Build.Architecture.LLVMName)\" | Out-Null } } + Install-SDK $AndroidSDKBuilds + Write-SDKSettings Android + foreach ($Build in $AndroidSDKBuilds) { Invoke-BuildStep Build-XCTest $Build Invoke-BuildStep Build-Testing $Build @@ -4303,10 +4198,8 @@ if (-not $SkipBuild) { # Copy static dependencies foreach ($Build in $AndroidSDKBuilds) { - if (-not $Build.LinkModes.Contains("static")) { continue } - - $SDKROOT = Get-SwiftSDK -OS $Build.OS -Identifier "$($Build.OS)Experimental" $SwiftResourceDir = "${SDKROOT}\usr\lib\swift_static\$($Build.OS.ToString().ToLowerInvariant())\$($Build.Architecture.LLVMName)" + New-Item -ErrorAction Ignore -ItemType Directory -Path "${SwiftResourceDir}" | Out-Null Copy-Item -Force -Path "$(Get-ProjectBinaryCache $Build brotli)\libbrotlicommon.a" -Destination "${SwiftResourceDir}\libbrotlicommon.a" | Out-Null Copy-Item -Force -Path "$(Get-ProjectBinaryCache $Build brotli)\libbrotlidec.a" -Destination "${SwiftResourceDir}\libbrotlidec.a" | Out-Null Copy-Item -Force -Path "${BinaryCache}\$($Build.Triple)\curl\lib\libcurl.a" -Destination "${SwiftResourceDir}\libcurl.a" | Out-Null @@ -4315,6 +4208,7 @@ if (-not $SkipBuild) { } } + # Build Macros for distribution Invoke-BuildStep Build-FoundationMacros $HostPlatform Invoke-BuildStep Build-TestingMacros $HostPlatform @@ -4338,23 +4232,19 @@ if (-not $SkipBuild) { Invoke-BuildStep Build-IndexStoreDB $HostPlatform Invoke-BuildStep Build-SourceKitLSP $HostPlatform Invoke-BuildStep Build-Inspect $HostPlatform -} -Install-HostToolchain + Install-HostToolchain -if (-not $SkipBuild) { Invoke-BuildStep Build-mimalloc $HostPlatform -} -if (-not $SkipBuild -and $IncludeNoAsserts) { - Build-NoAssertsToolchain -} + if ($IncludeNoAsserts) { + Build-NoAssertsToolchain + } -if (-not $SkipBuild -and -not $IsCrossCompiling) { - Invoke-BuildStep Build-DocC $HostPlatform -} + if (-not $IsCrossCompiling) { + Invoke-BuildStep Build-DocC $HostPlatform + } -if (-not $SkipBuild) { Invoke-BuildStep Patch-mimalloc $HostPlatform }