You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2018/03/31 01:05:44 UTC

[incubator-openwhisk] branch master updated: Bump swift 4.1 to latest release (#3509)

This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new f827d90  Bump swift 4.1 to latest release (#3509)
f827d90 is described below

commit f827d90bd7093ec189337ff20c746bdf12281544
Author: Carlos Santana <cs...@apache.org>
AuthorDate: Fri Mar 30 21:05:39 2018 -0400

    Bump swift 4.1 to latest release (#3509)
---
 actionRuntimes/swift4.1Action/Dockerfile |  2 +-
 docs/actions.md                          | 16 +++++++++++-----
 tools/build/compile_swift.sh             |  8 +++++++-
 tools/travis/build.sh                    |  2 +-
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/actionRuntimes/swift4.1Action/Dockerfile b/actionRuntimes/swift4.1Action/Dockerfile
index 3a225fe..fec9627 100755
--- a/actionRuntimes/swift4.1Action/Dockerfile
+++ b/actionRuntimes/swift4.1Action/Dockerfile
@@ -1 +1 @@
-FROM openwhisk/action-swift-v4.1:1.0.1
+FROM openwhisk/action-swift-v4.1:1.0.4
diff --git a/docs/actions.md b/docs/actions.md
index 5c26428..6e79509 100644
--- a/docs/actions.md
+++ b/docs/actions.md
@@ -629,7 +629,7 @@ wsk action create helloPHP --kind php:7.1 helloPHP.zip
 
 ## Creating Swift actions
 
-The process of creating Swift actions is similar to that of JavaScript actions. The following sections guide you through creating and invoking a single swift action, and packaging an action in a zip file. 
+The process of creating Swift actions is similar to that of JavaScript actions. The following sections guide you through creating and invoking a single swift action, and packaging an action in a zip file.
 
 You can also use the online [Online Swift Playground](http://online.swiftplayground.run) to test your Swift code without having to install Xcode on your machine.
 
@@ -719,7 +719,7 @@ Find out more about parameters in the [Working with parameters](./parameters.md)
 
 When you create an OpenWhisk Swift action with a Swift source file, it has to be compiled into a binary before the action is run. Once done, subsequent calls to the action are much faster until the container holding your action is purged. This delay is known as the cold-start delay.
 
-To avoid the cold-start delay, you can compile your Swift file into a binary and then upload to OpenWhisk in a zip file. As you need the OpenWhisk scaffolding, the easiest way to create the binary is to build it within the same environment as it will be run in. 
+To avoid the cold-start delay, you can compile your Swift file into a binary and then upload to OpenWhisk in a zip file. As you need the OpenWhisk scaffolding, the easiest way to create the binary is to build it within the same environment as it will be run in.
 
 ### Using a script to build Swift packaged action
 You can use a script to automate the packaging of the action. Create  script `compile.sh`h file the following.
@@ -732,7 +732,7 @@ if [ -z "$1" ] ; then
     exit 1
 fi
 if [ -z "$2" ] ; then
-    echo 'Error: Missing runtime docker image name, for example openwhisk/action-swift-v4.0'
+    echo 'Error: Missing kind, for example swift:4.1'
     exit 2
 fi
 OUTPUT_DIR="build"
@@ -774,6 +774,12 @@ fi
 cat $BASE_PATH/epilogue.swift >> $DEST_SOURCE/main.swift
 echo '_run_main(mainFunction:main)' >> $DEST_SOURCE/main.swift
 
+# Only for Swift4
+if [ ${2} != "swift:3.1.1" ]; then
+  echo 'Adding wait to deal with escaping'
+  echo '_ = _whisk_semaphore.wait(timeout: .distantFuture)' >> $DEST_SOURCE/main.swift
+fi
+
 echo \"Compiling $1...\"
 cd /$BASE_PATH/spm-build
 cp /owexec/actions/$1/Package.swift $DEST_PACKAGE_SWIFT
@@ -887,7 +893,7 @@ func main(param: Input, completion: (Output?, Error?) -> Void) -> Void {
         throw VendingMachineError.insufficientFunds(coinsNeeded: 5)
     } catch {
         completion(nil, error)
-    } 
+    }
 }
 ```
 
@@ -1105,7 +1111,7 @@ import "os"
 func main() {
     //program receives one argument: the JSON object as a string
     arg := os.Args[1]
-   
+
     // unmarshal the string to a JSON object
     var obj map[string]interface{}
     json.Unmarshal([]byte(arg), &obj)
diff --git a/tools/build/compile_swift.sh b/tools/build/compile_swift.sh
index 7deb934..ff8ab15 100755
--- a/tools/build/compile_swift.sh
+++ b/tools/build/compile_swift.sh
@@ -23,7 +23,7 @@ if [ -z "$1" ] ; then
     exit 1
 fi
 if [ -z "$2" ] ; then
-    echo 'Error: Missing runtime docker image name, for example openwhisk/action-swift-v4.0'
+    echo 'Error: Missing kind, for example swift:4.1'
     exit 2
 fi
 OUTPUT_DIR="build"
@@ -65,6 +65,12 @@ fi
 cat $BASE_PATH/epilogue.swift >> $DEST_SOURCE/main.swift
 echo '_run_main(mainFunction:main)' >> $DEST_SOURCE/main.swift
 
+# Only for Swift4
+if [ ${2} != "swift:3.1.1" ]; then
+  echo 'Adding wait to deal with escaping'
+  echo '_ = _whisk_semaphore.wait(timeout: .distantFuture)' >> $DEST_SOURCE/main.swift
+fi
+
 echo \"Compiling $1...\"
 cd /$BASE_PATH/spm-build
 cp /owexec/actions/$1/Package.swift $DEST_PACKAGE_SWIFT
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index f65e7e6..ee2750d 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -47,7 +47,7 @@ fi
 cd $ROOTDIR/ansible
 
 ANSIBLE_CMD="ansible-playbook -i environments/local -e docker_image_prefix=testing"
-GRADLE_PROJS_SKIP="-x :actionRuntimes:pythonAction:distDocker  -x :actionRuntimes:python2Action:distDocker -x actionRuntimes:swift3.1.1Action:distDocker -x :actionRuntimes:javaAction:distDocker"
+GRADLE_PROJS_SKIP="-x :actionRuntimes:pythonAction:distDocker  -x :actionRuntimes:python2Action:distDocker -x actionRuntimes:swift3.1.1Action:distDocker -x actionRuntimes:swift4.1Action:distDocker -x :actionRuntimes:javaAction:distDocker"
 
 $ANSIBLE_CMD setup.yml -e mode=HA
 $ANSIBLE_CMD prereq.yml

-- 
To stop receiving notification emails like this one, please contact
csantanapr@apache.org.