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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8d8e137  remove deprecated swift 4.1 runtime (#134)
8d8e137 is described below

commit 8d8e1371f5ede3007202a94f089ae9d4caaf1e93
Author: David Grove <[email protected]>
AuthorDate: Wed Mar 31 09:48:40 2021 -0400

    remove deprecated swift 4.1 runtime (#134)
---
 .travis.yml                                        |   2 +-
 README.md                                          | 101 +-----------
 core/swift41Action/CHANGELOG.md                    |  89 -----------
 core/swift41Action/Dockerfile                      |  44 ------
 core/swift41Action/build.gradle                    |  19 ---
 core/swift41Action/buildandrecord.py               |  77 ---------
 core/swift41Action/epilogue.swift                  | 126 ---------------
 core/swift41Action/spm-build/Package.swift         |  36 -----
 core/swift41Action/swift4runner.py                 | 113 --------------
 .../spm-build => swift42Action}/_Whisk.swift       |   0
 core/swift42Action/build.gradle                    |  12 --
 settings.gradle                                    |   2 -
 tests/dat/build.sh                                 |   5 -
 .../Swift41ActionContainerTests.scala              | 172 ---------------------
 .../Swift41CodableActionContainerTests.scala       |  64 --------
 .../test/scala/runtime/sdk/Swift41SDKTests.scala   |  26 ----
 tools/build/compile.sh                             |  87 -----------
 tools/travis/build.sh                              |   1 -
 tools/travis/publish.sh                            |   4 +-
 19 files changed, 7 insertions(+), 973 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 8e8fbb3..6d780d2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -42,7 +42,7 @@ deploy:
       all_branches: true
       repo: apache/openwhisk-runtime-swift
   - provider: script
-    script: "./tools/travis/publish.sh openwhisk 4.1 nightly && 
./tools/travis/publish.sh openwhisk 4.2 nightly"
+    script: "./tools/travis/publish.sh openwhisk 4.2 nightly"
     on:
       branch: master
       repo: apache/openwhisk-runtime-swift
diff --git a/README.md b/README.md
index 7776e4c..62cdfc7 100644
--- a/README.md
+++ b/README.md
@@ -23,9 +23,9 @@
 
 
 ## Changelogs
-- [Swift 4.1   CHANGELOG.md](core/swift41Action/CHANGELOG.md)
 - [Swift 4.2   CHANGELOG.md](core/swift42Action/CHANGELOG.md)
 - [Swift 5.1   CHANGELOG.md](core/swift51Action/CHANGELOG.md)
+- [Swift 5.3   CHANGELOG.md](core/swift53Action/CHANGELOG.md)
 
 ## Quick Swift Action
 ### Simple swift action hello.swift
@@ -246,107 +246,16 @@ zip - -r * | docker run -i openwhisk/action-swift-v4.2 
-compile main >../action.
 
 For more build examples see [here](./examples/)
 
-
-### Compiling Swift 4.1
-These are the steps:
-
-- Run an interactive Swift action container.
-  ```
-  docker run --rm -it -v "$(pwd):/owexec" openwhisk/action-swift-v4.2 bash
-  ```
-  This puts you in a bash shell within the Docker container.
-
-- Copy the source code and prepare to build it.
-  ```
-  cp /owexec/hello.swift /swift4Action/spm-build/Sources/Action/main.swift
-  ```
-  ```
-  cat /swift4Action/epilogue.swift >> 
/swift4Action/spm-build/Sources/Action/main.swift
-  ```
-  ```
-  echo '_run_main(mainFunction:main)' >> 
/swift4Action/spm-build/Sources/Action/main.swift
-  ```
-  Copy any additional source files to `/swift4Action/spm-build/Sources/Action/`
-
-
-- Create the `Package.swift` file to add dependencies.
-```swift
-// swift-tools-version:4.0
-// The swift-tools-version declares the minimum version of Swift required to 
build this package.
-
-import PackageDescription
-
-let package = Package(
-    name: "Action",
-    products: [
-      .executable(
-        name: "Action",
-        targets:  ["Action"]
-      )
-    ],
-    dependencies: [
-      .package(url: "https://github.com/IBM-Swift/SwiftyRequest.git";, 
.upToNextMajor(from: "1.0.0"))
-    ],
-    targets: [
-      .target(
-        name: "Action",
-        dependencies: ["SwiftyRequest"],
-        path: "."
-      )
-    ]
-```
-  As you can see this example adds `SwiftyRequest` dependencies.
-
-  Notice that now with swift:4.2 is no longer required to include `CCurl`, 
`Kitura-net` and `SwiftyJSON` in your own `Package.swift`.
-  You are free now to use no dependencies, or add the combination that you 
want with the versions you want.
-
-- Copy Package.swift to spm-build directory
-  ```
-  cp /owexec/Package.swift /swift4Action/spm-build/Package.swift
-  ```
-
-- Change to the spm-build directory.
-  ```
-  cd /swift4Action/spm-build
-  ```
-
-- Compile your Swift Action.
-  ```
-  swift build -c release
-  ```
-
-- Create the zip archive.
-  ```
-  zip /owexec/hello.zip .build/release/Action
-  ```
-
-- Exit the Docker container.
-  ```
-  exit
-  ```
-
-  This has created hello.zip in the same directory as hello.swift.
-
-- Upload it to OpenWhisk with the action name helloSwifty:
-  ```
-  wsk action update helloSwiftly hello.zip openwhisk/action-swift-v4.2
-  ```
-
-- To check how much faster it is, run
-  ```
-  wsk action invoke helloSwiftly --blocking
-  ```
-
 ### Building the Swift4 Image
 ```
-./gradlew core:swift40Action:distDocker
+./gradlew core:swift42Action:distDocker
 ```
 This will produce the image `whisk/action-swift-v4.2`
 
 Build and Push image
 ```
 docker login
-./gradlew core:swift40Action:distDocker -PdockerImagePrefix=$prefix-user 
-PdockerRegistry=docker.io
+./gradlew core:swift42Action:distDocker -PdockerImagePrefix=$prefix-user 
-PdockerRegistry=docker.io
 ```
 
 
@@ -442,14 +351,14 @@ wsk action update myAction myAction.swift --kind swift:4.2
 
 ## Local development
 ```
-./gradlew core:swift41Action:distDocker
+./gradlew core:swift42Action:distDocker
 ```
 This will produce the image `whisk/action-swift-v4.2`
 
 Build and Push image
 ```
 docker login
-./gradlew core:swift41Action:distDocker -PdockerImagePrefix=$prefix-user 
-PdockerRegistry=docker.io
+./gradlew core:swift42Action:distDocker -PdockerImagePrefix=$prefix-user 
-PdockerRegistry=docker.io
 ```
 
 Deploy OpenWhisk using ansible environment that contains the kind `swift:4.2`
diff --git a/core/swift41Action/CHANGELOG.md b/core/swift41Action/CHANGELOG.md
deleted file mode 100644
index 2ecdf2a..0000000
--- a/core/swift41Action/CHANGELOG.md
+++ /dev/null
@@ -1,89 +0,0 @@
-<!--
-#
-# 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 4.1 Runtime Container
-
-## 1.14.0
-  - Support for __OW_ACTION_VERSION (openwhisk/4761)
-
-## 1.13.0-incubating
-
-## 1.12.0-incubating
-
-## 1.0.8
-Changes:
-  - Update base image to use python proxy from openwhisk/dockerskeleton:1.3.3
-  - Update base image to extend ibmcom/swift-ubuntu:4.1
-
-## 1.0.7
-Changes:
-  - Update base image to openwhisk/dockerskeleton:1.3.2
-
-## 1.0.6
-Changes:
-  - Update base image to openwhisk/dockerskeleton:1.3.1
-
-## 1.0.5
-Changes:
-  - update to pass swiftc flags -Xswiftc -Onone to workaround swift 
optimization problem
-
-Swift runtime version: 
[swift-4.1-RELEASE](https://swift.org/builds/swift-4.1-release/ubuntu1404/swift-4.1-RELEASE/swift-4.1-RELEASE-ubuntu14.04.tar.gz)
-
-## 1.0.4
-Changes:
-  - update swift41 runtime to `swift-4.1-RELEASE`
-
-Swift runtime version: 
[swift-4.1-RELEASE](https://swift.org/builds/swift-4.1-release/ubuntu1404/swift-4.1-RELEASE/swift-4.1-RELEASE-ubuntu14.04.tar.gz)
-
-## 1.0.3
-Changes:
-  - update swift41 snapshot build to `2018-03-26-a`
-
-Swift runtime version: 
[swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-26-a](https://swift.org/builds/swift-4.1-branch/ubuntu1404/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-26-a/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-26-a-ubuntu14.04.tar.gz)
-
-## 1.0.2
-Changes:
-  - update epilogue with additional @escaping for Codable
-
-Swift runtime version: 
[swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-11-a](https://swift.org/builds/swift-4.1-branch/ubuntu1404/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-11-a/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-11-a-ubuntu14.04.tar.gz)
-
-## 1.0.1
-Changes:
-  - update swift41 snapshot build to `2018-03-11-a`
-
-Swift runtime version: 
[swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-11-a](https://swift.org/builds/swift-4.1-branch/ubuntu1404/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-11-a/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-11-a-ubuntu14.04.tar.gz)
-
-## 1.0.0
-Changes:
-  - Add Codable support
-
-Swift runtime version: 
[swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-06-a](https://swift.org/builds/swift-4.1-branch/ubuntu1404/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-06-a/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-03-06-a-ubuntu14.04.tar.gz)
-
-Packages included:
-  - No packages included, use Package.swift and pre-compile action.
-
-## 0.1.0
-Initial Swift 4.1 image
-  - Image name: `openwhisk/action-swift-v4.1`
-  - Kind is: `swift:4.1`
-
-Swift runtime version: 
[swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-13-a](https://swift.org/builds/swift-4.1-branch/ubuntu1404/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-13-a/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-13-a-ubuntu14.04.tar.gz)
-
-Packages included:
-  - No packages included, use Package.swift and pre-compile action.
diff --git a/core/swift41Action/Dockerfile b/core/swift41Action/Dockerfile
deleted file mode 100644
index 6fdb468..0000000
--- a/core/swift41Action/Dockerfile
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# 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.
-#
-
-# TODO Replace this dockerfile and extend from official image when 4.1 is 
released
-FROM ibmcom/swift-ubuntu:4.1.3
-
-# Upgrade and install basic Python dependencies
-RUN apt-get -y update \
- && apt-get -y install --fix-missing python2.7 python-gevent python-flask zip
-
-# Add the action proxy
-ADD 
https://raw.githubusercontent.com/apache/openwhisk-runtime-docker/dockerskeleton%401.3.3/core/actionProxy/actionproxy.py
 /actionProxy/actionproxy.py
-
-# Add files needed to build and run action
-RUN mkdir -p /swift4Action/spm-build/Sources/Action
-ADD epilogue.swift /swift4Action
-ADD buildandrecord.py /swift4Action
-ADD swift4runner.py /swift4Action
-ADD spm-build/Package.swift /swift4Action/spm-build
-ADD spm-build/_Whisk.swift /swift4Action/spm-build/Sources/Action
-
-
-# Build
-RUN touch /swift4Action/spm-build/Sources/Action/main.swift
-RUN python /swift4Action/buildandrecord.py && rm 
/swift4Action/spm-build/.build/release/Action
-#RUN cd /swift4Action/spm-build; swift build -v -c release; rm 
/swift4Action/spm-build/.build/release/Action
-ENV FLASK_PROXY_PORT 8080
-EXPOSE 8080
-
-CMD ["/bin/bash", "-c", "cd /swift4Action && PYTHONIOENCODING='utf-8' python 
-u swift4runner.py"]
diff --git a/core/swift41Action/build.gradle b/core/swift41Action/build.gradle
deleted file mode 100644
index c70bc4c..0000000
--- a/core/swift41Action/build.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
-ext.dockerImageName = 'action-swift-v4.1'
-apply from: '../../gradle/docker.gradle'
diff --git a/core/swift41Action/buildandrecord.py 
b/core/swift41Action/buildandrecord.py
deleted file mode 100755
index c45b47d..0000000
--- a/core/swift41Action/buildandrecord.py
+++ /dev/null
@@ -1,77 +0,0 @@
-"""Python to generate build script.
-
-/*
- * 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.
- */
-"""
-from __future__ import print_function
-import os
-import sys
-from subprocess import check_output
-
-# Settings
-COMPILE_PREFIX = "/usr/bin/swiftc -module-name Action "
-LINKER_PREFIX =  "/usr/bin/swiftc -target x86_64-unknown-linux -sdk / -L 
/swift4Action/spm-build/.build/x86_64-unknown-linux/release -o 
/swift4Action/spm-build/.build/x86_64-unknown-linux/release/Action -module-name 
Action -emit-executable -Xlinker '-rpath=$ORIGIN'"
-GENERATED_BUILD_SCRIPT = "/swift4Action/spm-build/swiftbuildandlink.sh"
-SPM_DIRECTORY = "/swift4Action/spm-build"
-BUILD_COMMAND = ["swift", "build", "-v", "-Xswiftc", "-Onone", "-c", "release"]
-
-# Build Swift package and capture step trace
-print("Building action")
-out = check_output(BUILD_COMMAND, cwd=SPM_DIRECTORY)
-print("action built. Decoding compile and link commands")
-
-# Look for compile and link commands in step trace
-compileCommand = None
-linkCommand = None
-
-buildInstructions = out.decode("utf-8").splitlines()
-
-for instruction in buildInstructions:
-    if instruction.startswith(COMPILE_PREFIX):
-        compileCommand = instruction
-
-        # add flag to quiet warnings
-        compileCommand += " -suppress-warnings"
-
-    elif instruction.startswith(LINKER_PREFIX):
-        linkCommand = instruction
-
-# if found, create build script, otherwise exit with error
-if compileCommand is not None and linkCommand is not None:
-    print("Generated OpenWhisk Compile command: %s" % compileCommand)
-    print("=========")
-    print("Generated OpenWhisk Link command: %s" % linkCommand)
-
-    with open(GENERATED_BUILD_SCRIPT, "a") as buildScript:
-        buildScript.write("#!/bin/bash\n")
-        buildScript.write("echo \"Compiling\"\n")
-        buildScript.write("%s\n" % compileCommand)
-        buildScript.write("swiftStatus=$?\n")
-        buildScript.write("echo swiftc status is $swiftStatus\n")
-        buildScript.write("if [[ \"$swiftStatus\" -eq \"0\" ]]; then\n")
-        buildScript.write("echo \"Linking\"\n")
-        buildScript.write("%s\n" % linkCommand)
-        buildScript.write("else\n")
-        buildScript.write(">2& echo \"Action did not compile\"\n")
-        buildScript.write("exit 1\n")
-        buildScript.write("fi")
-
-    os.chmod(GENERATED_BUILD_SCRIPT, 0o777)
-    sys.exit(0)
-else:
-    print("Cannot generate build script: compile or link command not found")
-    sys.exit(1)
diff --git a/core/swift41Action/epilogue.swift 
b/core/swift41Action/epilogue.swift
deleted file mode 100644
index 25a9018..0000000
--- a/core/swift41Action/epilogue.swift
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.
- */
-
-// Imports
-import Foundation
-import Dispatch
-
-let inputStr: String = readLine() ?? "{}"
-let json = inputStr.data(using: .utf8, allowLossyConversion: true)!
-
-let _whisk_semaphore = DispatchSemaphore(value: 0)
-func _whisk_print_error(message: String, error: Error?){
-    if let error = error {
-        print("{\"error\":\"\(message) \(error.localizedDescription)\"}")
-    } else {
-       print("{\"error\":\"\(message)\"}")
-    }
-    _whisk_semaphore.signal()
-}
-
-// snippet of code "injected" (wrapper code for invoking traditional main)
-func _run_main(mainFunction: ([String: Any]) -> [String: Any]) -> Void {
-    do {
-        let parsed = try JSONSerialization.jsonObject(with: json, options: []) 
as! [String: Any]
-        let result = mainFunction(parsed)
-        if JSONSerialization.isValidJSONObject(result) {
-            do {
-                let jsonData = try JSONSerialization.data(withJSONObject: 
result, options: [])
-                if let jsonStr = String(data: jsonData, encoding: 
String.Encoding.utf8) {
-                    print("\(jsonStr)")
-                    _whisk_semaphore.signal()
-                } else {
-                    _whisk_print_error(message: "Error serializing data to 
JSON, data conversion returns nil string", error: nil)
-                }
-            } catch {
-                _whisk_print_error(message: "Failed to encode Dictionary type 
to JSON string:", error: error)
-            }
-        } else {
-            _whisk_print_error(message: "Error serializing JSON, data does not 
appear to be valid JSON", error: nil)
-        }
-    } catch {
-        _whisk_print_error(message: "Failed to execute action handler with 
error:", error: error)
-        return
-    }
-}
-
-// Codable main signature input Codable
-func _run_main<In: Decodable, Out: Encodable>(mainFunction: (In, @escaping 
(Out?, Error?) -> Void) -> Void) {
-    do {
-        let input = try Whisk.jsonDecoder.decode(In.self, from: json)
-        let resultHandler = { (out: Out?, error: Error?) in
-            if let error = error {
-                _whisk_print_error(message: "Action handler callback returned 
an error:", error: error)
-                return
-            }
-            guard let out = out else {
-                _whisk_print_error(message: "Action handler callback did not 
return response or error.", error: nil)
-                return
-            }
-            do {
-                let jsonData = try Whisk.jsonEncoder.encode(out)
-                let jsonString = String(data: jsonData, encoding: .utf8)
-                print("\(jsonString!)")
-                _whisk_semaphore.signal()
-            } catch let error as EncodingError {
-                _whisk_print_error(message: "JSONEncoder failed to encode 
Codable type to JSON string:", error: error)
-                return
-            } catch {
-                _whisk_print_error(message: "Failed to execute action handler 
with error:", error: error)
-                return
-            }
-        }
-        let _ = mainFunction(input, resultHandler)
-    } catch let error as DecodingError {
-        _whisk_print_error(message: "JSONDecoder failed to decode JSON string 
\(inputStr.replacingOccurrences(of: "\"", with: "\\\"")) to Codable type:", 
error: error)
-        return
-    } catch {
-        _whisk_print_error(message: "Failed to execute action handler with 
error:", error: error)
-        return
-    }
-}
-
-// Codable main signature no input
-func _run_main<Out: Encodable>(mainFunction: ( @escaping (Out?, Error?) -> 
Void) -> Void) {
-    let resultHandler = { (out: Out?, error: Error?) in
-        if let error = error {
-            _whisk_print_error(message: "Action handler callback returned an 
error:", error: error)
-            return
-        }
-        guard let out = out else {
-            _whisk_print_error(message: "Action handler callback did not 
return response or error.", error: nil)
-            return
-        }
-        do {
-            let jsonData = try Whisk.jsonEncoder.encode(out)
-            let jsonString = String(data: jsonData, encoding: .utf8)
-            print("\(jsonString!)")
-            _whisk_semaphore.signal()
-        } catch let error as EncodingError {
-            _whisk_print_error(message: "JSONEncoder failed to encode Codable 
type to JSON string:", error: error)
-            return
-        } catch {
-            _whisk_print_error(message: "Failed to execute action handler with 
error:", error: error)
-            return
-        }
-    }
-    let _ = mainFunction(resultHandler)
-}
-
-// snippets of code "injected", depending on the type of function the developer
-// wants to use traditional vs codable
-
diff --git a/core/swift41Action/spm-build/Package.swift 
b/core/swift41Action/spm-build/Package.swift
deleted file mode 100644
index 949fb7a..0000000
--- a/core/swift41Action/spm-build/Package.swift
+++ /dev/null
@@ -1,36 +0,0 @@
-// swift-tools-version:4.0
-// The swift-tools-version declares the minimum version of Swift required to 
build this package.
-
-/*
- * 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.
- */
-
-import PackageDescription
-
-let package = Package(
-    name: "Action",
-    products: [
-      .executable(
-        name: "Action",
-        targets:  ["Action"]
-      )
-    ],
-    targets: [
-      .target(
-        name: "Action"
-      )
-    ]
-)
diff --git a/core/swift41Action/swift4runner.py 
b/core/swift41Action/swift4runner.py
deleted file mode 100644
index d3609d3..0000000
--- a/core/swift41Action/swift4runner.py
+++ /dev/null
@@ -1,113 +0,0 @@
-"""Python proxy to run Swift action.
-
-/*
- * 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.
- */
-"""
-import os
-import glob
-import sys
-import subprocess
-import codecs
-import json
-sys.path.append('../actionProxy')
-from actionproxy import ActionRunner, main, setRunner  # noqa
-
-SRC_EPILOGUE_FILE = '/swift4Action/epilogue.swift'
-DEST_SCRIPT_FILE = '/swift4Action/spm-build/Sources/Action/main.swift'
-DEST_SCRIPT_DIR = '/swift4Action/spm-build'
-DEST_BIN_FILE = '/swift4Action/spm-build/.build/release/Action'
-
-BUILD_PROCESS = ['./swiftbuildandlink.sh']
-
-
-class Swift4Runner(ActionRunner):
-
-    def __init__(self):
-        ActionRunner.__init__(self, DEST_SCRIPT_FILE, DEST_BIN_FILE, 
DEST_SCRIPT_DIR)
-
-    # remove pre-existing binary before receiving a new binary
-    def preinit(self):
-        try:
-            os.remove(self.binary)
-        except: pass
-
-    def epilogue(self, init_message):
-        # skip if executable already exists (was unzipped)
-        if os.path.isfile(self.binary):
-            return
-
-        if 'main' in init_message:
-            main_function = init_message['main']
-        else:
-            main_function = 'main'
-        # make sure there is a main.swift file
-        open(DEST_SCRIPT_FILE, 'a').close()
-
-        with codecs.open(DEST_SCRIPT_FILE, 'a', 'utf-8') as fp:
-            os.chdir(DEST_SCRIPT_DIR)
-            for file in glob.glob("*.swift"):
-                if file not in ["Package.swift", "main.swift", 
"_WhiskJSONUtils.swift", "_Whisk.swift"]:
-                    with codecs.open(file, 'r', 'utf-8') as f:
-                        fp.write(f.read())
-            with codecs.open(SRC_EPILOGUE_FILE, 'r', 'utf-8') as ep:
-                fp.write(ep.read())
-
-            fp.write('_run_main(mainFunction: %s)\n' % main_function)
-            fp.write('_ = _whisk_semaphore.wait(timeout: .distantFuture)\n')
-
-    def build(self, init_message):
-        # short circuit the build, if there already exists a binary
-        # from the zip file
-        if os.path.isfile(self.binary):
-            # file may not have executable permission, set it
-            os.chmod(self.binary, 0o555)
-            return
-
-        p = subprocess.Popen(
-            BUILD_PROCESS,
-            stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE,
-            cwd=DEST_SCRIPT_DIR)
-
-        # run the process and wait until it completes.
-        # stdout/stderr will not be None because we passed PIPEs to Popen
-        (o, e) = p.communicate()
-
-        # stdout/stderr may be either text or bytes, depending on Python
-        # version, so if bytes, decode to text. Note that in Python 2
-        # a string will match both types; so also skip decoding in that case
-        if isinstance(o, bytes) and not isinstance(o, str):
-            o = o.decode('utf-8')
-        if isinstance(e, bytes) and not isinstance(e, str):
-            e = e.decode('utf-8')
-
-        if o:
-            sys.stdout.write(o)
-            sys.stdout.flush()
-
-        if e:
-            sys.stderr.write(e)
-            sys.stderr.flush()
-
-    def env(self, message):
-        env = ActionRunner.env(self, message)
-        return env
-
-
-if __name__ == '__main__':
-    setRunner(Swift4Runner())
-    main()
diff --git a/core/swift41Action/spm-build/_Whisk.swift 
b/core/swift42Action/_Whisk.swift
similarity index 100%
rename from core/swift41Action/spm-build/_Whisk.swift
rename to core/swift42Action/_Whisk.swift
diff --git a/core/swift42Action/build.gradle b/core/swift42Action/build.gradle
index 117edc2..87eeff3 100644
--- a/core/swift42Action/build.gradle
+++ b/core/swift42Action/build.gradle
@@ -17,15 +17,3 @@
 
 ext.dockerImageName = 'action-swift-v4.2'
 apply from: '../../gradle/docker.gradle'
-
-distDocker.dependsOn 'copyWhisk'
-distDocker.finalizedBy('cleanup')
-
-task copyWhisk(type: Copy) {
-    from '../swift41Action/spm-build/_Whisk.swift'
-    into '_Whisk.swift'
-}
-
-task cleanup(type: Delete) {
-    delete '_Whisk.swift'
-}
diff --git a/settings.gradle b/settings.gradle
index 78a9f66..3ae2969 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -17,8 +17,6 @@
 
 include 'tests'
 
-include 'core:swift41Action'
-
 include 'core:swift42Action'
 
 include 'core:swift51Action'
diff --git a/tests/dat/build.sh b/tests/dat/build.sh
index 3476292..29315e0 100755
--- a/tests/dat/build.sh
+++ b/tests/dat/build.sh
@@ -18,11 +18,6 @@
 
 set -e
 
-../../tools/build/compile.sh  HelloSwift4 swift:4.1 "-v"
-../../tools/build/compile.sh  SwiftyRequest swift:4.1 "-v"
-../../tools/build/compile.sh  SwiftyRequestCodable swift:4.1 "-v"
-../../tools/build/compile.sh  HelloSwift4Codable swift:4.1 "-v"
-
 ../../tools/build/compile5.sh  action-swift-v4.2 HelloSwift4 swift4.2 "-v"
 ../../tools/build/compile5.sh  action-swift-v4.2 HelloSwift4Codable swift4.2 
"-v"
 ../../tools/build/compile5.sh  action-swift-v4.2 SwiftyRequest swift4.2 "-v"
diff --git 
a/tests/src/test/scala/runtime/actionContainers/Swift41ActionContainerTests.scala
 
b/tests/src/test/scala/runtime/actionContainers/Swift41ActionContainerTests.scala
deleted file mode 100644
index ee4f6bd..0000000
--- 
a/tests/src/test/scala/runtime/actionContainers/Swift41ActionContainerTests.scala
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.
- */
-
-package runtime.actionContainers
-
-import java.io.File
-
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-import spray.json.{JsObject, JsString}
-import actionContainers.ResourceHelpers
-
-@RunWith(classOf[JUnitRunner])
-class Swift41ActionContainerTests extends SwiftActionContainerTests {
-
-  override lazy val swiftContainerImageName = "action-swift-v4.1"
-  override lazy val swiftBinaryName = 
"tests/dat/build/swift4.1/HelloSwift4.zip"
-  lazy val partyCompile = "tests/dat/build/swift4.1/SwiftyRequest.zip"
-  lazy val partyCompileCodable = 
"tests/dat/build/swift4.1/SwiftyRequestCodable.zip"
-
-  val httpCode = """
-       | import Dispatch
-       | func main(args:[String: Any]) -> [String:Any] {
-       |     var resp :[String:Any] = ["error":"getUrl failed"]
-       |     guard let urlStr = args["getUrl"] as? String else {
-       |         return ["error":"getUrl not found in action input"]
-       |     }
-       |     guard let url = URL(string: urlStr) else {
-       |         return ["error":"invalid url string \(urlStr)"]
-       |     }
-       |     let request = URLRequest(url: url)
-       |     let session = URLSession(configuration: .default)
-       |     let semaphore = DispatchSemaphore(value: 0)
-       |     let task = session.dataTask(with: request, completionHandler: 
{data, response, error -> Void in
-       |         print("done with http request")
-       |         if let error = error {
-       |             print("There was an error \(error)")
-       |         } else if let data = data,
-       |             let response = response as? HTTPURLResponse,
-       |             response.statusCode == 200 {
-       |             do {
-       |                 let respJson = try JSONSerialization.jsonObject(with: 
data)
-       |                 if respJson is [String:Any] {
-       |                     resp = respJson as! [String:Any]
-       |                 } else {
-       |                     resp = ["error":"Response from server is not a 
dictionary"]
-       |                 }
-       |             } catch {
-       |                 resp = ["error":"Error creating json from response: 
\(error)"]
-       |             }
-       |         }
-       |         semaphore.signal()
-       |     })
-       |     task.resume()
-       |     _ = semaphore.wait(timeout: .distantFuture)
-       |     return resp
-       | }
-     """.stripMargin
-
-  it should "support ability to use 3rd party packages like SwiftyRequest" in {
-    val zip = new File(partyCompile).toPath
-    val code = ResourceHelpers.readAsBase64(zip)
-
-    val (out, err) = withActionContainer() { c =>
-      val (initCode, initRes) = c.init(initPayload(code))
-      initCode should be(200)
-
-      val args = JsObject("message" -> (JsString("serverless")))
-      val (runCode, runRes) = c.run(runPayload(args))
-
-      runCode should be(200)
-      val json = runRes.get.fields.get("json")
-      json shouldBe Some(args)
-    }
-
-    checkStreams(out, err, {
-      case (o, e) =>
-        if (enforceEmptyOutputStream) o shouldBe empty
-        e shouldBe empty
-    })
-  }
-
-  it should "support ability to use escaping completion in Codable" in {
-    val zip = new File(partyCompileCodable).toPath
-    val code = ResourceHelpers.readAsBase64(zip)
-
-    val (out, err) = withActionContainer() { c =>
-      val (initCode, initRes) = c.init(initPayload(code, main = "mainCodable"))
-      initCode should be(200)
-
-      val (runCode, runRes) = c.run(runPayload(JsObject()))
-
-      runCode should be(200)
-      runRes.get.fields.get("greeting") shouldBe Some(JsString("success"))
-
-    }
-
-    checkStreams(out, err, {
-      case (o, e) =>
-        if (enforceEmptyOutputStream) o shouldBe empty
-        e shouldBe empty
-    })
-  }
-
-  // TODO
-  // skip for swift 4.2, it responds with 502 on init, stderr doesn't contain 
compile errors
-  // compile errors are contained in result
-  it should "log compilation errors" in {
-    val (out, err) = withActionContainer() { c =>
-      val code = """
-                   | 10 PRINT "Hello!"
-                   | 20 GOTO 10
-                 """.stripMargin
-
-      val (initCode, _) = c.init(initPayload(code))
-      initCode should not be (200)
-    }
-
-    checkStreams(out, err, {
-      case (o, e) =>
-        if (enforceEmptyOutputStream) o shouldBe empty
-        e.toLowerCase should include("error")
-    })
-  }
-
-  // TODO
-  // swift 4.2 exceptions executable exiting doesn't return error from web 
proxy or ends container
-  // the action times out
-  it should "return some error on action error" in {
-    val (out, err) = withActionContainer() { c =>
-      val code = """
-                   | // You need an indirection, or swiftc detects the div/0
-                   | // at compile-time. Smart.
-                   | func div(x: Int, y: Int) -> Int {
-                   |     return x/y
-                   | }
-                   | func main(args: [String: Any]) -> [String: Any] {
-                   |     return [ "divBy0": div(x:5, y:0) ]
-                   | }
-                 """.stripMargin
-
-      val (initCode, _) = c.init(initPayload(code))
-      initCode should be(200)
-
-      val (runCode, runRes) = c.run(runPayload(JsObject()))
-      runCode should be(502)
-
-      runRes shouldBe defined
-      runRes.get.fields.get("error") shouldBe defined
-    }
-
-    checkStreams(out, err, {
-      case (o, e) =>
-        if (enforceEmptyOutputStream) o shouldBe empty
-        if (enforceEmptyOutputStream) e shouldBe empty
-    })
-  }
-}
diff --git 
a/tests/src/test/scala/runtime/actionContainers/Swift41CodableActionContainerTests.scala
 
b/tests/src/test/scala/runtime/actionContainers/Swift41CodableActionContainerTests.scala
deleted file mode 100644
index 618f704..0000000
--- 
a/tests/src/test/scala/runtime/actionContainers/Swift41CodableActionContainerTests.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.
- */
-
-package runtime.actionContainers
-
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-import spray.json.JsObject
-
-@RunWith(classOf[JUnitRunner])
-class Swift41CodableActionContainerTests extends 
SwiftCodableActionContainerTests {
-  override lazy val swiftContainerImageName = "action-swift-v4.1"
-  override lazy val swiftBinaryName = 
"tests/dat/build/swift4.1/HelloSwift4Codable.zip"
-
-  // TODO
-  // swift 4.2 exceptions executable exiting doesn't return error from web 
proxy or ends container
-  // the action times out
-  it should "return some error on action error" in {
-    val (out, err) = withActionContainer() { c =>
-      val code = """
-                   | // You need an indirection, or swiftc detects the div/0
-                   | // at compile-time. Smart.
-                   | func div(x: Int, y: Int) -> Int {
-                   |    return x/y
-                   | }
-                   | struct Result: Codable{
-                   |    let divBy0: Int?
-                   | }
-                   | func main(respondWith: (Result?, Error?) -> Void) -> Void 
{
-                   |    respondWith(Result(divBy0: div(x:5, y:0)), nil)
-                   | }
-                 """.stripMargin
-
-      val (initCode, _) = c.init(initPayload(code))
-      initCode should be(200)
-
-      val (runCode, runRes) = c.run(runPayload(JsObject()))
-      runCode should be(502)
-
-      runRes shouldBe defined
-      runRes.get.fields.get("error") shouldBe defined
-    }
-
-    checkStreams(out, err, {
-      case (o, e) =>
-        if (enforceEmptyOutputStream) o shouldBe empty
-        e should not be empty
-    })
-  }
-}
diff --git a/tests/src/test/scala/runtime/sdk/Swift41SDKTests.scala 
b/tests/src/test/scala/runtime/sdk/Swift41SDKTests.scala
deleted file mode 100644
index edf66c6..0000000
--- a/tests/src/test/scala/runtime/sdk/Swift41SDKTests.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-package runtime.sdk
-
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-
-@RunWith(classOf[JUnitRunner])
-class Swift41SDKTests extends SwiftSDKTests {
-  override lazy val actionKind = "swift:4.1"
-}
diff --git a/tools/build/compile.sh b/tools/build/compile.sh
deleted file mode 100755
index 91e562f..0000000
--- a/tools/build/compile.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-set -e
-
-if [ -z "$1" ] ; then
-    echo 'Error: Missing action name'
-    exit 1
-fi
-if [ -z "$2" ] ; then
-    echo 'Error: Missing kind, for example swift:4.1'
-    exit 2
-fi
-
-if [ ${2} == "swift:4.1" ]; then
-  RUNTIME="openwhisk/action-swift-v4.1"
-  BASE_PATH="/swift4Action"
-  DEST_SOURCE="/$BASE_PATH/spm-build/Sources/Action"
-  OUTPUT_DIR="build/swift4.1"
-  mkdir -p $OUTPUT_DIR || true # create dir when not exist
-  # Due to a current bug in the Swift Docker image compile optimization is 
disabled by default.
-  # If you need compiler optimization you can override the BUILD_FLAGS to 
enable it
-  BUILD_FLAGS="-Xswiftc -Onone"
-else
-  echo "Error: Kind $2 not recognize"
-  exit 3
-fi
-DEST_PACKAGE_SWIFT="$BASE_PATH/spm-build/Package.swift"
-
-if [ -n "$3" ] ; then
-    BUILD_FLAGS=${3}
-fi
-
-
-echo "Using runtime $RUNTIME to compile swift"
-docker run --rm --name=compile-ow-swift -it -v "$(pwd):/owexec" $RUNTIME sh 
-ex -c "
-
-if [ -f \"/owexec/$OUTPUT_DIR/$1.zip\" ] ; then
-    rm \"/owexec/$OUTPUT_DIR/$1.zip\"
-fi
-
-echo 'Setting up build...'
-mkdir -p $DEST_SOURCE
-cp /owexec/actions/$1/Sources/*.swift $DEST_SOURCE/
-
-# action file can be either {action name}.swift or main.swift
-if [ -f \"$DEST_SOURCE/$1.swift\" ] ; then
-    echo 'renaming $DEST_SOURCE/$1.swift $DEST_SOURCE/main.swift'
-    mv \"$DEST_SOURCE/$1.swift\" $DEST_SOURCE/main.swift
-fi
-# Add in the OW specific bits
-cat $BASE_PATH/epilogue.swift >> $DEST_SOURCE/main.swift
-echo '_run_main(mainFunction:main)' >> $DEST_SOURCE/main.swift
-
-# Only for Swift4 and Swift5
-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
-# we have our own Package.swift, do a full compile
-swift build ${BUILD_FLAGS} -c release
-
-echo 'Creating archive $1.zip...'
-#.build/release/Action
-mkdir -p /owexec/$OUTPUT_DIR
-zip \"/owexec/$OUTPUT_DIR/$1.zip\" .build/release/Action
-
-"
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index 7115c6d..d60893b 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -54,7 +54,6 @@ docker version
 # Build runtime
 cd $ROOTDIR
 TERM=dumb ./gradlew \
-:core:swift41Action:distDocker \
 :core:swift42Action:distDocker \
 :core:swift51Action:distDocker \
 :core:swift53Action:distDocker \
diff --git a/tools/travis/publish.sh b/tools/travis/publish.sh
index 9498c1e..2e46b8f 100755
--- a/tools/travis/publish.sh
+++ b/tools/travis/publish.sh
@@ -30,9 +30,7 @@ IMAGE_PREFIX=$1
 RUNTIME_VERSION=$2
 IMAGE_TAG=$3
 
-if [ ${RUNTIME_VERSION} == "4.1" ]; then
-  RUNTIME="swift41Action"
-elif [ ${RUNTIME_VERSION} == "4.2" ]; then
+if [ ${RUNTIME_VERSION} == "4.2" ]; then
   RUNTIME="swift42Action"
 elif [ ${RUNTIME_VERSION} == "5.1" ]; then
   RUNTIME="swift51Action"

Reply via email to