@@ -6869,8 +6869,14 @@ final class SwiftDriverTests: XCTestCase {
6869
6869
}
6870
6870
6871
6871
func testPluginPaths( ) throws {
6872
- let sdkRoot = testInputsPath. appending ( component: " SDKChecks " ) . appending ( component: " iPhoneOS.sdk " )
6873
- var driver = try Driver ( args: [ " swiftc " , " -typecheck " , " foo.swift " , " -sdk " , VirtualPath . absolute ( sdkRoot) . name, " -plugin-path " , " PluginA " , " -external-plugin-path " , " PluginB#Bexe " , " -load-plugin-library " , " PluginB2 " , " -plugin-path " , " PluginC " ] )
6872
+ try pluginPathTest ( platform: " iPhoneOS " , sdk: " iPhoneOS13.0 " , searchPlatform: " iPhoneOS " )
6873
+ try pluginPathTest ( platform: " iPhoneSimulator " , sdk: " iPhoneSimulator15.0 " , searchPlatform: " iPhoneOS " )
6874
+ }
6875
+
6876
+ func pluginPathTest( platform: String , sdk: String , searchPlatform: String ) throws {
6877
+ let sdkRoot = testInputsPath. appending (
6878
+ components: [ " Platform Checks " , " \( platform) .platform " , " Developer " , " SDKs " , " \( sdk) .sdk " ] )
6879
+ var driver = try Driver ( args: [ " swiftc " , " -typecheck " , " foo.swift " , " -sdk " , VirtualPath . absolute ( sdkRoot) . name, " -plugin-path " , " PluginA " , " -external-plugin-path " , " Plugin~B#Bexe " , " -load-plugin-library " , " PluginB2 " , " -plugin-path " , " PluginC " ] )
6874
6880
guard driver. isFrontendArgSupported ( . pluginPath) && driver. isFrontendArgSupported ( . externalPluginPath) else {
6875
6881
return
6876
6882
}
@@ -6883,7 +6889,7 @@ final class SwiftDriverTests: XCTestCase {
6883
6889
let pluginAIndex = job. commandLine. firstIndex ( of: . path( VirtualPath . relative ( . init( " PluginA " ) ) ) )
6884
6890
XCTAssertNotNil ( pluginAIndex)
6885
6891
6886
- let pluginBIndex = job. commandLine. firstIndex ( of: . path( VirtualPath . relative ( . init( " PluginB #Bexe" ) ) ) )
6892
+ let pluginBIndex = job. commandLine. firstIndex ( of: . path( VirtualPath . relative ( . init( " Plugin~B #Bexe" ) ) ) )
6887
6893
XCTAssertNotNil ( pluginBIndex)
6888
6894
XCTAssertLessThan ( pluginAIndex!, pluginBIndex!)
6889
6895
@@ -6909,7 +6915,11 @@ final class SwiftDriverTests: XCTestCase {
6909
6915
XCTAssertNotNil ( sdkLocalPluginPathIndex)
6910
6916
XCTAssertLessThan ( sdkPluginPathIndex!, sdkLocalPluginPathIndex!)
6911
6917
6912
- let platformPath = sdkRoot. parentDirectory. parentDirectory. parentDirectory. appending ( components: " Developer " , " usr " )
6918
+ let origPlatformPath =
6919
+ sdkRoot. parentDirectory. parentDirectory. parentDirectory. parentDirectory
6920
+ . appending ( component: " \( searchPlatform) .platform " )
6921
+
6922
+ let platformPath = origPlatformPath. appending ( components: " Developer " , " usr " )
6913
6923
let platformServerPath = platformPath. appending ( components: " bin " , " swift-plugin-server " ) . pathString
6914
6924
6915
6925
let platformPluginPath = platformPath. appending ( components: " lib " , " swift " , " host " , " plugins " )
0 commit comments