tree: 99fb37e36dea79c1b5bf1c541dc0a028b979d7c7 [path history] [tgz]
  1. swift3Action/
  2. add_dylib.py
  3. build.sh
  4. Dockerfile
  5. README.md
  6. run.sh
  7. test0.swift
  8. test1.swift
  9. test2.swift
  10. test3.swift
  11. test4.swift
swift-playground-action/README.md

Enabling OpenWhisk Swift3 Action to use REPL PLayground

Test

./build.sh
./run.sh

Then inside container run basic test

time /usr/bin/swift /share/test0.swift
Hello World

and using dynamic library inside REPL calling SwiftyJSON:

time swift -I/swift3Action/spm-build/.build/debug -L /swift3Action/spm-build/.build/debug -lSwiftyJSON /share/test1.swift
Hello Joe Doe

Current issues - unable to build dynamic version of OpenSSL library

Unable to build OpenSSL - to reproduce install editor

apt-get -y install nano emacs

Modify Package.swift

cd /swift3Action/spm-build/
emacs Packages/OpenSSL-0.2.2/Package.swift

to add

products.append(Product(name: "OpenSSL", type: .Library(.Dynamic), modules: "openssl"))

and then run

root@87f331718d1e:/swift3Action/spm-build# swift build
error: the product named OpenSSL references a module that could not be found: openssl
fix: reference only valid modules from the product

Using

products.append(Product(name: "OpenSSL", type: .Library(.Dynamic), modules: "OpenSSL"))

leads to

root@87f331718d1e:/swift3Action/spm-build# swift build
Linking ./.build/debug/libOpenSSL.so
<unknown>:0: error: no input files
<unknown>:0: error: build had 1 command failures
error: exit(1): /usr/bin/swift-build-tool -f /swift3Action/spm-build/.build/debug.yaml

Optimally this should work ...

time swift -I/swift3Action/spm-build/.build/debug -L /swift3Action/spm-build/.build/debug -lSwiftyJSON -lOpenSSL /share/test2.swift
<unknown>:0: error: missing required module 'OpenSSL'