Skip to content

Commit

Permalink
Sendable (#9)
Browse files Browse the repository at this point in the history
* Added Sendable
* Update GHTestCase.swift
* Added @unchecked Sendable

@unchecked Sendable is used to hide warnings that URL and Data do not support Sendable. This may happen depending on the Foundation version
  • Loading branch information
Alexander-Ignition authored Jan 5, 2023
1 parent 0b2ee04 commit 5a92132
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Sources/XSTooling/Core/ProcessCommand.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public struct ProcessCommand: Hashable {
public struct ProcessCommand: Hashable, @unchecked Sendable {
public static func find(_ name: String) -> ProcessCommand? {
guard let string = ProcessInfo.processInfo.environment["PATH"] else {
return nil
Expand Down
2 changes: 1 addition & 1 deletion Sources/XSTooling/Core/ProcessOutput.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

/// Output of the process execution.
public struct ProcessOutput: Hashable {
public struct ProcessOutput: Hashable, @unchecked Sendable {
/// Constants that specify the termination reason values that the system returns.
public typealias TerminationReason = Process.TerminationReason

Expand Down
2 changes: 1 addition & 1 deletion Sources/XSTooling/Shell.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public struct Shell: Equatable {
public struct Shell: Equatable, Sendable {
/// The default shell.
public static var `default`: Shell {
let path = ProcessInfo.processInfo.environment["SHELL"]
Expand Down
14 changes: 7 additions & 7 deletions Sources/XSTooling/Simctl.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Command line utility to control the Simulator.
public struct Simctl: Equatable {
public struct Simctl: Equatable, Sendable {
public var command: ProcessCommand

public init(command: ProcessCommand) {
Expand All @@ -14,7 +14,7 @@ public struct Simctl: Equatable {
DeviceControl(simulator: self, udid: uuid)
}

public struct DeviceControl {
public struct DeviceControl: Sendable {
let simulator: Simctl
let udid: String

Expand All @@ -38,7 +38,7 @@ public struct Simctl: Equatable {
}
}

public struct ApplicationControl {
public struct ApplicationControl: Sendable {
let device: DeviceControl
let bundleIdentifier: String

Expand All @@ -59,7 +59,7 @@ public struct Simctl: Equatable {
}

/// Installed app's container.
public struct Container {
public struct Container: Sendable {
let application: ApplicationControl

/// The .app bundle.
Expand Down Expand Up @@ -115,7 +115,7 @@ extension Simctl {
return ListQuery(command: command.appending(arguments: arguments))
}

public struct ListQuery<Format> {
public struct ListQuery<Format>: Sendable {
public var command: ProcessCommand

public func read() async throws -> ProcessOutput {
Expand Down Expand Up @@ -182,7 +182,7 @@ extension Simctl {
}
}

public struct DeviceInfo: Codable, Equatable {
public struct DeviceInfo: Codable, Equatable, Sendable {
public let dataPath: String
public let logPath: String
public let udid: String
Expand All @@ -192,7 +192,7 @@ extension Simctl {
public let name: String
}

public struct DeviceType: Codable, Equatable {
public struct DeviceType: Codable, Equatable, Sendable {
public let minRuntimeVersion: Int
public let bundlePath: String
public let maxRuntimeVersion: Int
Expand Down
2 changes: 1 addition & 1 deletion Sources/XSTooling/XCRun.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Run or locate development tools and properties.
public struct XCRun: Equatable {
public struct XCRun: Equatable, Sendable {
public var command: ProcessCommand

public init(path: String = "/usr/bin/xcrun") {
Expand Down
5 changes: 3 additions & 2 deletions Tests/XSToolingTests/GHTest/GHTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ class GHTestCase: XCTestCase {

override func record(_ issue: XCTIssue) {
if github.isEnabled {
let message = "\(self.name): \(issue.compactDescription)"
if let location = issue.sourceCodeContext.location {
github.error(file: location.fileURL.absoluteString, line: location.lineNumber, message: issue.compactDescription)
github.error(file: location.fileURL.absoluteString, line: location.lineNumber, message: message)
} else {
github.error(message: issue.compactDescription)
github.error(message: message)
}
}
super.record(issue)
Expand Down

0 comments on commit 5a92132

Please sign in to comment.