You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2022/12/24 10:30:14 UTC

[GitHub] [openwhisk-runtime-swift] Andrea-Scuderi opened a new pull request, #153: Add Support for Swift 5.7

Andrea-Scuderi opened a new pull request, #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153

   # Add support for Swift 5.7
   
   - Add new action signatures with async/await and throws
   - Backward compatibility with old action signatures
   
   ### swift57Action
   - Add support async to Whisk class
   
   ### swiftbuild.py
   - simplify the code added by the build process to:
   ```swift
   try await _WhiskRuntime.wiskRunLoop { jsonData in
      await _WhiskRuntime.runAsyncMain(mainFunction: <action>, json: jsonData)
   }
   ```
   
   ### swiftbuild.py.launcher.swift
   - Add `_WhiskRuntime` struct 
   - Refactor Error messages
   - Add new signatures
   
   ```swift
   // Examples of Actions supported by Swift 5.7
   
   // Action with Any Input and Any Output
   func main(args: Any) -> Any {
       let newArgs = args as! [String:Any]
       if let name = newArgs["name"] as? String {
           return [ "greeting" : "Hello \(name)!" ]
       } else {
           return [ "greeting" : "Hello stranger!" ]
       }
   }
    
   // Async Action with Any Input and Any Output
   func mainAsync(args: Any) async -> Any {
       do {
           //async code sleep for 1 sec
           try await Task.sleep(nanoseconds: 1_000_000_000)
           
           let newArgs = args as! [String:Any]
           if let name = newArgs["name"] as? String {
               return [ "greeting" : "Hello \(name)!" ]
           } else {
               return [ "greeting" : "Hello stranger!" ]
           }
       } catch {
           return ["error" : error.localizedDescription]
       }
   }
   
   // Async throwing Action with Any Input and Any Output
   func mainAsyncThrows(args: Any) async throws -> Any {
       //async code sleep for 1 sec
       try await Task.sleep(nanoseconds: 1_000_000_000)
       
       let newArgs = args as! [String:Any]
       if let name = newArgs["name"] as? String {
           return [ "greeting" : "Hello \(name)!" ]
       } else {
           return [ "greeting" : "Hello stranger!" ]
       }
   }
   
   struct Input: Codable {
       let name: String?
   }
   
   struct Output: Codable {
       let count: Int
   }
   
   // Action with Codable Input and completion with Codable Output and Error
   func mainCompletionCodable(input: Input, completion: @escaping (Output?, Error?) -> Void) -> Void {
       if let name = input.name {
           let output = Output(count: name.count)
           completion(output, nil)
       } else {
           let output = Output(count: 0)
           completion(output, nil)
       }
   }
   
   // Action with Codable Input and completion with Codable Output and Error
   func mainCompletionCodableNoInput(completion: @escaping (Output?, Error?) -> Void) -> Void {
       let output = Output(count: 0)
       completion(output, nil)
   }
   
   // Async throwing Action with Codable Output
   func mainCodableAsyncThrowsNoInput() async throws -> Output? {
       try await Task.sleep(nanoseconds: 1_000_000_000)
       return Output(count: 0)
   }
   
   // Async throwing Action with a Codable Input and a Codable Output
   func mainCodableAsyncThrows(input: Input) async throws -> Output? {
       try await Task.sleep(nanoseconds: 1_000_000_000)
       if let name = input.name {
           return Output(count: name.count)
       } else {
           return Output(count: 0)
       }
   }
   ```
   
   
   Merry Christmas and Happy New Year! 🎄


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] dgrove-oss commented on a diff in pull request #153: Add Support for Swift 5.7

Posted by "dgrove-oss (via GitHub)" <gi...@apache.org>.
dgrove-oss commented on code in PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153#discussion_r1253653100


##########
core/swift57Action/CHANGELOG.md:
##########
@@ -0,0 +1,25 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# Apache OpenWhisk Swift 5.7 Runtime Container
+
+- Support for swift async/await
+
+## 1.17.0

Review Comment:
   We'll fill in the actual number as part of making the release
   ```suggestion
   ## Next Apache Release
   ```



##########
tools/travis/build.sh:
##########
@@ -49,6 +49,7 @@ TERM=dumb ./gradlew \
 :core:swift51Action:distDocker \
 :core:swift53Action:distDocker \
 :core:swift54Action:distDocker \
+:core:swift57Action:distDocker \

Review Comment:
   The corresponding addition should be made after this line now:  https://github.com/apache/openwhisk-runtime-swift/blob/master/.github/workflows/ci.yaml#L103



##########
tools/travis/publish.sh:
##########
@@ -36,6 +36,8 @@ elif [ ${RUNTIME_VERSION} == "5.3" ]; then
   RUNTIME="swift53Action"
 elif [ ${RUNTIME_VERSION} == "5.4" ]; then
   RUNTIME="swift54Action"
+elif [ ${RUNTIME_VERSION} == "5.7" ]; then

Review Comment:
   The corresponding change should be made here now: https://github.com/apache/openwhisk-runtime-swift/blob/master/.github/workflows/ci.yaml#L116



##########
core/swift54Action/CHANGELOG.md:
##########
@@ -17,7 +17,7 @@
 #
 -->
 
-# Apache OpenWhisk Swift 5.4 Runtime Container
+# Apache OpenWhisk Swift 5.7 Runtime Container

Review Comment:
   Minor nit; this file shouldn't change.
   ```suggestion
   # Apache OpenWhisk Swift 5.4 Runtime Container
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] dgrove-oss commented on pull request #153: Add Support for Swift 5.7

Posted by "dgrove-oss (via GitHub)" <gi...@apache.org>.
dgrove-oss commented on PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153#issuecomment-1622582699

   Thanks for the quick response!  CI run approved. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] Andrea-Scuderi commented on pull request #153: Add Support for Swift 5.7

Posted by "Andrea-Scuderi (via GitHub)" <gi...@apache.org>.
Andrea-Scuderi commented on PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153#issuecomment-1622581329

   @dgrove-oss I've updated the branch with your suggestions. Could you run the CI?
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] Andrea-Scuderi commented on a diff in pull request #153: Add Support for Swift 5.7

Posted by "Andrea-Scuderi (via GitHub)" <gi...@apache.org>.
Andrea-Scuderi commented on code in PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153#discussion_r1253708834


##########
core/swift54Action/CHANGELOG.md:
##########
@@ -17,7 +17,7 @@
 #
 -->
 
-# Apache OpenWhisk Swift 5.4 Runtime Container
+# Apache OpenWhisk Swift 5.7 Runtime Container

Review Comment:
   https://github.com/apache/openwhisk-runtime-swift/commit/4917c54a630c82b33a68ec0d66139b1657652ebe



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] dgrove-oss merged pull request #153: Add Support for Swift 5.7

Posted by "dgrove-oss (via GitHub)" <gi...@apache.org>.
dgrove-oss merged PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] Andrea-Scuderi commented on a diff in pull request #153: Add Support for Swift 5.7

Posted by "Andrea-Scuderi (via GitHub)" <gi...@apache.org>.
Andrea-Scuderi commented on code in PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153#discussion_r1253693347


##########
tools/travis/build.sh:
##########
@@ -49,6 +49,7 @@ TERM=dumb ./gradlew \
 :core:swift51Action:distDocker \
 :core:swift53Action:distDocker \
 :core:swift54Action:distDocker \
+:core:swift57Action:distDocker \

Review Comment:
   https://github.com/apache/openwhisk-runtime-swift/pull/153/commits/0707e20ec1070a6231135bf129de81b56bb91f49



##########
tools/travis/publish.sh:
##########
@@ -36,6 +36,8 @@ elif [ ${RUNTIME_VERSION} == "5.3" ]; then
   RUNTIME="swift53Action"
 elif [ ${RUNTIME_VERSION} == "5.4" ]; then
   RUNTIME="swift54Action"
+elif [ ${RUNTIME_VERSION} == "5.7" ]; then

Review Comment:
   https://github.com/apache/openwhisk-runtime-swift/pull/153/commits/0707e20ec1070a6231135bf129de81b56bb91f49



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] Andrea-Scuderi commented on pull request #153: Add Support for Swift 5.7

Posted by GitBox <gi...@apache.org>.
Andrea-Scuderi commented on PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153#issuecomment-1372557751

   > Do you have an Apache CLA on file I was not able to locate one.
   
   Yes, I've sent a CLA the 11/11/2019.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] dgrove-oss commented on pull request #153: Add Support for Swift 5.7

Posted by "dgrove-oss (via GitHub)" <gi...@apache.org>.
dgrove-oss commented on PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153#issuecomment-1622509581

   Hi @Andrea-Scuderi  -- we've finally managed to get GitHub Action based CI working for this repository.  Apologies for the very long delay.  Would you have the time and interest to rebase this PR to the current master so we can get it merged?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] rabbah commented on pull request #153: Add Support for Swift 5.7

Posted by GitBox <gi...@apache.org>.
rabbah commented on PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153#issuecomment-1372292708

   Thanks @Andrea-Scuderi for this contribution. 
   
   Do you have an Apache CLA on file I was not able to locate one.
   
   We may continue to hold merging this PR until we've cut over to the new GHA flow and away from Travis.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [openwhisk-runtime-swift] Andrea-Scuderi commented on a diff in pull request #153: Add Support for Swift 5.7

Posted by "Andrea-Scuderi (via GitHub)" <gi...@apache.org>.
Andrea-Scuderi commented on code in PR #153:
URL: https://github.com/apache/openwhisk-runtime-swift/pull/153#discussion_r1253692777


##########
core/swift57Action/CHANGELOG.md:
##########
@@ -0,0 +1,25 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# Apache OpenWhisk Swift 5.7 Runtime Container
+
+- Support for swift async/await
+
+## 1.17.0

Review Comment:
   https://github.com/apache/openwhisk-runtime-swift/pull/153/commits/4917c54a630c82b33a68ec0d66139b1657652ebe



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org