Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
import Foundation
import ArgumentParser

#if canImport(FoundationNetworking)
import FoundationNetworking // Required on Linux
#endif

nonisolated(unsafe) private var VERBOSE_ENABLED: Bool = false // Set once in `validate(verbose:)`, read once for `verboseEnabled`.
func verbosePrint(_ items: Any..., additionalCondition: Bool = true, separator: String = " ", terminator: String = "\n\n") {
if verboseEnabled && additionalCondition { print(items, separator: separator, terminator: terminator) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct EvolutionMetadataExtractor {
implementationVersionSet.insert(version)
}
}
let implementationVersions = implementationVersionSet.sorted(using: SortDescriptor(\.self))
let implementationVersions = implementationVersionSet.sorted { $0.compare($1, options: .numeric) == .orderedAscending }

verbosePrint("Implementation Versions:", implementationVersions)
let formattedExtractionDate = extractionJob.jobMetadata.extractionDate.formatted(.iso8601)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@

import Foundation

#if canImport(FoundationNetworking)
import FoundationNetworking // Required for Linux
#endif

// Declare Core Foundation constants not available on Linux
#if os(Linux)
let kCFNetworkProxiesHTTPEnable = "HTTPEnable"
let kCFNetworkProxiesHTTPProxy = "HTTPProxy"
let kCFNetworkProxiesHTTPPort = "HTTPPort"
let kCFNetworkProxiesHTTPSEnable = "HTTPSEnable"
let kCFNetworkProxiesHTTPSProxy = "HTTPSProxy"
let kCFNetworkProxiesHTTPSPort = "HTTPSPort"
#endif // os(Linux)

// Dictionary extension accepts an array of keys to search for.
// The first key found returns a tuple of the key and its value.
// Used to find acceptable name variations in headers and environment variables.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
import Foundation
import EvolutionMetadataModel

#if canImport(FoundationNetworking)
import FoundationNetworking // Required for Linux
#endif

struct PreviousResultsFetcher {

static let previousResultsURL = URL(string: "https://download.swift.org/swift-evolution/v1/evolution.json")!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ struct Snapshot {
guard addedFilenames.isEmpty else { fatalError("Not all files copied: \(addedFilenames)") }
}

#if os(Linux)
try FileManager.default.createDirectory(at: outputURL.deletingLastPathComponent(), withIntermediateDirectories: true)
try FileManager.default.moveItem(at: temporarySnapshotDirectory, to: outputURL)
#else
try FileManager.default.createDirectory(at: outputURL, withIntermediateDirectories: true)
_ = try FileManager.default.replaceItemAt(outputURL, withItemAt: temporarySnapshotDirectory, options: [.usingNewMetadataOnly])
#endif
}
}