Browse Source

Explicitly link CFNetwork when using SPM (#3259)

* Add CFNetwork as an explicitly linked framework for Apple platforms.

* Updated formatting.
Jon Shier 5 years ago
parent
commit
94a8bf78e8
3 changed files with 24 additions and 19 deletions
  1. 6 1
      Package.swift
  2. 2 2
      Tests/CacheTests.swift
  3. 16 16
      Tests/CombineTests.swift

+ 6 - 1
Package.swift

@@ -33,7 +33,12 @@ let package = Package(name: "Alamofire",
                       products: [.library(name: "Alamofire",
                                           targets: ["Alamofire"])],
                       targets: [.target(name: "Alamofire",
-                                        path: "Source"),
+                                        path: "Source",
+                                        linkerSettings: [.linkedFramework("CFNetwork",
+                                                                          .when(platforms: [.iOS,
+                                                                                            .macOS,
+                                                                                            .tvOS,
+                                                                                            .watchOS]))]),
                                 .testTarget(name: "AlamofireTests",
                                             dependencies: ["Alamofire"],
                                             path: "Tests")],

+ 2 - 2
Tests/CacheTests.swift

@@ -143,7 +143,7 @@ class CacheTestCase: BaseTestCase {
                                            self.timestamps[cacheControl] = timestamp
 
                                            dispatchGroup.leave()
-            })
+                                       })
 
             requests[cacheControl] = request
         }
@@ -189,7 +189,7 @@ class CacheTestCase: BaseTestCase {
         request.response(queue: queue,
                          completionHandler: { response in
                              completion(response.request, response.response)
-        })
+                         })
 
         return urlRequest
     }

+ 16 - 16
Tests/CombineTests.swift

@@ -283,7 +283,7 @@ final class DataRequestCombineTests: CombineTestCase {
                           receivedOnMain = Thread.isMainThread
                           response = $0
                           responseReceived.fulfill()
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -341,7 +341,7 @@ final class DataRequestCombineTests: CombineTestCase {
                           receivedOnMain = Thread.isMainThread
                           response = $0
                           responseReceived.fulfill()
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -489,7 +489,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                           case .complete:
                               responseReceived.fulfill()
                           }
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -518,7 +518,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                           case .complete:
                               responseReceived.fulfill()
                           }
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -546,7 +546,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                           case .complete:
                               responseReceived.fulfill()
                           }
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -574,7 +574,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                           case .complete:
                               responseReceived.fulfill()
                           }
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -612,7 +612,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                           case .complete:
                               publishedResponseReceived.fulfill()
                           }
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -638,7 +638,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                       receiveValue: { received in
                           result = received
                           responseReceived.fulfill()
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -663,7 +663,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                       receiveValue: { received in
                           result = received
                           responseReceived.fulfill()
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -689,7 +689,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                       receiveValue: { received in
                           response = received
                           responseReceived.fulfill()
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -749,7 +749,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                                case .complete:
                                    responseReceived.fulfill()
                                }
-            })
+                           })
         }
 
         let stateAfterSubscription = request.state
@@ -785,7 +785,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                           case .complete:
                               responseReceived.fulfill()
                           }
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -851,7 +851,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                           case .complete:
                               responseReceived.fulfill()
                           }
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -933,7 +933,7 @@ final class DataStreamRequestCombineTests: CombineTestCase {
                           firstCompletion = first
                           secondCompletion = second
                           responseReceived.fulfill()
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -1205,7 +1205,7 @@ final class DownloadRequestCombineTests: CombineTestCase {
                           receivedOnMain = Thread.isMainThread
                           response = $0
                           responseReceived.fulfill()
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)
@@ -1263,7 +1263,7 @@ final class DownloadRequestCombineTests: CombineTestCase {
                           receivedOnMain = Thread.isMainThread
                           response = $0
                           responseReceived.fulfill()
-                })
+                      })
         }
 
         waitForExpectations(timeout: timeout)