Skip to content

0.4.0

Compare
Choose a tag to compare
@MaxDesiatov MaxDesiatov released this 21 Jul 21:25
· 493 commits to main since this release
0e8f003

This release adds a few major features, namely carton init and carton test commands, carton sdk local subcommand, and enables support for linking with Foundation automatically.

Thanks to @carson-katri, @RayZhao1998, @JaapWijnen and @broadwaylamb for their contributions to this release!

New features:

Firstly, carton dev no longer requires a --destination flag with a manually crafted destination.json file to link with Foundation. If your project has import Foundation anywhere in its source code, a subset of Foundation provided with SwiftWasm is automatically linked. Please check the list of Foundation types currently unavailable in SwiftWasm for more details on Foundation compatibility (mostly filesystem, socket, multi-threading, and APIs depending on those are disabled).

The new carton init command initializes a new SwiftWasm project for you (similarly to swift package init) with multiple templates available at your choice. carton init --template tokamak creates a new Tokamak project, while carton init --template basic (equivalent to carton init) creates an empty SwiftWasm project with no dependencies. Also, carton init list-templates provides a complete list of templates (with only basic and tokamak available currently).

The new carton test command runs your test suite in the wasmer environment. Unfortunately, this currently requires a presence of LinuxMain.swift file and explicit test manifests, --enable-test-discovery flag is not supported yet. Projects that can build their test suite on macOS can use swift test --generate-linuxmain command to generate this file.

Breaking changes:

The bundled carton dev JavaScript entrypoint has been updated to fix runtime issues in the Swift-to-JavaScript bridge API. Because of this, projects that depend on JavaScriptKit should specify c90e82f revision as a dependency:

  dependencies: [
    .package(url: "https://github.com/kateinoigakukun/JavaScriptKit", .revision("c90e82f")),
  ],

Unfortunately, specifying a JavaScriptKit version in Package.swift as a dependency is not supported by SwiftPM due to the use of unsafe flags, see swiftwasm/JavaScriptKit#6 for more details.

Closed issues:

  • Avoid running the tests if can't build them (#56)
  • Verify SDK is already installed before installing the same version (#45)
  • Automatically create destination JSON to allow linking Foundation (#4)
  • Watcher should detect custom paths in Package.swift (#1)

Merged pull requests: