Skip to content
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

Drop iOS/tvOS 9-11, watchOS 3-4, macOS 10.10-10.13 support #1605

Merged
merged 7 commits into from
Jan 11, 2021
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
8 changes: 4 additions & 4 deletions Apollo.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Pod::Spec.new do |s|

s.default_subspecs = 'Core'

s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '9.1'
s.watchos.deployment_target = '3.0'
s.ios.deployment_target = '12.0'
s.osx.deployment_target = '10.14'
s.tvos.deployment_target = '12.0'
s.watchos.deployment_target = '5.0'

s.subspec 'Core' do |ss|
ss.source_files = 'Sources/Apollo/*.swift','Sources/ApolloCore/*.swift'
Expand Down
4 changes: 0 additions & 4 deletions Apollo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@
9F27D4641D40379500715680 /* JSONStandardTypeConversions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F27D4631D40379500715680 /* JSONStandardTypeConversions.swift */; };
9F295E311E27534800A24949 /* NormalizeQueryResults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F295E301E27534800A24949 /* NormalizeQueryResults.swift */; };
9F295E381E277B2A00A24949 /* GraphQLResultNormalizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F295E371E277B2A00A24949 /* GraphQLResultNormalizer.swift */; };
9F30F02F255EDF8900506DE7 /* DispatchPreconditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F30F02E255EDF8900506DE7 /* DispatchPreconditions.swift */; };
9F39101725493DDC00AF54A6 /* FetchQueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA6ABC51EC0A9F7000017BE /* FetchQueryTests.swift */; };
9F3910272549741400AF54A6 /* MockGraphQLServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F3910262549741400AF54A6 /* MockGraphQLServer.swift */; };
9F438D071E6C2FD9007BDC1A /* Apollo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC750441D2A532C00458D91 /* Apollo.framework */; };
Expand Down Expand Up @@ -740,7 +739,6 @@
9F27D4631D40379500715680 /* JSONStandardTypeConversions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONStandardTypeConversions.swift; sourceTree = "<group>"; };
9F295E301E27534800A24949 /* NormalizeQueryResults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NormalizeQueryResults.swift; sourceTree = "<group>"; };
9F295E371E277B2A00A24949 /* GraphQLResultNormalizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphQLResultNormalizer.swift; sourceTree = "<group>"; };
9F30F02E255EDF8900506DE7 /* DispatchPreconditions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DispatchPreconditions.swift; sourceTree = "<group>"; };
9F33D6A32566475600A1543F /* PossiblyDeferred.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PossiblyDeferred.swift; sourceTree = "<group>"; };
9F3910262549741400AF54A6 /* MockGraphQLServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockGraphQLServer.swift; sourceTree = "<group>"; };
9F438D0B1E6C494C007BDC1A /* BatchedLoadTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BatchedLoadTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1193,7 +1191,6 @@
isa = PBXGroup;
children = (
9B6CB23D238077B60007259D /* Atomic.swift */,
9F30F02E255EDF8900506DE7 /* DispatchPreconditions.swift */,
9B68F06E241C649E00E97318 /* GraphQLOptional.swift */,
9B455CE82492D0A7002255A9 /* Extensions */,
);
Expand Down Expand Up @@ -2418,7 +2415,6 @@
9B455CE52492D0A3002255A9 /* ApolloExtension.swift in Sources */,
9B455CEB2492FB03002255A9 /* String+SHA.swift in Sources */,
9B455CE62492D0A3002255A9 /* OptionalBoolean.swift in Sources */,
9F30F02F255EDF8900506DE7 /* DispatchPreconditions.swift in Sources */,
9B455CDF2492D05E002255A9 /* Atomic.swift in Sources */,
9B455CE72492D0A3002255A9 /* Collection+Apollo.swift in Sources */,
);
Expand Down
16 changes: 8 additions & 8 deletions Configuration/Shared/Workspace-Deployment-Targets.xcconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Base Deployment Targets
IPHONEOS_DEPLOYMENT_TARGET = 9.0
MACOSX_DEPLOYMENT_TARGET = 10.10
TVOS_DEPLOYMENT_TARGET = 9.1
WATCHOS_DEPLOYMENT_TARGET = 3.0
IPHONEOS_DEPLOYMENT_TARGET = 12.0
MACOSX_DEPLOYMENT_TARGET = 10.14
TVOS_DEPLOYMENT_TARGET = 12.0
WATCHOS_DEPLOYMENT_TARGET = 5.0

WARNING_CFLAGS[sdk=iphone*] = $(inherited) -DAPI_TO_BE_DEPRECATED=8_0
WARNING_CFLAGS[sdk=macosx*] = $(inherited) -DAPI_TO_BE_DEPRECATED=10_10
WARNING_CFLAGS[sdk=tvos*] = $(inherited) -DAPI_TO_BE_DEPRECATED=9_1
WARNING_CFLAGS[sdk=watchos*] = $(inherited) -DAPI_TO_BE_DEPRECATED=3_0
WARNING_CFLAGS[sdk=iphone*] = $(inherited) -DAPI_TO_BE_DEPRECATED=12_0
WARNING_CFLAGS[sdk=macosx*] = $(inherited) -DAPI_TO_BE_DEPRECATED=10_14
WARNING_CFLAGS[sdk=tvos*] = $(inherited) -DAPI_TO_BE_DEPRECATED=12_0
WARNING_CFLAGS[sdk=watchos*] = $(inherited) -DAPI_TO_BE_DEPRECATED=5_0

// macOS-specific default settings
COMBINE_HIDPI_IMAGES[sdk=macosx*] = YES
Expand Down
6 changes: 6 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import PackageDescription

let package = Package(
name: "Apollo",
platforms: [
.iOS(.v12),
.macOS(.v10_14),
.tvOS(.v12),
.watchOS(.v5)
],
products: [
.library(
name: "ApolloCore",
Expand Down
2 changes: 1 addition & 1 deletion Sources/Apollo/GraphQLGETTransformer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct GraphQLGETTransformer {
do {
_ = try self.body.sorted(by: {$0.key < $1.key}).compactMap({ arg in
if let value = arg.value as? GraphQLMap {
let data = try JSONSerialization.dataSortedIfPossible(withJSONObject: value.jsonValue)
let data = try JSONSerialization.sortedData(withJSONObject: value.jsonValue)
if let string = String(data: data, encoding: .utf8) {
queryItems.append(URLQueryItem(name: arg.key, value: string))
}
Expand Down
23 changes: 3 additions & 20 deletions Sources/Apollo/JSONSerialization+Sorting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,12 @@ import Foundation

extension JSONSerialization {

/// Uses `sortedKeys` to create a stable representation of JSON objects when the operating system supports it.
/// Uses `sortedKeys` to create a stable representation of JSON objects.
///
/// - Parameter object: The object to serialize
/// - Returns: The serialized data
/// - Throws: Errors related to the serialization of data.
static func dataSortedIfPossible(withJSONObject object: Any) throws -> Data {
// The `sortedKeys` option is not available on all platforms we
// presently support, but we should use it where we can in
// order to get stable JSON representations, especially if being
// used in queries.
if #available(iOS 11, macOS 10.13, watchOS 4, tvOS 11, *) {
return try self.data(withJSONObject: object, options: [.sortedKeys])
} else {
return try self.data(withJSONObject: object)
}
}

/// Wrapper function so we don't have to scatter `if #available` all over the codebase to see if data can be sorted.
static func dataCanBeSorted() -> Bool {
if #available(iOS 11, macOS 10.13, watchOS 4, tvOS 11, *) {
return true
} else {
return false
}
static func sortedData(withJSONObject object: Any) throws -> Data {
return try self.data(withJSONObject: object, options: [.sortedKeys])
}
}
2 changes: 1 addition & 1 deletion Sources/Apollo/JSONSerializationFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation

public final class JSONSerializationFormat {
public class func serialize(value: JSONEncodable) throws -> Data {
return try JSONSerialization.dataSortedIfPossible(withJSONObject: value.jsonValue)
return try JSONSerialization.sortedData(withJSONObject: value.jsonValue)
}

public class func deserialize(data: Data) throws -> JSONValue {
Expand Down
3 changes: 0 additions & 3 deletions Sources/Apollo/URLSessionClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ open class URLSessionClient: NSObject, URLSessionDelegate, URLSessionTaskDelegat
self.clearAllTasks()
}

@available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
open func urlSession(_ session: URLSession,
task: URLSessionTask,
didFinishCollecting metrics: URLSessionTaskMetrics) {
Expand Down Expand Up @@ -234,7 +233,6 @@ open class URLSessionClient: NSObject, URLSessionDelegate, URLSessionTaskDelegat
// No default implementation
}

@available(iOS 11.0, OSXApplicationExtension 10.13, OSX 10.13, tvOS 11.0, watchOS 4.0, *)
open func urlSession(_ session: URLSession,
task: URLSessionTask,
willBeginDelayedRequest request: URLRequest,
Expand Down Expand Up @@ -265,7 +263,6 @@ open class URLSessionClient: NSObject, URLSessionDelegate, URLSessionTaskDelegat
}
}

@available(iOS 9.0, OSXApplicationExtension 10.11, OSX 10.11, *)
open func urlSession(_ session: URLSession,
dataTask: URLSessionDataTask,
didBecome streamTask: URLSessionStreamTask) {
Expand Down
13 changes: 3 additions & 10 deletions Sources/ApolloCodegenLib/Basher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,10 @@ public struct Basher {
]
task.launchPath = "/bin/bash"

if #available(OSX 10.13, *) {
if let url = url {
task.currentDirectoryURL = url
}
try task.run()
} else {
if let path = url?.path {
task.currentDirectoryPath = path
}
task.launch()
if let url = url {
task.currentDirectoryURL = url
}
try task.run()

task.waitUntilExit()

Expand Down
13 changes: 0 additions & 13 deletions Sources/ApolloCore/DispatchPreconditions.swift

This file was deleted.

43 changes: 35 additions & 8 deletions SwiftScripts/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"object": {
"pins": [
{
"package": "Commandant",
"repositoryURL": "https://github.com/Carthage/Commandant.git",
"state": {
"branch": null,
"revision": "ab68611013dec67413628ac87c1f29e8427bc8e4",
"version": "0.17.0"
}
},
{
"package": "InflectorKit",
"repositoryURL": "https://github.com/apollographql/InflectorKit",
Expand All @@ -19,6 +28,15 @@
"version": "0.5.0"
}
},
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble.git",
"state": {
"branch": null,
"revision": "72f5a90d573f7f7d70aa6b8ad84b3e1e02eabb4d",
"version": "8.0.9"
}
},
{
"package": "PathKit",
"repositoryURL": "https://github.com/kylef/PathKit.git",
Expand All @@ -37,13 +55,22 @@
"version": "1.1.0"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick.git",
"state": {
"branch": null,
"revision": "09b3becb37cb2163919a3842a4c5fa6ec7130792",
"version": "2.2.1"
}
},
{
"package": "Rainbow",
"repositoryURL": "https://github.com/onevcat/Rainbow",
"state": {
"branch": null,
"revision": "626c3d4b6b55354b4af3aa309f998fae9b31a3d9",
"version": "3.2.0"
"revision": "9c52c1952e9b2305d4507cf473392ac2d7c9b155",
"version": "3.1.5"
}
},
{
Expand All @@ -60,17 +87,17 @@
"repositoryURL": "https://github.com/jpsim/SourceKitten.git",
"state": {
"branch": null,
"revision": "7f4be006fe73211b0fd9666c73dc2f2303ffa756",
"version": "0.31.0"
"revision": "77a4dbbb477a8110eb8765e3c44c70fb4929098f",
"version": "0.29.0"
}
},
{
"package": "Spectre",
"repositoryURL": "https://github.com/kylef/Spectre.git",
"state": {
"branch": null,
"revision": "f79d4ecbf8bc4e1579fbd86c3e1d652fb6876c53",
"version": "0.9.2"
"revision": "f14ff47f45642aa5703900980b014c2e9394b6e5",
"version": "0.9.0"
}
},
{
Expand Down Expand Up @@ -150,8 +177,8 @@
"repositoryURL": "https://github.com/jpsim/Yams.git",
"state": {
"branch": null,
"revision": "1bce5b89a11912fb8a8c48bd404bd24979472f27",
"version": "4.0.3"
"revision": "c947a306d2e80ecb2c0859047b35c73b8e1ca27f",
"version": "2.0.0"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion SwiftScripts/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PackageDescription
let package = Package(
name: "Codegen",
platforms: [
.macOS(.v10_13)
.macOS(.v10_14)
],
dependencies: [
.package(name: "Apollo", path: ".."),
Expand Down
Loading