jthomas commented on a change in pull request #2369: document how to add swift dependencies URL: https://github.com/apache/incubator-openwhisk/pull/2369#discussion_r121903926
########## 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: The user can just do `swift build -c release` as @akrabat suggests. `buildandrecord.py` and `swiftbuildandlink` are not necessary here. ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
