-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempt to make ResilientDecoding work with Swift Concurrency #53
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,31 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// swift-tools-version:5.8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import PackageDescription | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
let package = Package( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: "ResilientDecoding", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
platforms: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.iOS(.v12), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.tvOS(.v12), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.watchOS(.v5), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.macOS(.v10_14), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
products: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.library( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: "ResilientDecoding", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
targets: ["ResilientDecoding"]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
targets: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.target( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: "ResilientDecoding", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dependencies: []), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.testTarget( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: "ResilientDecodingTests", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dependencies: ["ResilientDecoding"]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for target in package.targets { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var settings = target.swiftSettings ?? [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settings.append(.enableExperimentalFeature("StrictConcurrency")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
target.swiftSettings = settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're intending this file to be swift tools version 5.8, I'd recommend writing this as:
Suggested change
Note that this is an upcoming rather than experimental feature. In tools version 5.7, you indeed do need to call this experimental IIRC. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With 5.8, this is still considered an experimental feature, so we need to keep it as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Welp I may have some code in my own projects to update then |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,12 +234,12 @@ public struct UnknownNovelValueError: Error { | |
/** | ||
The raw value for which `init(rawValue:)` returned `nil`. | ||
*/ | ||
public let novelValue: Any | ||
public let novelValue: Sendable | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth noting that this is a breaking change, and we should update the sample dependency management code in the README to match. Podspec needs bumping too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For sure, I see this being a minor version bump at a minimum. |
||
|
||
/** | ||
- parameter novelValue: A value which is believed to be valid but the code does not know how to handle. | ||
*/ | ||
public init<T>(novelValue: T) { | ||
public init<T: Sendable>(novelValue: T) { | ||
self.novelValue = novelValue | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this swift tools version does not align with the name of this package file.