AliSoftware / OHHTTPStubs

Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!
MIT License
5.03k stars 601 forks source link

Support building using Xcode 10.2 and Swift 5.0 #304

Closed raatiniemi closed 5 years ago

raatiniemi commented 5 years ago

New Issue Checklist

Environment

Issue Description

Attempting to build OHHTTPStubs via Carthage using Xcode 10.2 fails due to Swift 3.0 no longer being supported.

What are the thoughts regarding updating to a later Swift version? Is there any interest in a pull request to update the version? If so, what version should be used? An update to Swift 5.0 perhaps would be optimal since ABI is now stable.

Complete output when you encounter the issue (if any)
Build system information
error: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'OHHTTPStubs iOS Framework')
jeffctown commented 5 years ago

Hey @raatiniemi , thanks for submitting this! Unfortunately I haven't been able to reproduce the issue are seeing.

jeffs-new-mbp-4:OHHTTPTester jeff$ carthage version
0.32.0
jeffs-new-mbp-4:OHHTTPTester jeff$ more Cartfile
github "AliSoftware/OHHTTPStubs"
jeffs-new-mbp-4:OHHTTPTester jeff$ carthage build
*** xcodebuild output can be found in /var/folders/zd/n2tm8whj1bv2xdlp8dtnrdlw0000gn/T/carthage-xcodebuild.j1fv00.log
*** Downloading OHHTTPStubs.framework binary at "7.0.0"
***  Skipped installing OHHTTPStubs.framework binary due to the error:
    "Incompatible Swift version - framework was built with 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1) and the local version is 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)."

    Falling back to building from the source
*** Building scheme "OHHTTPStubs Mac Framework" in OHHTTPStubs.xcworkspace
*** Building scheme "OHHTTPStubs iOS Framework" in OHHTTPStubs.xcworkspace
*** Building scheme "OHHTTPStubs tvOS Framework" in OHHTTPStubs.xcworkspace
jeffs-new-mbp-4:OHHTTPTester jeff$ ls -la ./Carthage/Build/iOS/
total 144
drwxr-xr-x  6 jeff  staff    192 Apr  2 21:24 .
drwxr-xr-x  6 jeff  staff    192 Apr  2 21:24 ..
-rw-------  1 jeff  staff  36262 Apr  2 21:24 9929D4EB-2470-3FE9-8A17-DE495A417503.bcsymbolmap
-rw-------  1 jeff  staff  34691 Apr  2 21:24 A1E82756-13B2-39C1-9411-596090984A1C.bcsymbolmap
drwxr-xr-x  6 jeff  staff    192 Apr  2 21:24 OHHTTPStubs.framework
drwxr-xr-x  3 jeff  staff     96 Apr  2 21:17 OHHTTPStubs.framework.dSYM

The binary created at release time was built with 4.2.1, so I think the Incompatible Swift version message is expected.

Would you feel comfortable sharing your entire Cartfile, the exact Carthage command used, or anything else you think would be helpful to reproduce the issue?

raatiniemi commented 5 years ago

Hey @jeffctown, thanks for a fast answer.

I've investigated it a bit more after your response and I realised that version 6.0.0 of OHHTTPStubs was being pulled in by a different dependency. Attempting to compile the other dependency with 7.0.0 works as intended, I perhaps should've done more investigation before opening an issue.

However, on the topic of Swift 5.0, is there any interest in updating the library? Seems as ABI stability would be beneficial, e.g. to reduce the need for recompilation.

jeffctown commented 5 years ago

Oh, that's great @raatiniemi . I'm happy to hear you resolved the compilation issue.

On the topic of Swift 5, yes - we are interested in updating the library. I believe one of @AliSoftware 's goals for this project is to support as many modern versions of swift as possible, so I'd be curious to see what we could still support when updating to Swift 5. Feel free to start a PR for that change.

That said, I don't think that updating to Swift 5.0 is going to reduce the need for recompilation, even though the latest swift release has ABI stability. I think we need module stability to do what you are thinking of, which is still unreleased.

More info on that here: https://swift.org/blog/abi-stability-and-more/

CRoig commented 5 years ago

Updating to Swift 5.0 will solve also Carthage warnings when building the project using XCode 10.2. Thanks.

raatiniemi commented 5 years ago

Since #306 have been merged, this issue can be closed.