You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/06/14 20:30:39 UTC

[GitHub] paulcastro commented on a change in pull request #2369: document how to add swift dependencies

paulcastro commented on a change in pull request #2369: document how to add swift dependencies
URL: https://github.com/apache/incubator-openwhisk/pull/2369#discussion_r122056176
 
 

 ##########
 File path: docs/actions.md
 ##########
 @@ -659,6 +661,42 @@ docker run --rm -it -v "$(pwd):/owexec" openwhisk/swift3action bash
   echo '_run_main(mainFunction:main)' >> /swift3Action/spm-build/main.swift
   ```
 
+  Copy any additional source files to `/swift3Action/spm-build/`
+
+- Create Package.swift
+  If you need to add dependencies create a Package.swift file like the following:
+  ```swift
+  import PackageDescription
+  
+  let package = Package(
+    name: "Action",
+        dependencies: [
+            .Package(url: "https://github.com/IBM-Swift/Kitura-net.git", "1.0.1"),
+            .Package(url: "https://github.com/IBM-Swift/SwiftyJSON.git", "14.2.0"),
+            .Package(url: "https://github.com/IBM-Swift/swift-watson-sdk.git", "0.4.1"),
+            .Package(url: "https://github.com/apple/example-package-deckofplayingcards.git", majorVersion: 3)
+        ]
+  )
+  ```
+
+As you can see this example adds `swift-watson-sdk` and `example-package-deckofplayingcards` dependencies.
+Notice that `Kitura-net` and `SwiftyJSON.git` are the minimum required dependencies to include.
+
+- Copy Package.swift
+  ```
+  cp -f /owexec/Package.swift /swift3Action/spm-build/Package.swift
+  ```
+
+- Remove .build directory
+  ```
+  rm -rf /swift3Action/spm-build/.build/
+  ```
+
+- Generate a new swiftbuildandlink.sh
+  ```
+  python /swift3Action/buildandrecord.py
+  ```
 
 Review comment:
   You are correct!
   
   `buildandrecord.py` generates the `swiftbuildandlink.sh` in order to skip unnecessary steps when a swift action is initialized. This shaved off a few seconds from swift action cold starts.  
   
   It's definitely not necessary for pre-compilation.  
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services