-
-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #833 from tuist/waltflanagan/Initial9.0Work
Update project to Swift 5.10 and start on `Sendable` updates
- Loading branch information
Showing
36 changed files
with
516 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// swift-tools-version:5.8 | ||
// swift-tools-version:5.10 | ||
|
||
import PackageDescription | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Foundation | ||
|
||
// reimplemention of `withLock` from `NSLocking` extension that is exclusive to the macOS version of `Foundation` | ||
extension NSLocking { | ||
func withLock<T>(_ body: () throws -> T) rethrows -> T { | ||
lock() | ||
defer { unlock() } | ||
return try body() | ||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 50 additions & 1 deletion
51
Sources/XcodeProj/Objects/Configuration/BuildSettings.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,53 @@ | ||
import Foundation | ||
|
||
/// Build settings. | ||
public typealias BuildSettings = [String: Any] | ||
public typealias BuildSettings = [String: BuildSetting] | ||
|
||
public enum BuildSetting: Sendable, Equatable { | ||
case string(String) | ||
case array([String]) | ||
|
||
var valueForWriting: String { | ||
switch self { | ||
case .string(let string): | ||
return string | ||
case .array(let array): | ||
return array.joined(separator: " ") | ||
} | ||
} | ||
} | ||
|
||
extension BuildSetting: Codable { | ||
public init(from decoder: Decoder) throws { | ||
let container = try decoder.singleValueContainer() | ||
do { | ||
let string = try container.decode(String.self) | ||
self = .string(string) | ||
} catch { | ||
let array = try container.decode([String].self) | ||
self = .array(array) | ||
} | ||
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.singleValueContainer() | ||
switch self { | ||
case .string(let string): | ||
try container.encode(string) | ||
case .array(let array): | ||
try container.encode(array) | ||
} | ||
} | ||
} | ||
|
||
extension BuildSetting: ExpressibleByArrayLiteral { | ||
public init(arrayLiteral elements: String...) { | ||
self = .array(elements) | ||
} | ||
} | ||
|
||
extension BuildSetting: ExpressibleByStringLiteral { | ||
public init(stringLiteral value: StringLiteralType) { | ||
self = .string(value) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.