Skip to content

Commit 493bb45

Browse files
committed
fixing a few linux issues
1 parent 7baa221 commit 493bb45

File tree

4 files changed

+16
-38
lines changed

4 files changed

+16
-38
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ let package = Package(
9191
.executable(name: "bushel-cloud", targets: ["BushelCloudCLI"])
9292
],
9393
dependencies: [
94-
.package(url: "https://github.com/brightdigit/MistKit.git", from: "1.0.0-alpha.3"),
94+
.package(url: "https://github.com/brightdigit/MistKit.git", from: "1.0.0-alpha.3"),
9595
.package(url: "https://github.com/brightdigit/BushelKit.git", branch: "v3.0.0-alpha.2"),
9696
.package(url: "https://github.com/brightdigit/IPSWDownloads.git", from: "1.0.0"),
9797
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.6.0"),

Sources/BushelCloudKit/DataSources/TheAppleWiki/TheAppleWikiFetcher.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ internal struct TheAppleWikiFetcher: DataSourceFetcher, Sendable {
4747
let apiURL = URL(
4848
string: "https://theapplewiki.com/api.php?action=parse&page=Firmware/Mac&format=json")!
4949

50-
let lastModified: Date
50+
let lastModified: Date?
5151
#if canImport(FoundationNetworking)
5252
// Use FoundationNetworking.URLSession directly on Apple platforms
5353
let URLSession = FoundationNetworking.URLSession.self
5454
#endif
55-
lastModified = await URLSession.shared.fetchLastModified(from: apiURL) ?? Date()
55+
lastModified = await URLSession.shared.fetchLastModified(from: apiURL)
5656

5757
let parser = IPSWParser()
5858

Sources/BushelCloudKit/DataSources/VirtualBuddyFetcher.swift

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ struct VirtualBuddyFetcher: DataSourceFetcher, Sendable {
4141
typealias Record = [RestoreImageRecord]
4242

4343
/// Base URL components for VirtualBuddy TSS API endpoint
44-
private static let baseURLComponents = URLComponents(string: "https://tss.virtualbuddy.app/v1/status")!
44+
private static let baseURLComponents = URLComponents(
45+
string: "https://tss.virtualbuddy.app/v1/status")!
4546

4647
private let apiKey: String
4748
private let decoder: JSONDecoder
@@ -52,29 +53,19 @@ struct VirtualBuddyFetcher: DataSourceFetcher, Sendable {
5253
guard let key = ProcessInfo.processInfo.environment["VIRTUALBUDDY_API_KEY"], !key.isEmpty else {
5354
return nil
5455
}
55-
self.apiKey = key
56-
self.decoder = JSONDecoder()
57-
#if canImport(FoundationNetworking)
58-
self.urlSession = FoundationNetworking.URLSession.shared
59-
#else
60-
self.urlSession = URLSession.shared
61-
#endif
56+
self.init(apiKey: key)
6257
}
6358

6459
/// Explicit initializer with API key
6560
init(apiKey: String, decoder: JSONDecoder = JSONDecoder(), urlSession: URLSession = .shared) {
6661
self.apiKey = apiKey
6762
self.decoder = decoder
68-
#if canImport(FoundationNetworking)
69-
self.urlSession = FoundationNetworking.URLSession.shared
70-
#else
71-
self.urlSession = urlSession
72-
#endif
63+
self.urlSession = urlSession
7364
}
7465

7566
/// DataSourceFetcher protocol requirement - returns empty for enrichment fetchers
7667
func fetch() async throws -> [RestoreImageRecord] {
77-
return []
68+
[]
7869
}
7970

8071
/// Enrich existing restore images with VirtualBuddy TSS signing status
@@ -117,11 +108,15 @@ struct VirtualBuddyFetcher: DataSourceFetcher, Sendable {
117108
// Show result with signing status
118109
let statusEmoji = response.isSigned ? "" : ""
119110
let statusText = response.isSigned ? "signed" : "unsigned"
120-
print(" \(statusEmoji) VirtualBuddy: \(image.buildNumber) - \(statusText) (\(processedCount)/\(totalCount))")
111+
print(
112+
" \(statusEmoji) VirtualBuddy: \(image.buildNumber) - \(statusText) (\(processedCount)/\(totalCount))"
113+
)
121114

122115
enrichedImages.append(enriched)
123116
} catch {
124-
print(" ⚠️ VirtualBuddy: \(image.buildNumber) - error: \(error) (\(processedCount)/\(totalCount))")
117+
print(
118+
" ⚠️ VirtualBuddy: \(image.buildNumber) - error: \(error) (\(processedCount)/\(totalCount))"
119+
)
125120
enrichedImages.append(image) // Keep original on error
126121
}
127122

@@ -142,7 +137,7 @@ struct VirtualBuddyFetcher: DataSourceFetcher, Sendable {
142137
var components = Self.baseURLComponents
143138
components.queryItems = [
144139
URLQueryItem(name: "apiKey", value: apiKey),
145-
URLQueryItem(name: "ipsw", value: ipswURL.absoluteString)
140+
URLQueryItem(name: "ipsw", value: ipswURL.absoluteString),
146141
]
147142

148143
guard let endpointURL = components.url else {
@@ -153,11 +148,7 @@ struct VirtualBuddyFetcher: DataSourceFetcher, Sendable {
153148
let data: Data
154149
let response: URLResponse
155150
do {
156-
#if canImport(FoundationNetworking)
157-
(data, response) = try await urlSession.data(from: endpointURL)
158-
#else
159-
(data, response) = try await urlSession.data(from: endpointURL)
160-
#endif
151+
(data, response) = try await urlSession.data(from: endpointURL)
161152
} catch {
162153
throw VirtualBuddyFetcherError.networkError(error)
163154
}

project.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,3 @@ aggregateTargets:
1111
name: Lint
1212
basedOnDependencyAnalysis: false
1313
schemes: {}
14-
schemes:
15-
BushelCloud-Package:
16-
build:
17-
targets:
18-
BushelCloud-Package: all
19-
test:
20-
gatherCoverageData: true
21-
coverageTargets:
22-
- BushelCloudKit
23-
targets:
24-
- name: BushelCloudTests
25-
parallelizable: true
26-
randomExecutionOrder: true

0 commit comments

Comments
 (0)