Skip to content

Use deployment target instead of 9999 for min OS version #384

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

Merged
merged 1 commit into from
Jan 18, 2024
Merged
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
11 changes: 7 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import CompilerPluginSupport

// Availability Macros
let availabilityMacros: [SwiftSetting] = [
"FoundationPreview 0.1:macOS 9999, iOS 9999, tvOS 9999, watchOS 9999",
"FoundationPreview 0.2:macOS 9999, iOS 9999, tvOS 9999, watchOS 9999",
"FoundationPreview 0.3:macOS 9999, iOS 9999, tvOS 9999, watchOS 9999",
"FoundationPreview 0.4:macOS 9999, iOS 9999, tvOS 9999, watchOS 9999",
"FoundationPreview 0.1:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4",
"FoundationPredicate 0.1:macOS 14, iOS 17, tvOS 17, watchOS 10",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Predicate has an actual OS dependency of macOS 14 (et. al.) and higher. We use a different macro for it.

"FoundationPreview 0.2:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4",
"FoundationPreview 0.3:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4",
"FoundationPredicate 0.3:macOS 14, iOS 17, tvOS 17, watchOS 10",
"FoundationPreview 0.4:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4",
"FoundationPredicate 0.4:macOS 14, iOS 17, tvOS 17, watchOS 10",
].map { .enableExperimentalFeature("AvailabilityMacro=\($0)") }

let package = Package(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#if FOUNDATION_FRAMEWORK

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension KeyedEncodingContainer {
public mutating func encodePredicateExpression<T: PredicateExpression & Encodable, each Input>(_ expression: T, forKey key: Self.Key, variable: repeat PredicateExpressions.Variable<each Input>, predicateConfiguration: PredicateCodableConfiguration) throws where T.Output == Bool {
var container = self.nestedContainer(keyedBy: PredicateExpressionCodingKeys.self, forKey: key)
Expand All @@ -25,7 +25,7 @@ extension KeyedEncodingContainer {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension KeyedDecodingContainer {
public mutating func decodePredicateExpression<each Input>(forKey key: Self.Key, input: repeat (each Input).Type, predicateConfiguration: PredicateCodableConfiguration) throws -> (expression: any PredicateExpression<Bool>, variable: (repeat PredicateExpressions.Variable<each Input>)) {
var container = try self.nestedContainer(keyedBy: PredicateExpressionCodingKeys.self, forKey: key)
Expand All @@ -38,7 +38,7 @@ extension KeyedDecodingContainer {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension UnkeyedEncodingContainer {
public mutating func encodePredicateExpression<T: PredicateExpression & Encodable, each Input>(_ expression: T, variable: repeat PredicateExpressions.Variable<each Input>, predicateConfiguration: PredicateCodableConfiguration) throws where T.Output == Bool {
var container = self.nestedContainer(keyedBy: PredicateExpressionCodingKeys.self)
Expand All @@ -54,7 +54,7 @@ extension UnkeyedEncodingContainer {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension UnkeyedDecodingContainer {
public mutating func decodePredicateExpression<each Input>(input: repeat (each Input).Type, predicateConfiguration: PredicateCodableConfiguration) throws -> (expression: any PredicateExpression<Bool>, variable: (repeat PredicateExpressions.Variable<each Input>)) {
var container = try self.nestedContainer(keyedBy: PredicateExpressionCodingKeys.self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@_implementationOnly
import ReflectionInternal

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
enum PredicateCodableError : Error, CustomStringConvertible {
case disallowedType(typeName: String, path: String)
case disallowedIdentifier(String, path: String)
Expand All @@ -32,7 +32,7 @@ enum PredicateCodableError : Error, CustomStringConvertible {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
private struct ExpressionStructure : Codable {
let identifier: String
let args: [ExpressionStructure]
Expand Down Expand Up @@ -115,7 +115,7 @@ private struct ExpressionStructure : Codable {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
class PredicateArchivingState {
let configuration: PredicateCodableConfiguration

Expand All @@ -136,7 +136,7 @@ class PredicateArchivingState {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension _ThreadLocal.Key<PredicateArchivingState> {
static let predicateArchivingState = Self<PredicateArchivingState>()
}
Expand All @@ -147,7 +147,7 @@ enum PredicateExpressionCodingKeys : CodingKey {
case structure
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
fileprivate extension PredicateCodableConfiguration {
mutating func allowInputs<each Input>(_ input: repeat (each Input).Type) {
var inputTypes = [Any.Type]()
Expand All @@ -158,7 +158,7 @@ fileprivate extension PredicateCodableConfiguration {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension KeyedEncodingContainer where Key == PredicateExpressionCodingKeys {
mutating func _encode<T: PredicateExpression & Encodable, each Input>(_ expression: T, variable: repeat PredicateExpressions.Variable<each Input>, predicateConfiguration: PredicateCodableConfiguration) throws where T.Output == Bool {
var predicateConfiguration = predicateConfiguration
Expand All @@ -174,7 +174,7 @@ extension KeyedEncodingContainer where Key == PredicateExpressionCodingKeys {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension KeyedDecodingContainer where Key == PredicateExpressionCodingKeys {
mutating func _decode<each Input>(input: repeat (each Input).Type, predicateConfiguration: PredicateCodableConfiguration) throws -> (expression: any PredicateExpression<Bool>, variable: (repeat PredicateExpressions.Variable<each Input>)) {
var predicateConfiguration = predicateConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#if FOUNDATION_FRAMEWORK

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension Predicate : Codable {
public func encode(to encoder: Encoder) throws {
try self.encode(to: encoder, configuration: .standardConfiguration)
Expand All @@ -23,7 +23,7 @@ extension Predicate : Codable {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension Predicate : CodableWithConfiguration {
public typealias EncodingConfiguration = PredicateCodableConfiguration
public typealias DecodingConfiguration = PredicateCodableConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
@_implementationOnly
import ReflectionInternal

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
public protocol PredicateCodableKeyPathProviding {
static var predicateCodableKeyPaths : [String : PartialKeyPath<Self>] { get }
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
public struct PredicateCodableConfiguration: Sendable, CustomDebugStringConvertible {
enum AllowListType : Equatable, Sendable {
case concrete(Type)
Expand Down Expand Up @@ -257,7 +257,7 @@ public struct PredicateCodableConfiguration: Sendable, CustomDebugStringConverti
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateCodableConfiguration {
func _identifier(for keyPath: AnyKeyPath) -> String? {
let concreteIdentifier = allowedKeyPaths.first {
Expand Down Expand Up @@ -331,7 +331,7 @@ extension PredicateCodableConfiguration {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateCodableConfiguration {
public static let standardConfiguration: Self = {
var configuration = Self()
Expand Down
28 changes: 14 additions & 14 deletions Sources/FoundationEssentials/Predicate/Expression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
//
//===----------------------------------------------------------------------===//

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
public protocol PredicateExpression<Output> {
associatedtype Output

func evaluate(_ bindings: PredicateBindings) throws -> Output
}

// Only Foundation should add conformances to this protocol
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
public protocol StandardPredicateExpression<Output> : PredicateExpression, Codable, Sendable {}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
public struct PredicateError: Error, Hashable, CustomDebugStringConvertible {
internal enum _Error: Hashable, Sendable {
case undefinedVariable
Expand Down Expand Up @@ -77,7 +77,7 @@ public struct PredicateError: Error, Hashable, CustomDebugStringConvertible {
public static let invalidInput = Self(.invalidInput(nil))
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions {
public struct VariableID: Hashable, Codable, Sendable {
let id: UInt
Expand Down Expand Up @@ -166,7 +166,7 @@ extension PredicateExpressions {

}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.KeyPath : Codable where Root : Codable {
private enum CodingKeys : CodingKey {
case root
Expand Down Expand Up @@ -203,20 +203,20 @@ extension PredicateExpressions.KeyPath : Codable where Root : Codable {
#endif // FOUNDATION_FRAMEWORK
}
}
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.KeyPath : Sendable where Root : Sendable {}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.KeyPath : StandardPredicateExpression where Root : StandardPredicateExpression {}

@available(FoundationPreview 0.3, *)
@available(FoundationPredicate 0.3, *)
extension PredicateExpressions.KeyPath : CustomStringConvertible {
public var description: String {
"KeyPath(root: \(root), keyPath: \(keyPath.debugDescription))"
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.Value : Codable where Output : Codable {
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
Expand All @@ -229,13 +229,13 @@ extension PredicateExpressions.Value : Codable where Output : Codable {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.Value : Sendable where Output : Sendable {}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.Value : StandardPredicateExpression where Output : Codable /*, Output : Sendable*/ {}

@available(FoundationPreview 0.3, *)
@available(FoundationPredicate 0.3, *)
extension PredicateExpressions.Value : CustomStringConvertible {
public var description: String {
var result = "Value<\(_typeName(Output.self))>("
Expand All @@ -244,14 +244,14 @@ extension PredicateExpressions.Value : CustomStringConvertible {
}
}

@available(FoundationPreview 0.3, *)
@available(FoundationPredicate 0.3, *)
extension PredicateExpressions.Variable : CustomStringConvertible {
public var description: String {
"Variable(\(key.id))"
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.KeyPath {
public enum CommonKeyPathKind : Hashable, Sendable {
case collectionCount
Expand Down
20 changes: 10 additions & 10 deletions Sources/FoundationEssentials/Predicate/Expressions/Aggregate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions {
public struct SequenceMaximum<
Elements : PredicateExpression
Expand All @@ -36,23 +36,23 @@ extension PredicateExpressions {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.SequenceMaximum : StandardPredicateExpression where Elements : StandardPredicateExpression {}

@available(FoundationPreview 0.3, *)
@available(FoundationPredicate 0.3, *)
extension PredicateExpressions.SequenceMaximum : CustomStringConvertible {
public var description: String {
"SequenceMaximum(elements: \(elements))"
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.SequenceMaximum : Codable where Elements : Codable {}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.SequenceMaximum : Sendable where Elements : Sendable {}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions {
public struct SequenceMinimum<
Elements : PredicateExpression
Expand All @@ -78,18 +78,18 @@ extension PredicateExpressions {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.SequenceMinimum : StandardPredicateExpression where Elements : StandardPredicateExpression {}

@available(FoundationPreview 0.3, *)
@available(FoundationPredicate 0.3, *)
extension PredicateExpressions.SequenceMinimum : CustomStringConvertible {
public var description: String {
"SequenceMinimum(elements: \(elements))"
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.SequenceMinimum : Codable where Elements : Codable {}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.SequenceMinimum : Sendable where Elements : Sendable {}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions {
public enum ArithmeticOperator: Codable, Sendable {
case add, subtract, multiply
Expand Down Expand Up @@ -53,17 +53,17 @@ extension PredicateExpressions {
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.Arithmetic : StandardPredicateExpression where LHS : StandardPredicateExpression, RHS : StandardPredicateExpression {}

@available(FoundationPreview 0.3, *)
@available(FoundationPredicate 0.3, *)
extension PredicateExpressions.Arithmetic : CustomStringConvertible {
public var description: String {
"Arithmetic(lhs: \(lhs), operator: \(op), rhs: \(rhs))"
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.Arithmetic : Codable where LHS : Codable, RHS : Codable {
public func encode(to encoder: Encoder) throws {
var container = encoder.unkeyedContainer()
Expand All @@ -80,5 +80,5 @@ extension PredicateExpressions.Arithmetic : Codable where LHS : Codable, RHS : C
}
}

@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
@available(FoundationPredicate 0.1, *)
extension PredicateExpressions.Arithmetic : Sendable where LHS : Sendable, RHS : Sendable {}
Loading