From 81a3b70dd75d58d904af696b0d011942006332f2 Mon Sep 17 00:00:00 2001 From: Franco Meloni Date: Sun, 10 Oct 2021 16:25:00 +0100 Subject: [PATCH 1/2] Use swift instead of swiftc --- Sources/RocketLib/Executors/SwiftScriptExecutor.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Sources/RocketLib/Executors/SwiftScriptExecutor.swift b/Sources/RocketLib/Executors/SwiftScriptExecutor.swift index 9b155c1..83aec50 100644 --- a/Sources/RocketLib/Executors/SwiftScriptExecutor.swift +++ b/Sources/RocketLib/Executors/SwiftScriptExecutor.swift @@ -11,20 +11,19 @@ final class SwiftScriptExecutor: DefaultExecutor { return } - let supportedSwiftCPaths = ["/usr/bin/swiftc", "/home/travis/.swiftenv/shims/swiftc"] + let supportedSwiftPaths = ["/usr/bin/swift", "/home/travis/.swiftenv/shims/swift"] - let swiftCPath = supportedSwiftCPaths.first { fileManager.fileExists(atPath: $0) } - let swiftC = swiftCPath ?? "swiftc" + let swiftPath = supportedSwiftPaths.first { fileManager.fileExists(atPath: $0) } + let swift = swiftPath ?? "swift" let args = [ - "--driver-mode=swift", scriptPath, version, ] + parameters.arguments - logger.logInfo("Running: \(swiftC) \(args.joined(separator: " "))") + logger.logInfo("Running: \(swift) \(args.joined(separator: " "))") let process = Process() - process.launchPath = swiftC + process.launchPath = swift process.arguments = args let standardOutput = FileHandle.standardOutput From 51a78e73b4c3ae71dbfd3dfc9642b3d9ea487e7a Mon Sep 17 00:00:00 2001 From: Franco Meloni Date: Sun, 10 Oct 2021 16:25:59 +0100 Subject: [PATCH 2/2] Fix tests --- Tests/RocketTests/SwiftScriptExecutorTests.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tests/RocketTests/SwiftScriptExecutorTests.swift b/Tests/RocketTests/SwiftScriptExecutorTests.swift index a17e84c..0c0f577 100644 --- a/Tests/RocketTests/SwiftScriptExecutorTests.swift +++ b/Tests/RocketTests/SwiftScriptExecutorTests.swift @@ -15,9 +15,8 @@ final class SwiftScriptExecutorTests: XCTestCase { executor.executeStep(version: "1.0.0", logger: Logger.testLogger) - expect(processLauncher.receivedProcess?.launchPath) == "/usr/bin/swiftc" + expect(processLauncher.receivedProcess?.launchPath) == "/usr/bin/swift" expect(processLauncher.receivedProcess?.arguments) == [ - "--driver-mode=swift", testPath, "1.0.0", ]