Merge pull request #45 from shibapm/use_swift_instead_of_swiftc_for_compilation

Use swift instead of swiftc for compilation
This commit is contained in:
Franco Meloni 2021-10-17 20:51:46 +01:00 committed by GitHub
commit a101e9db31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -11,20 +11,19 @@ final class SwiftScriptExecutor: DefaultExecutor<SwiftScriptParameters> {
return 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 swiftPath = supportedSwiftPaths.first { fileManager.fileExists(atPath: $0) }
let swiftC = swiftCPath ?? "swiftc" let swift = swiftPath ?? "swift"
let args = [ let args = [
"--driver-mode=swift",
scriptPath, scriptPath,
version, version,
] + parameters.arguments ] + parameters.arguments
logger.logInfo("Running: \(swiftC) \(args.joined(separator: " "))") logger.logInfo("Running: \(swift) \(args.joined(separator: " "))")
let process = Process() let process = Process()
process.launchPath = swiftC process.launchPath = swift
process.arguments = args process.arguments = args
let standardOutput = FileHandle.standardOutput let standardOutput = FileHandle.standardOutput

View File

@ -15,9 +15,8 @@ final class SwiftScriptExecutorTests: XCTestCase {
executor.executeStep(version: "1.0.0", logger: Logger.testLogger) 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) == [ expect(processLauncher.receivedProcess?.arguments) == [
"--driver-mode=swift",
testPath, testPath,
"1.0.0", "1.0.0",
] ]