davidstump / SwiftPhoenixClient

Connect your Phoenix and iOS applications through WebSockets!
MIT License
507 stars 147 forks source link

support v2 json serializer #204

Closed ruslandoga closed 2 years ago

ruslandoga commented 2 years ago

Closes #202 by adding a V2 serializer support.

@dsrees I've tried but failed to run the tests, so I haven't updated them. I tired carthage bootstrap --platform iOS but nimble failed to get installed:

> carthage bootstrap --platform iOS
*** Checking out Nimble at "v9.2.0"
*** Checking out RxSwift at "5.1.2"
*** Checking out Starscream at "3.1.1"
*** Checking out Quick at "v4.0.0"
*** xcodebuild output can be found in /var/folders/jq/679jhhcn2555my325vb71p2w0000gn/T/carthage-xcodebuild.EbNB4S.log
*** Building scheme "Nimble-iOS" in Nimble.xcodeproj
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -project /Users/q/Developer/SwiftPhoenixClient/Carthage/Checkouts/Nimble/Nimble.xcodeproj -scheme Nimble-iOS -configuration Release -derivedDataPath /Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0 -sdk iphonesimulator -destination platform=iOS\ Simulator,id=7D60301A-9E53-434F-84A0-1B93941A1975 -destination-timeout 3 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES build VALIDATE_WORKSPACE=NO (launched in /Users/q/Developer/SwiftPhoenixClient/Carthage/Checkouts/Nimble)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/jq/679jhhcn2555my325vb71p2w0000gn/T/carthage-xcodebuild.EbNB4S.log
> tail /var/folders/jq/679jhhcn2555my325vb71p2w0000gn/T/carthage-xcodebuild.EbNB4S.log

Ld /Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0/Build/Intermediates.noindex/Nimble.build/Release-iphonesimulator/Nimble-iOS.build/Objects-normal/i386/Binary/Nimble normal i386 (in target 'Nimble-iOS' from project 'Nimble')
    cd /Users/q/Developer/SwiftPhoenixClient/Carthage/Checkouts/Nimble
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target i386-apple-ios9.0-simulator -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk -L/Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0/Build/Products/Release-iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib -F/Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0/Build/Products/Release-iphonesimulator -iframework /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -iframework /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk/Developer/Library/Frameworks -filelist /Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0/Build/Intermediates.noindex/Nimble.build/Release-iphonesimulator/Nimble-iOS.build/Objects-normal/i386/Nimble.LinkFileList -install_name @rpath/Nimble.framework/Nimble -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0/Build/Intermediates.noindex/Nimble.build/Release-iphonesimulator/Nimble-iOS.build/Objects-normal/i386/Nimble_lto.o -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -fapplication-extension -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0/Build/Intermediates.noindex/Nimble.build/Release-iphonesimulator/Nimble-iOS.build/Objects-normal/i386/Nimble.swiftmodule -Xlinker -no_application_extension -weak_framework XCTest -weak-lXCTestSwiftSupport -Xlinker -no_adhoc_codesign -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0/Build/Intermediates.noindex/Nimble.build/Release-iphonesimulator/Nimble-iOS.build/Objects-normal/i386/Nimble_dependency_info.dat -o /Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0/Build/Intermediates.noindex/Nimble.build/Release-iphonesimulator/Nimble-iOS.build/Objects-normal/i386/Binary/Nimble

** BUILD FAILED **

The following build commands failed:
    Ld /Users/q/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/Nimble/v9.2.0/Build/Intermediates.noindex/Nimble.build/Release-iphonesimulator/Nimble-iOS.build/Objects-normal/x86_64/Binary/Nimble normal x86_64 (in target 'Nimble-iOS' from project 'Nimble')
(1 failure)

I've tried fastlane as well, but it doesn't install carthage packages. Note that I'm on M1, that might be an issue.

ruslandoga commented 2 years ago

I've also tried carthage bootstrap --platform iOS --use-xcframeworks with a similar result.

carthage update --platform iOS --use-xcframeworks completed by updating nimble 9.2.0 -> 9.2.1:

> carthage update --platform iOS --use-xcframeworks

*** Fetching Quick
*** Fetching Starscream
*** Fetching Nimble
*** Fetching RxSwift
*** Checking out Quick at "v4.0.0"
*** Checking out RxSwift at "5.1.3"
*** Checking out Nimble at "v9.2.1"
*** Checking out Starscream at "3.1.1"
*** xcodebuild output can be found in /var/folders/jq/679jhhcn2555my325vb71p2w0000gn/T/carthage-xcodebuild.UscAp1.log
*** Building scheme "Nimble-iOS" in Nimble.xcodeproj
*** Building scheme "Quick-iOS" in Quick.xcworkspace
*** Building scheme "RxCocoa" in Rx.xcworkspace
*** Building scheme "RxRelay" in Rx.xcworkspace
*** Building scheme "RxBlocking" in Rx.xcworkspace
*** Building scheme "RxSwift" in Rx.xcworkspace
*** Building scheme "RxTest" in Rx.xcworkspace
*** Building scheme "Starscream" in Starscream.xcodeproj

but xcode still complains about nimble missing when compiling for tests, I guess it has something to do with me using xcframeworks, and I couldn't find a place to point xcode to use xcframeworks like in iOS app setup where I could click on root folder in the left sidebar and drag xcframeworks from carthage build folder there.

ruslandoga commented 2 years ago

My problem was I opened the project with xed . and it opened it in a "package" version. Using open SwiftPhoenixClient.xcodeproj directly and running tests fixed the problems with finding nimble. Although nimble still fails in some tests:

fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " +
            "Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " +
            "by placing the test case inside an #if arch(x86_64) or canImport(Darwin) conditional statement")

https://github.com/Quick/Nimble/issues/851

All tests other than the ones failing with the error above are passing. I'll add tests for the new functionality next.

ruslandoga commented 2 years ago

@dsrees I think this PR is ready for review. I can squash all commits into one if needed.

Demo: https://github.com/ruslandoga/phx-socket/pull/1