diff --git a/Sources/swcomp/Benchmarks/BenchmarkMetadata.swift b/Sources/swcomp/Benchmarks/BenchmarkMetadata.swift index 4f42f057..76ad2223 100644 --- a/Sources/swcomp/Benchmarks/BenchmarkMetadata.swift +++ b/Sources/swcomp/Benchmarks/BenchmarkMetadata.swift @@ -32,35 +32,19 @@ struct BenchmarkMetadata: Codable, Equatable { private static func getExecURL(for command: String) throws -> URL { let args = ["-c", "which \(command)"] - #if os(Windows) - swcompExit(.benchmarkCannotGetSubcommandPathWindows) - #else - let output = try BenchmarkMetadata.run(command: URL(fileURLWithPath: "/bin/sh"), arguments: args) - #endif + let output = try BenchmarkMetadata.run(command: URL(fileURLWithPath: "/bin/sh"), arguments: args) return URL(fileURLWithPath: String(output.dropLast())) } private static func getOsInfo() throws -> String { - #if os(Linux) - return try BenchmarkMetadata.run(command: BenchmarkMetadata.getExecURL(for: "uname"), arguments: ["-a"]) - #else - #if os(Windows) - return "Unknown Windows OS" - #else - return try BenchmarkMetadata.run(command: BenchmarkMetadata.getExecURL(for: "sw_vers")) - #endif - #endif + return try BenchmarkMetadata.run(command: BenchmarkMetadata.getExecURL(for: "sw_vers")) } init(_ description: String?, _ preserveTimestamp: Bool) throws { self.timestamp = preserveTimestamp ? Date.timeIntervalSinceReferenceDate : nil self.osInfo = try BenchmarkMetadata.getOsInfo() - #if os(Windows) - self.swiftVersion = "Unknown Swift version on Windows" - #else - self.swiftVersion = try BenchmarkMetadata.run(command: BenchmarkMetadata.getExecURL(for: "swift"), - arguments: ["-version"]) - #endif + self.swiftVersion = try BenchmarkMetadata.run(command: BenchmarkMetadata.getExecURL(for: "swift"), + arguments: ["-version"]) self.swcVersion = _SWC_VERSION self.description = description } diff --git a/Sources/swcomp/Benchmarks/Benchmarks.swift b/Sources/swcomp/Benchmarks/Benchmarks.swift index 502bfe06..ee712ffe 100644 --- a/Sources/swcomp/Benchmarks/Benchmarks.swift +++ b/Sources/swcomp/Benchmarks/Benchmarks.swift @@ -3,10 +3,6 @@ // // See LICENSE for license information -#if os(Linux) - import CoreFoundation -#endif - import Foundation import SWCompression import SwiftCLI diff --git a/Sources/swcomp/Benchmarks/RunBenchmarkCommand.swift b/Sources/swcomp/Benchmarks/RunBenchmarkCommand.swift index ffa16220..7d725d7e 100644 --- a/Sources/swcomp/Benchmarks/RunBenchmarkCommand.swift +++ b/Sources/swcomp/Benchmarks/RunBenchmarkCommand.swift @@ -3,10 +3,6 @@ // // See LICENSE for license information -#if os(Linux) - import CoreFoundation -#endif - import Foundation import SwiftCLI @@ -77,9 +73,6 @@ final class RunBenchmarkCommand: Command { var squareSum = 0.0 print("Iterations: ", terminator: "") - #if !os(Linux) - fflush(__stdoutp) - #endif var iterations = [Double]() for i in 1...iterationCount { if i > 1 { @@ -87,9 +80,6 @@ final class RunBenchmarkCommand: Command { } let speed = benchmark.measure() print(benchmark.format(speed), terminator: "") - #if !os(Linux) - fflush(__stdoutp) - #endif sum += speed squareSum += speed * speed iterations.append(speed) diff --git a/Sources/swcomp/Containers/CommonFunctions.swift b/Sources/swcomp/Containers/CommonFunctions.swift index 89db6a9d..f0558482 100644 --- a/Sources/swcomp/Containers/CommonFunctions.swift +++ b/Sources/swcomp/Containers/CommonFunctions.swift @@ -68,16 +68,6 @@ func writeDirectory(_ entry: T, _ outputURL: URL, _ verbose: var attributes = [FileAttributeKey: Any]() - #if !os(Linux) // On linux only permissions attribute is supported. - if let mtime = entry.info.modificationTime { - attributes[FileAttributeKey.modificationDate] = mtime - } - - if let ctime = entry.info.creationTime { - attributes[FileAttributeKey.creationDate] = ctime - } - #endif - if let permissions = entry.info.permissions?.rawValue, permissions > 0 { attributes[FileAttributeKey.posixPermissions] = NSNumber(value: permissions) } @@ -132,16 +122,6 @@ func writeFile(_ entry: T, _ outputURL: URL, _ verbose: Bool) var attributes = [FileAttributeKey: Any]() - #if !os(Linux) // On linux only permissions attribute is supported. - if let mtime = entry.info.modificationTime { - attributes[FileAttributeKey.modificationDate] = mtime - } - - if let ctime = entry.info.creationTime { - attributes[FileAttributeKey.creationDate] = ctime - } - #endif - if let permissions = entry.info.permissions?.rawValue, permissions > 0 { attributes[FileAttributeKey.posixPermissions] = NSNumber(value: permissions) } diff --git a/Sources/swcomp/Extensions/TarEntry+Create.swift b/Sources/swcomp/Extensions/TarEntry+Create.swift index 5d0effa2..d7ed30ff 100644 --- a/Sources/swcomp/Extensions/TarEntry+Create.swift +++ b/Sources/swcomp/Extensions/TarEntry+Create.swift @@ -174,10 +174,3 @@ extension TarEntry { } } - -#if os(Linux) || os(Windows) - @discardableResult - fileprivate func autoreleasepool(_ block: () throws -> T) rethrows -> T { - return try block() - } -#endif