kylef / JSONWebToken.swift

Swift implementation of JSON Web Token (JWT).
http://jwt.io
BSD 2-Clause "Simplified" License
763 stars 226 forks source link

Project depending on JSONWebToken ver 2.2.0 (master) does not compile. #89

Closed nightshiftdev closed 6 years ago

nightshiftdev commented 6 years ago

I have just updated my project to Swift 4 and Xcode 9 settings, during the upgrade efforts I also updated JSONWebToken to ver 2.2.0 (cartfile: github "kylef/JSONWebToken.swift" "master").

Unfortunately, the JWT import complains about missing required module 'CryptoCommon' (screenshot attached). This problem becomes especially apparent on my build machine where the project is built "fresh" every single time.

screen shot 2017-09-26 at 3 41 19 pm

Reverting to version 2.1.0 yields JWT compilation error:


Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -project /Users/pkijowski/projects/mobile/CFApps_iOS/Carthage/Checkouts/JSONWebToken.swift/JWT.xcodeproj -scheme JWT-OSX -configuration Release -derivedDataPath /Users/pkijowski/Library/Caches/org.carthage.CarthageKit/DerivedData/9.0_9A235/JSONWebToken.swift/2.1.0 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES build (launched in /Users/pkijowski/projects/mobile/CFApps_iOS/Carthage/Checkouts/JSONWebToken.swift)

carthage-xcodebuild.6tdkjU.log

jonbrooks commented 6 years ago

We have also run into this problem. It seems carthage bootstrap is required to have been run once, where typically we just check in the built Carthage products.

jonbrooks commented 6 years ago

Is there a resolution or workaround to this?

kylef commented 6 years ago

@jonbrooks Didn't you say yourself that you need to run carthage bootstrap?

jonbrooks commented 6 years ago

@kylef Since this change, it seems we have to run carthage bootstrap any time we pull changes from git (maybe just changes that touch carthage products? not sure...), or checkout on a fresh system, like a build machine. It's no longer possible to just check in the contents of Carthage/Build and have that be able to build and run.

kylef commented 6 years ago

I do not use Carthage so I am not entirely sure, but looking the vague documentation for Carthage it says to run carthage bootstrap before running a project using Carthage. Isn't this expected?

https://github.com/Carthage/Carthage#running-a-project-that-uses-carthage

After you’ve finished the above steps and pushed your changes, other users of the project only need to fetch the repository and run carthage bootstrap to get started with the frameworks you’ve added.

jonbrooks commented 6 years ago

I guess the documentation is more vague than I realized, but in general, Carthage builds standalone frameworks that are put in Carthage/Build, so by checking that folder into git, a user can typically just checkout and build with no carthage steps required. The JSONWebToken build run by Carthage does some sort of side effect that is required for a successful build, and just checking in the built framework is no longer sufficient. If the rest of the world isn't screaming about this, maybe this process we have is not a good one. However, the CryptoSwift-dependent version of JSONWebToken worked much better for us in Carthage (and worked like all other dependencies we pull in).

Thanks for engaging on this problem, and thanks for what has been a useful framework for us.