def sources()

in core/swift57Action/swiftbuild.py [0:0]


def sources(launcher, source_dir, main):
    actiondir = "%s/Sources" % source_dir
    # copy the launcher fixing the main
    dst = "%s/main.swift" % actiondir
    with codecs.open(dst, 'a', 'utf-8') as d:
        with codecs.open(launcher, 'r', 'utf-8') as e:
            code = e.read()
            code += "try await _WhiskRuntime.wiskRunLoop { jsonData in\n"
            code += "   await _WhiskRuntime.runAsyncMain(mainFunction: %s, json: jsonData)\n" % main
            code += "}\n"
            d.write(code)