-
Notifications
You must be signed in to change notification settings - Fork 23
Swift 4 support #1
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
Conversation
|
Looking at the existing packages, it might be worth reviewing these given the changes to Swift 4.
When the Cloudant Swift lib supports Linux (might be worth including that). |
|
@jthomas Yeah it will be good to refactor Whisk class to use new stuff from Swift 4 Want to help with that? I created issue #6 In terms of dependencies, if we remove them current users using swift 3.1.1 using source file, would need to refactor their code becasue SwifttyJSON and KituraNet would be removed. Maybe is not that bad and we just need to doc or blog on how to migrate their code. |
|
Regardless if we include the dependency or not we should refactor and remove it if possible in https://github.com/apache/incubator-openwhisk-runtime-swift/blob/master/core/swift3Action/spm-build/_WhiskJSONUtils.swift and https://github.com/apache/incubator-openwhisk-runtime-swift/blob/master/core/swift3Action/spm-build/_WhiskJSONUtils.swift This way for folks doing zip with pre-compile they are not forced to include the dependencies, because of the epilogue |
|
yay epilogue doesn't have any dependencies |
|
|
Add test for using https://github.com/IBM-Swift/SwiftyRequest as pre-compiled |
|
I reached a stable swift 4 runtime 🎉 |
|
|
Added test case for compiling 3rd party package, used SwiftyRequest package, which is very common task to do a http request to API services. |
| if let json = try? JSONSerialization.jsonObject(with: retval, options: []) as! [String:Any] { | ||
| resp = json | ||
| } else { | ||
| resp = ["error":"Response from server is not a dictionary like"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍
|
Done adding test cases for for both swift 3 and swift 4 for Whisk SDK (invoke, trigger, createTrigger, createRule). |
|
added changelog |
|
I think I'm done for review and merge. |
| ### Migrating from Swift 3 to Swift 4 | ||
|
|
||
| ### Helper compile.sh helper script | ||
| When compiling and packaging your swift 4 now there are a couple of differences |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: couple of differences.
|
|
||
| ### Helper compile.sh helper script | ||
| When compiling and packaging your swift 4 now there are a couple of differences | ||
| All your source code needs to be copy to `/swift4Action/spm-build/Sources/Action/` instead of `/swift3Action/spm-build/` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: needs to be copied
| For swift 4 you need specify additional information in Package.swift such as `products` with executable name `Action` and `targets` | ||
|
|
||
| You can take a look at the helper script [tools/build/compile.sh](tools/build/compile.sh) to compile and zip your Actions. | ||
| Having a project directory `Hello` under a directory `actions` like the following: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: Have a project
| This will produce a zip `build/swift4/Hello.zip` | ||
|
|
||
| ### SwiftyJSON using single source action file | ||
| If you have a swift:3.1.1 action not compile, just as source using the `SwiftyJSON` package, you need to precompile your action and specify the version of SwiftyJSON you wan to use for swift:4 kind action. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version of SwiftyJSON you want
|
|
||
| ### SwiftyJSON using single source action file | ||
| If you have a swift:3.1.1 action not compile, just as source using the `SwiftyJSON` package, you need to precompile your action and specify the version of SwiftyJSON you wan to use for swift:4 kind action. | ||
| Take into account that tarting with Swift 4 there is better support to manage JSON data natively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take into account that starting
| } else { | ||
| return [ "greeting" : "Hello stranger!" ] | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since some of Swift 3 and Swift 4 tests are the same, should we use a base directory to store common files so we don't keep duplicates? Maybe I'm being too picky?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM.
Work in progress
Closes #3
Closes #4