@@ -425,6 +425,7 @@ enum TargetComponent {
425
425
Testing
426
426
ClangBuiltins
427
427
ClangRuntime
428
+ SwiftInspect
428
429
}
429
430
430
431
function Get-TargetProjectBinaryCache ($Arch , [TargetComponent ]$Project ) {
@@ -452,7 +453,6 @@ enum HostComponent {
452
453
SourceKitLSP
453
454
SymbolKit
454
455
DocC
455
- SwiftInspect
456
456
}
457
457
458
458
function Get-HostProjectBinaryCache ([HostComponent ]$Project ) {
@@ -2879,19 +2879,34 @@ function Install-HostToolchain() {
2879
2879
Copy-Item - Force $SwiftDriver " $ ( $HostArch.ToolchainInstallRoot ) \usr\bin\swiftc.exe"
2880
2880
}
2881
2881
2882
- function Build-Inspect () {
2883
- $SDKRoot = Get-HostSwiftSDK
2882
+ function Build-Inspect ([Platform ]$Platform , $Arch ) {
2883
+ if ($Arch -eq $HostArch ) {
2884
+ # When building for the host target, use the host version of the swift-argument-parser,
2885
+ # and place the host swift-inspect executable with the other host toolchain binaries.
2886
+ $ArgumentParserDir = Get-HostProjectCMakeModules ArgumentParser
2887
+ $InstallPath = " $ ( $HostArch.ToolchainInstallRoot ) \usr"
2888
+ } else {
2889
+ # When building for non-host target, let CMake fetch the swift-argument-parser dependency
2890
+ # since it is currently only built for the host and and cannot be built for Android until
2891
+ # the pinned version is >= 1.5.0.
2892
+ $ArgumentParserDir = " "
2893
+ $InstallPath = " $ ( $Arch.PlatformInstallRoot ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) "
2894
+ }
2884
2895
2885
2896
Build-CMakeProject `
2886
2897
- Src $SourceCache \swift\tools\swift- inspect `
2887
- - Bin (Get-HostProjectBinaryCache SwiftInspect) `
2888
- - InstallTo " $ ( $HostArch.ToolchainInstallRoot ) \usr" `
2889
- - Arch $HostArch `
2898
+ - Bin (Get-TargetProjectBinaryCache $Arch SwiftInspect)`
2899
+ - InstallTo $InstallPath `
2900
+ - Arch $Arch `
2901
+ - Platform $Platform `
2890
2902
- UseBuiltCompilers C, CXX, Swift `
2891
- - SwiftSDK $SDKRoot `
2903
+ - SwiftSDK $Arch .SDKInstallRoot `
2892
2904
- Defines @ {
2893
- CMAKE_Swift_FLAGS = @ (" -Xcc" , " -I$SDKRoot \usr\include\swift\SwiftRemoteMirror" );
2894
- ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
2905
+ CMAKE_Swift_FLAGS = @ (
2906
+ " -Xcc" , " -I$ ( $Arch.SDKInstallRoot ) \usr\lib\swift" ,
2907
+ " -Xcc" , " -I$ ( $Arch.SDKInstallRoot ) \usr\include\swift\SwiftRemoteMirror" ,
2908
+ " -L$ ( $Arch.SDKInstallRoot ) \usr\lib\swift\$Platform " );
2909
+ ArgumentParser_DIR = $ArgumentParserDir ;
2895
2910
}
2896
2911
}
2897
2912
@@ -3053,6 +3068,12 @@ if (-not $SkipBuild) {
3053
3068
Invoke-BuildStep Build-Sanitizers Android $Arch
3054
3069
Invoke-BuildStep Build-XCTest Android $Arch
3055
3070
Invoke-BuildStep Build-Testing Android $Arch
3071
+
3072
+ # Android swift-inspect only supports 64-bit platforms.
3073
+ if ($Arch.AndroidArchABI -eq " arm64-v8a" -or
3074
+ $Arch.AndroidArchABI -eq " x86_64" ) {
3075
+ Invoke-BuildStep Build-Inspect - Platform Android - Arch $Arch
3076
+ }
3056
3077
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
3057
3078
Invoke-BuildStep Write-PlatformInfoPlist $Arch
3058
3079
}
@@ -3097,7 +3118,7 @@ if (-not $SkipBuild) {
3097
3118
Invoke-BuildStep Build-LMDB $HostArch
3098
3119
Invoke-BuildStep Build-IndexStoreDB $HostArch
3099
3120
Invoke-BuildStep Build-SourceKitLSP $HostArch
3100
- Invoke-BuildStep Build-Inspect $HostArch
3121
+ Invoke-BuildStep Build-Inspect Windows $HostArch
3101
3122
}
3102
3123
3103
3124
Install-HostToolchain
0 commit comments