@@ -432,6 +432,7 @@ enum TargetComponent {
432432 Testing
433433 ClangBuiltins
434434 ClangRuntime
435+ SwiftInspect
435436}
436437
437438function Get-TargetProjectBinaryCache ($Arch , [TargetComponent ]$Project ) {
@@ -459,7 +460,6 @@ enum HostComponent {
459460 SourceKitLSP
460461 SymbolKit
461462 DocC
462- SwiftInspect
463463}
464464
465465function Get-HostProjectBinaryCache ([HostComponent ]$Project ) {
@@ -2874,19 +2874,37 @@ function Install-HostToolchain() {
28742874 Copy-Item - Force $SwiftDriver " $ ( $HostArch.ToolchainInstallRoot ) \usr\bin\swiftc.exe"
28752875}
28762876
2877- function Build-Inspect () {
2878- $SDKRoot = Get-HostSwiftSDK
2877+ function Build-Inspect ([Platform ]$Platform , $Arch ) {
2878+ $InstallPath = if ($Arch -eq $HostArch ) {
2879+ # Place the host swift-inspect binary with the other toolchain binaries.
2880+ " $ ( $HostArch.ToolchainInstallRoot ) \usr"
2881+ } else {
2882+ " $ ( $Arch.PlatformInstallRoot ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) "
2883+ }
2884+
2885+ $ArgumentParserDir = if ($Platform -eq " Android" ) {
2886+ # TODO: remove this special-case when the toolchain build moves to a newer version of
2887+ # swift-argument-parser (>= 1.5.0). For now, let CMake fetch the dependency because
2888+ # older versions of swift-argument-parser do not build properly for Android.
2889+ " "
2890+ } else {
2891+ Get-HostProjectCMakeModules ArgumentParser
2892+ }
28792893
28802894 Build-CMakeProject `
28812895 - Src $SourceCache \swift\tools\swift- inspect `
2882- - Bin (Get-HostProjectBinaryCache SwiftInspect) `
2883- - InstallTo " $ ( $HostArch.ToolchainInstallRoot ) \usr" `
2884- - Arch $HostArch `
2896+ - Bin (Get-TargetProjectBinaryCache $Arch SwiftInspect)`
2897+ - InstallTo $InstallPath `
2898+ - Arch $Arch `
2899+ - Platform $Platform `
28852900 - UseBuiltCompilers C, CXX, Swift `
2886- - SwiftSDK $SDKRoot `
2901+ - SwiftSDK $Arch .SDKInstallRoot `
28872902 - Defines @ {
2888- CMAKE_Swift_FLAGS = @ (" -Xcc" , " -I$SDKRoot \usr\include\swift\SwiftRemoteMirror" );
2889- ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
2903+ CMAKE_Swift_FLAGS = @ (
2904+ " -Xcc" , " -I$ ( $Arch.SDKInstallRoot ) \usr\lib\swift" ,
2905+ " -Xcc" , " -I$ ( $Arch.SDKInstallRoot ) \usr\include\swift\SwiftRemoteMirror" ,
2906+ " -L$ ( $Arch.SDKInstallRoot ) \usr\lib\swift\$Platform " );
2907+ ArgumentParser_DIR = $ArgumentParserDir ;
28902908 }
28912909}
28922910
@@ -3033,6 +3051,13 @@ if (-not $SkipBuild) {
30333051 Invoke-BuildStep Build-Sanitizers Windows $Arch
30343052 Invoke-BuildStep Build-XCTest Windows $Arch
30353053 Invoke-BuildStep Build-Testing Windows $Arch
3054+
3055+ # Windows swift-inspect only supports 64-bit platforms.
3056+ if ($Arch.VSName -eq " amd64" -or
3057+ $Arch.VSName -eq " arm64" ) {
3058+ Invoke-BuildStep Build-Inspect - Platform Windows - Arch $Arch
3059+ }
3060+
30363061 Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
30373062 Invoke-BuildStep Write-PlatformInfoPlist $Arch
30383063 }
@@ -3053,6 +3078,13 @@ if (-not $SkipBuild) {
30533078 Invoke-BuildStep Build-Sanitizers Android $Arch
30543079 Invoke-BuildStep Build-XCTest Android $Arch
30553080 Invoke-BuildStep Build-Testing Android $Arch
3081+
3082+ # Android swift-inspect only supports 64-bit platforms.
3083+ if ($Arch.AndroidArchABI -eq " arm64-v8a" -or
3084+ $Arch.AndroidArchABI -eq " x86_64" ) {
3085+ Invoke-BuildStep Build-Inspect - Platform Android - Arch $Arch
3086+ }
3087+
30563088 Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
30573089 Invoke-BuildStep Write-PlatformInfoPlist $Arch
30583090 }
@@ -3099,7 +3131,6 @@ if (-not $SkipBuild) {
30993131 Invoke-BuildStep Build-LMDB $HostArch
31003132 Invoke-BuildStep Build-IndexStoreDB $HostArch
31013133 Invoke-BuildStep Build-SourceKitLSP $HostArch
3102- Invoke-BuildStep Build-Inspect $HostArch
31033134}
31043135
31053136Install-HostToolchain
0 commit comments