From fe331e1deaf2189b40f72ad181e12f99960358d7 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 24 Sep 2025 17:01:42 -0700 Subject: [PATCH 1/3] build.ps1: repair XCTest cross-compilation for Android Android cross-compilation does not properly add the library search path for `-sdk` which requires we manually inject the additional library search path. --- utils/build.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/build.ps1 b/utils/build.ps1 index 0c52d641b34bf..3adc1979754c9 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -3108,6 +3108,12 @@ function Build-FoundationMacros([Hashtable] $Platform) { } function Build-XCTest([Hashtable] $Platform) { + $SwiftFlags = if ($Platform.OS -eq [OS]::Windows) { + @(); + } else { + @("-I$(Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK)\usr\lib\swift"); + } + Build-CMakeProject ` -Src $SourceCache\swift-corelibs-xctest ` -Bin (Get-ProjectBinaryCache $Platform XCTest) ` @@ -3118,6 +3124,7 @@ function Build-XCTest([Hashtable] $Platform) { -Defines @{ BUILD_SHARED_LIBS = "YES"; CMAKE_INSTALL_BINDIR = $Platform.BinaryDir; + CMAKE_Swift_FLAGS = $SwiftFlags; ENABLE_TESTING = "NO"; XCTest_INSTALL_NESTED_SUBDIR = "YES"; } From f9e5a2c3b0bbf52a5b6420c818573e666505f9eb Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 24 Sep 2025 17:01:42 -0700 Subject: [PATCH 2/3] build.ps1: repair Testing cross-compilation for Android Android cross-compilation does not properly add the library search path for `-sdk` which requires we manually inject the additional library search path. --- utils/build.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/build.ps1 b/utils/build.ps1 index 3adc1979754c9..2847b922e8432 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -3171,6 +3171,12 @@ function Test-XCTest { } function Build-Testing([Hashtable] $Platform) { + $SwiftFlags = if ($Platform.OS -eq [OS]::Windows) { + @(); + } else { + @("-I$(Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK)\usr\lib\swift"); + } + Build-CMakeProject ` -Src $SourceCache\swift-testing ` -Bin (Get-ProjectBinaryCache $Platform Testing) ` @@ -3181,6 +3187,7 @@ function Build-Testing([Hashtable] $Platform) { -Defines @{ BUILD_SHARED_LIBS = "YES"; CMAKE_INSTALL_BINDIR = $Platform.BinaryDir; + CMAKE_Swift_FLAGS = $SwiftFlags; SwiftTesting_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform BootstrapTestingMacros)\TestingMacros.dll"; SwiftTesting_INSTALL_NESTED_SUBDIR = "YES"; } From e7843bfc61cc7afde6913a5eb5bd1586d2c8f820 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 24 Sep 2025 17:02:46 -0700 Subject: [PATCH 3/3] build.ps1: repair Inspect build for Android on Windows Add additional import search path for Android to repair the build failure due to missing libraries as `-sdk` does not properly add the search path on Android. --- utils/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/build.ps1 b/utils/build.ps1 index 2847b922e8432..f31cb027e2c65 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -3914,7 +3914,7 @@ function Build-Inspect([Hashtable] $Platform) { $InstallPath = "$(Get-PlatformRoot $Platform.OS)\Developer\Library\$(Get-ModuleTriple $Platform)" } - $SDKROOT = Get-SwiftSDK $Platform.OS + $SDKROOT = Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK Build-CMakeProject ` -Src $SourceCache\swift\tools\swift-inspect `