From e58fa624163645de4d7226ffe6cf5cdadd8d2266 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 4 Sep 2023 15:31:27 -0700 Subject: [PATCH] SwiftDriver: speculative changes to support Windows macros The test suite is currently entirely broken on Windows (awaiting @cachemeifyoucan to fix apple/swift-driver#1431). This speculatively changes the driver to alter the search paths to match apple/swift#68322). --- Sources/SwiftDriver/Toolchains/DarwinToolchain.swift | 8 ++++++++ Tests/SwiftDriverTests/SwiftDriverTests.swift | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/Sources/SwiftDriver/Toolchains/DarwinToolchain.swift b/Sources/SwiftDriver/Toolchains/DarwinToolchain.swift index cf099be5b..fd523655c 100644 --- a/Sources/SwiftDriver/Toolchains/DarwinToolchain.swift +++ b/Sources/SwiftDriver/Toolchains/DarwinToolchain.swift @@ -482,13 +482,21 @@ extension VirtualPath { // Given a virtual path pointing into a toolchain/SDK/platform, produce the // path to `swift-plugin-server`. fileprivate var pluginServerPath: VirtualPath { +#if os(Windows) + self.appending(components: "bin", "swift-plugin-server.exe") +#else self.appending(components: "bin", "swift-plugin-server") +#endif } // Given a virtual path pointing into a toolchain/SDK/platform, produce the // path to the plugins. var pluginPath: VirtualPath { +#if os(Windows) + self.appending(components: "bin") +#else self.appending(components: "lib", "swift", "host", "plugins") +#endif } // Given a virtual path pointing into a toolchain/SDK/platform, produce the diff --git a/Tests/SwiftDriverTests/SwiftDriverTests.swift b/Tests/SwiftDriverTests/SwiftDriverTests.swift index 442984217..bc62b903d 100644 --- a/Tests/SwiftDriverTests/SwiftDriverTests.swift +++ b/Tests/SwiftDriverTests/SwiftDriverTests.swift @@ -6938,8 +6938,12 @@ final class SwiftDriverTests: XCTestCase { #endif XCTAssertTrue(job.commandLine.contains(.flag("-plugin-path"))) +#if os(Windows) + XCTAssertTrue(job.commandLine.contains(.path(.absolute(try driver.toolchain.executableDir.parentDirectory.appending(components: "bin"))))) +#else XCTAssertTrue(job.commandLine.contains(.path(.absolute(try driver.toolchain.executableDir.parentDirectory.appending(components: "lib", "swift", "host", "plugins"))))) XCTAssertTrue(job.commandLine.contains(.path(.absolute(try driver.toolchain.executableDir.parentDirectory.appending(components: "local", "lib", "swift", "host", "plugins"))))) +#endif } func testClangModuleValidateOnce() throws {