Giter VIP home page Giter VIP logo

carton's Introduction

carton ๐Ÿ“ฆ

Watcher, bundler, and test runner for your SwiftWasm apps

The main goal of carton is to provide a smooth zero-config experience when developing for WebAssembly. It currently supports these features with separate commands:

  • Watching the app for source code changes and reloading it in your browser with swift run carton dev.
  • Running your XCTest suite in the full JavaScript/DOM environment with swift run carton test.
  • Optimizing and packaging the app for distribution with swift run carton bundle.

Motivation

The main motivation for carton came after having enough struggles with webpack.js, trying to make its config file work, looking for appropriate plugins. At some point the maintainers became convinced that the required use of webpack in SwiftWasm projects could limit the wider adoption of SwiftWasm itself. Hopefully, with carton you can avoid using webpack altogether. carton also simplifies a few other things in your SwiftWasm development workflow such as toolchain and SDK installations.

Getting started

Requirements

Installation

To install carton as a SwiftPM plugin, first add the following line to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/swiftwasm/carton", from: "1.0.0"),
],

Warning

  • If you already use carton before 0.x.x versions via Homebrew, you can remove it with brew uninstall carton and install the new version as a SwiftPM dependency.
  • Also please remove the old .build directory before using the new carton

Usage

The swift run carton dev command builds your project with the SwiftWasm toolchain and starts an HTTP server that hosts your WebAssembly executable and a corresponding JavaScript entrypoint that loads it. The app, reachable at http://127.0.0.1:8080/, will automatically open in your default web browser. The port that the development server uses can also be controlled with the --port option (or -p for short). You can edit the app source code in your favorite editor and save it, carton will immediately rebuild the app and reload all browser tabs that have the app open. You can also pass a --verbose flag to keep the build process output available, otherwise stale output is cleaned up from your terminal screen by default. If you have a custom index.html page you'd like to use when serving, pass a path to it with a --custom-index-page option.

The swift run carton test command runs your test suite in wasmer, node or using your default browser. You can switch between these with the --environment option, passing either: command, node or browser. Code that depends on JavaScriptKit should pass either --environment node or --environment browser options, depending on whether it needs Web APIs to work. Otherwise the test run will not succeed, since JavaScript environment is not available with --environment command. If you want to run your test suite on CI or without GUI but on browser, you can pass --headless flag. It enables WebDriver-based headless browser testing. Note that you need to install a WebDriver executable in PATH before running tests. You can use the command with a prebuilt test bundle binary instead of building it in carton by passing --prebuilt-test-bundle-path <your binary path>.

The swift run carton bundle command builds your project using the release configuration (although you can pass the --debug flag to it to change that), and copies all required assets to the Bundle directory. You can then use a static file hosting (e.g. GitHub Pages) or any other server with support for static files to deploy your application. All resulting bundle files except index.html are named by their content hashes to enable cache busting. As with swift run carton dev, a custom index.html page can be provided through the --custom-index-page option. You can also pass --debug-info flag to preserve names and DWARF sections in the resulting .wasm file, as these are stripped in the release configuration by default. By default, swift run carton bundle will run wasm-opt on the resulting .wasm binary in order to reduce its file size. That behaviour can be disabled (in order to speed up the build) by appending the --wasm-optimizations none option.

All commands that delegate to swift build and swiftc (namely, dev, test, and bundle) can be passed -Xswiftc arguments, which is equivalent to -Xswiftc in swift build. All -Xswiftc arguments are propagated to swiftc itself unmodified.

All of these commands and subcommands can be passed a --help flag that prints usage info and information about all available options.

How does it work?

carton bundles a WASI polyfill, which is currently required to run any SwiftWasm code, and the JavaScriptKit runtime for convenience. carton also embeds an HTTP server for previewing your SwiftWasm app directly in a browser. The development version of the polyfill establishes a helper WebSocket connection to the server, so that it can reload development browser tabs when rebuilt binary is available. This brings the development experience closer to Xcode live previews, which you may have previously used when developing SwiftUI apps.

carton does not require any config files for these basic development scenarios, while some configuration may be supported in the future, for example for complex asset pipelines if needed. The only requirement is that your Package.swift contains at least a single executable product, which then will be compiled for WebAssembly and served when you start swift run carton dev in the directory where Package.swift is located.

carton is built as a SwiftPM Plugin with SwiftNIO, and supports both macOS and Linux. (Many thanks to everyone supporting and maintaining those projects!)

Tip

There is no comprehensive documentation about the internal architecture of carton, but this page might be helpful to understand the current architecture and rationale.

Running swift run carton dev with the release configuration

By default swift run carton dev will compile in the debug configuration. Add the --release flag to compile in the release configuration.

Version compatibility

carton previously embedded runtime parts of the JavaScriptKit library. This runtime allows Swift and JavaScript code to interoperate in Node.js and browser environments. Because of how JavaScriptKit runtime was embedded, older versions of JavaScriptKit were incompatible with different versions of carton and vice versa. This incompatibility between different versions was resolved starting with JavaScriptKit 0.15 and carton 0.15. All version combinations of carton and JavaScriptKit higher than those are compatible with each other.

You still have to keep in mind that older versions of SwiftWasm may be incompatible with newer carton. You can follow the compatibility matrix if you need to use older verions:

carton version SwiftWasm version JavaScriptKit version Tokamak version
1.0+ 5.9.2
0.20+ 5.9
0.15+ 5.6 0.15+ 0.10.1+
0.14 5.6 0.14 0.10
0.13 5.5 0.13 0.9.1
0.12.2 5.5 0.12 0.9.1
0.12.0 5.5 0.11 0.9.0
0.11.0 5.4 0.10.1 0.8.0

Contributing

Sponsorship

If this tool saved you any amount of time or money, please consider sponsoring the SwiftWasm organization. Or you can sponsor some of our maintainers directly on their personal sponsorship pages: @carson-katri, @kateinoigakukun, and @MaxDesiatov. While some of the sponsorship tiers give you priority support or even consulting time, any amount is appreciated and helps in maintaining the project.

Become a gold or platinum sponsor and contact maintainers to add your logo on our README on GitHub with a link to your site.

Coding Style

This project uses SwiftFormat and SwiftLint to enforce formatting and coding style. We encourage you to run SwiftFormat within a local clone of the repository in whatever way works best for you either manually or automatically via an Xcode extension, build phase or git pre-commit hook etc.

To guarantee that these tools run before you commit your changes on macOS, you're encouraged to run this once to set up the pre-commit hook:

brew bundle # installs SwiftLint, SwiftFormat and pre-commit
pre-commit install # installs pre-commit hook to run checks before you commit

Refer to the pre-commit documentation page for more details and installation instructions for other platforms.

SwiftFormat and SwiftLint also run on CI for every PR and thus a CI build can fail with incosistent formatting or style. We require CI builds to pass for all PRs before merging.

Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

carton's People

Contributors

antoniocandinho avatar broadwaylamb avatar carson-katri avatar dependabot[bot] avatar ephemer avatar feuermurmel avatar fjtrujy avatar furby-tm avatar gibachan avatar ie-ahm-robox avatar j-f1 avatar jaapwijnen avatar kateinoigakukun avatar literalpie avatar maxdesiatov avatar noppefoxwolf avatar omochi avatar p- avatar ratranqu avatar rayzhao1998 avatar strega avatar swiftcoderjoe avatar thecb4 avatar yonihemi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carton's Issues

Consider implementing `carton sdk install` command

carton sdk update should look for the latest SwiftWasm SDK version and install it if available. I'm thinking about a new ~/.carton/sdk directory for this. carton should still detect present swiftenv and system versions and pick one up if suitable, but shouldn't interfere with them.

Replace hard-coded path delimiters

I noticed on line 178 of Toolchain.swift, there is a hard-coded path delimiter /. Other places in the code base might be using hard-coded path delimiters too, but I didn't check. In my opinion, they are bad for cross-platform compatibility (at least with Windows and many other DOS-descendents). It's probably better to replace them with URL.appendingPathComponent(_:), TSCBasic.AbsolutePath.appending(component:), or TSCBasic.AbsolutePath.appending(components:).

I think this is a good "beginner bug" if anyone is looking for one to work on.

Root manifest not found when trying to run carton

Hello, when trying to execute anything with Carton, I'm getting the following error.
Do you have any idea what could be wrong? ๐Ÿ™‚

 โœ˜ jankaltoun@jan-kaltoun ๎‚ฐ ~/Code/Personal/Swift ๎‚ฐ carton dev
Polyfill integrity verified: /Users/jankaltoun/.carton/static/dev.js
Inferring basic settings...
- swift executable: /Users/jankaltoun/.carton/sdk/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin/swift
Swift version 5.3-dev (LLVM b54b6b832e, Swift 4bb1458ec4)
Target: x86_64-apple-darwin19.5.0
Parsing package manifest: /Users/jankaltoun/.carton/sdk/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin/swift package dump-package
Error: Process failed with non-zero exit status and following error output:
error: root manifest not found

JavaScriptKit dependency missing in the `basic` template

While carton ships JavaScriptKit runtime, the runtime bits don't work without the Swift bits of JavaScriptKit. The default basic template has no JavaScriptKit dependency specified in the generated Package.swift, which leads to runtime errors when a project is built from this template as is.

Error: could not find executable

I'm trying to get the demo for Tokamak, which has me install carton. I believe I have done that properly.
I then cloned this repo, then from the project root I run carton dev --product Tokamak This leads to the following error

(base) โžœ  Tokamak git:(main) โœ— carton dev --product TokamakDemo
Polyfill integrity verified: /Users/stevenprichard/.carton/static/dev.js
Inferring basic settings...
- swift executable: /Users/stevenprichard/.swiftenv/versions/5.2.4/usr/bin/swift
Parsing package manifest: /Users/stevenprichard/.swiftenv/versions/5.2.4/usr/bin/swift package dump-package
Error: could not find executable for '/Users/stevenprichard/.swiftenv/versions/5.2.4/usr/bin/swift'

There appears to be nothing in my ~/.swiftenv/versions
Checking my swift version...

(base) โžœ  Tokamak git:(main) โœ— swift --version
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.5.0

Attempting to check the version of swift swiftenv is using....

(base) โžœ  Tokamak git:(main) โœ— swiftenv which swift
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift

swiftenv looks like it can see the local swift version...

(base) โžœ  Tokamak git:(main) โœ— swiftenv local
5.2.4

Not sure if all this context is needed, just kinda at a lost. Given the error I am getting from
carton dev --product TokamakDemo it doesn't appear like things are messing. Might be my environment/machine?
Any thoughts?

`carton sdk install` crashes when passed an invalid version

% carton sdk install blah                                                                                                                                   
Fetching release assets from https://api.github.com/repos/swiftwasm/swift/releases/tags/swift-blah
Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "assets", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"assets\", intValue: nil) (\"assets\").", underlyingError: nil)): file /private/tmp/carton-20200722-22952-1js7ud6/carton-0.4.1/Sources/SwiftToolchain/ToolchainManagement.swift, line 132
zsh: illegal hardware instruction  carton sdk install blah

Compilation progress no longer displayed

Is this a regression in 0.8? Names of compiled files and the total count of files being built is no longer displayed, only the Compiling... message is shown.

Implement `carton test` command

This should build tests, passing the resulting binary to a test runner after that. This could be implemented in a few separate steps:

  • use wasmer as a basic CLI test runner;
  • use the --enable-test-discovery flag to inject the JSON test observer so that test reports can be parsed (blocked by the lack of libIndexStore.dylib in recent snapshots);
  • consider using Node.js as another CLI runner option? Tracked separately in #174
  • host the test bundle via HTTP on localhost with a browser loading an appropriate entrypoint, running the tests and reporting test results back to the HTTP server;
  • make wasmer an optional dependency. Tracked separately in #177

There's a question of how the target environment is selected. The wasmer option is what will be implemented first, and probably will be the default, but when browser environments are supported, should carton test launch tests in parallel in all possible environments? What should the appropriate option name be for selecting a specific test runner? --target (as in "the target environment"), --host (as in "the webassembly host"), --environment (probably the most unambiguous), --runner? I'm currently thinking of --environment, but all feedback is welcome as usual.

Demo cannot be run on Safari 14

Everytime I get the Unhandled Promise Rejection: TypeError: Conversion from 'BigInt' to 'number' is not allowed. error due to print I believe.

Consider implementing `carton deploy` command

This should simplify deployment to common environments such as GitHub Pages, Netlify, S3/CloudFront, Cloudflare etc. Given that there's still a possibility for carton to become a tool supporting cross-compilation of Swift apps to multiple platforms (I primarily have Android in mind, but Windows and Linux/Docker are possible directions too), maybe this should be implemented as plugins, or separate executables that carton could delegate to. E.g. for Android it could deploy to an emulator, real device, Play Store etc.

Print the error output of `swift package dump-package`

Currently when swift package dump-package fails, its error output is not presented to the user, while the printed error message is confusing. In 0.4.1 it's

Error: No package found

while in main it's

Error: The `Package.swift` manifest file could not be found. Please
navigate to a directory that contains `Package.swift` and restart

Neither of these are valid error messages when Package.swift is present, but it has a typo or doesn't compile for some other reason.

Implement `carton bundle` command

This command should invoke swift build (reusing the toolchain inference code that's already used by carton dev and carton sdk) in the directory for the only executable product, or a product specified with the --product option, similar to how carton dev infers a product to build. It should build the app in the release mode with swift build -c release, possibly passing -Osize flag to swiftc if it the release configuration doesn't do this by default already. After that, it should look for the presence of wasm-strip and wasm-opt on the system and apply size optimizations with those if present, otherwise suggesting to install corresponding WABT and binaryen packages (via Homebrew on macOS).

We also need a new bundle.js JavaScript entrypoint, similar to what we have with dev.js, but without the WebSocket bits, as the release bundle doesn't need hot reloads. This entrypoint should also by compiled by webpack in prod mode for size optimizations. The only question I don't have a clear answer to is, what the final bundle directory should be to which carton bundle writes the output? A few suggestions:

  • .build/bundle/wasm, means that the generated fails get ignored by Git most probably (since .build is in .gitignore most of the time)
  • Bundle, capitalized for consistency with Sources and Tests
  • CartonBundle, in case Bundle is used by other tools, but this one seems a bit verbose to me.

I have a slight preference towards the first option as these files are not supposed to be added to the repository in most of the cases, but the problem is that .build is not visible in Finder and other file managers by default, so I could see some beginner users not finding the final product on the file system. With directories like Bundle we'd need users to explicitly opt out of committing the final products to their repository (again, most of the time, unless they don't have .build in their .gitignore yet, which would make this point applicable to the .build option too).

Sync JavaScriptKit runtime library with Package.resolved

AFAIU, carton supports only one version of JavaScriptKit runtime library now. If carton can dynamically determine the JavaScriptKit runtime library version based on Package.resolved and embed it, it would be really helpful.

Make Wasmer an optional dependency?

After #42 is resolved, we'll be able to run tests in browsers. We should still allow using Wasmer, but I think it's easier to expect that people have a browser installed than Wasmer? Especially as currently it's not as easy to install Wasmer on Apple Silicon via Homebrew. WDYT?

Backtraces demangling

In absence of proper debugging support in browsers it's very hard to debug things where there's no backtrace whatsoever, even for array out of bounds errors.

We need to investigate whether supporting swift-backtrace is viable.

Add static file support

This is a prerequisite for TokamakUI/Tokamak#155. Ideally there would be support for using Bundle to get the URL for the static resources at runtime.


@MaxDesiatov:

I think that both carton and Tokamak should support SwiftPM resources, the only obvious problem being that the Bundle type is declared in Foundation...

@j-f1:

Could carton or something else implement the Bundle class itself?

@MaxDesiatov:

It probably could, but I'm not sure whether SwiftPM assumes a specific Bundle implementation in its code and whether we could swap that with our own. Needs some testing and research... ๐Ÿงช

Use `SerializedDiagnostics` for diagnostics parsing

This is already implemented in the latest stable version of TSC. Required output files can be emitted by passing -Xswiftc -serialize-diagnostics to swift build. This will allow us to keep the output of swift build untouched during the build process, thus preserving the build progress. Build progress output is currently absent, but was available before our own diagnostic parsing from swift build stdout was introduced.

Passing a non-existent version to `sdk install` produces unreadable error

The error produced is:

Fetching release assets from https://api.github.com/repos/swiftwasm/swift/releases/tags/swift-wasm-DEVELOPMENT-SNAPSHOT-2020-07-03-a
Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "assets", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"assets\", intValue: nil) (\"assets\").", underlyingError: nil)): file /private/tmp/carton-20200626-96467-1jqewc9/carton-0.2.0/Sources/carton/Toolchain/ToolchainManagement.swift, line 149

More commands for `carton sdk`

It seems that there's only one command install for carton sdk in current version.

If we have the situation of consisting multiple versions of sdk, I think we need to implement more commands for carton sdk.

  • carton sdk list: Show all installed sdks.
  • carton sdk use: Use a specific version of sdk you want.

If this proposal is reasonable, I'll be interested in implement it. :)

Method with i64 return type fails on Safari 13+14

Using JavaScriptKit as only dependency, trying to instantiate a Date() fails on Safari (13.1.1, 14) with:
TypeError: i64 not allowed as return type or argument to an imported function

Stacktrace

TypeError: i64 not allowed as return type or argument to an imported function

wasm-stub
<?>.wasm-function[gettimeofday]
<?>.wasm-function[CFAbsoluteTimeGetCurrent]
<?>.wasm-function[$s10Foundation4DateVACycfC]
<?>.wasm-function[main]
<?>.wasm-function[__original_main]
<?>.wasm-function[_start]
wasm-stub
_start
(anonymous function) โ€” e8900d1b3895f276.js:1:47960
(anonymous function) โ€” e8900d1b3895f276.js:1:184568
asyncFunctionResume
[native code]

Same code runs fine on Chrome and Firefox. Tried with latest blessed carton versions and with latest swiftwasm+JavaScriptKit, same results.

Assuming it's related to swiftwasm/JavaScriptKit#56. Could/should we incorporate this polyfill in JavaScriptKit?

Apple Silicon support for Homebrew installations

I'm happy to report that our Intel build of the SwiftWasm toolchain works without any issues so far on Apple Silicon hardware. Same for carton dev and carton bundle when carton itself is built from sources. The only issue is that installation of carton from Homebrew is not as smooth, as it depends on wasmer, which currently is not available on Apple Silicon due to wasmerio/wasmer#1814

Delay on Ctrl-C with error: Could not stop HTTP server

Currently, when attempting to stop the command-line invocation of carton with Ctrl-C, you get this error:

[ ERROR ] Could not stop HTTP server: Abort(identifier: "500", status: 
NIOHTTP1.HTTPResponseStatus.internalServerError, headers: , 
reason: "Server stop took too long.", 
source: Vapor.ErrorSource(file: "/private/tmp/carton-20200616-45672-cfefqh/carton-0.1.0/.build/checkouts/vapor/Sources/Vapor/HTTP/Server/HTTPServer.swift", function: "close()", line: 310, column: 31, range: nil))
ERROR: Cannot schedule tasks on an EventLoop that has already shut down. 
This will be upgraded to a forced crash in future SwiftNIO versions.

According to SwiftNIO, this doesn't seem to be an issue with SwiftNIO, probably caused by how Vapor uses their API. Upgrading to the latest version of Vapor is blocked by vapor/vapor#2385

Allow carton to use a provided HTML template file

I think it would be a great addition to have the ability to specify an HTML template for carton to use in the event that someone wants to customize it. The feature would be similar to HtmlWebpackPlugin and allow for specifying a path to an HTML template file, that carton could then inject the proper script tags into.

What are your thoughts on this? Has there already been something similar thought of or requested? I would be happy to contribute a PR to help bring this functionality!

Xcode 12 beta 3 compatibility

Using wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a on macOS Big Sur beta 3.

swift command crashes with:

Assertion failed: (!Files.empty() || failedToLoad()), function getFiles, file /Users/runner/runners/2.263.0/work/swift/swift/include/swift/AST/Module.h, line 363.
Stack dump:
0.	Program arguments: /Users/carson/.carton/sdk/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin/swift -frontend -repl -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk -color-diagnostics -target-sdk-version 11.0 -module-name REPL 
1.	Swift version 5.3-dev (LLVM b54b6b832e, Swift 4bb1458ec4)
0  swift                    0x000000010b86a7b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010b869738 llvm::sys::RunSignalHandlers() + 248
2  swift                    0x000000010b86adad SignalHandler(int) + 285
3  libsystem_platform.dylib 0x00007fff6d26b5bd _sigtramp + 29
4  swift                    0x000000010d79e6cc cmark_strbuf__initbuf + 161791
5  libsystem_c.dylib        0x00007fff6d1257c0 abort + 120
6  libsystem_c.dylib        0x00007fff6d124a76 err + 0
7  swift                    0x000000010b925363 swift::CompilerInstance::performParseAndResolveImportsOnly() (.cold.1) + 35
8  swift                    0x0000000107b16c4b swift::CompilerInstance::performParseAndResolveImportsOnly() + 267
9  swift                    0x0000000107b16c65 swift::CompilerInstance::performSema() + 21
10 swift                    0x0000000107a31109 performCompile(swift::CompilerInstance&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 2329
11 swift                    0x0000000107a2f7f5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3397
12 swift                    0x00000001079c9c3d main + 861
13 libdyld.dylib            0x00007fff6d04cc71 start + 1
[1]    16096 abort      ~/.carton/sdk/wasm-DEVELOPMENT-SNAPSHOT-2020-06-12-a/usr/bin/swift

swift package dump-package crashes with:

/Users/carson/Desktop/Web/Tokamak: error: manifest parse error(s):
<unknown>:0: error: invalid Darwin version number: macos11.0
<unknown>:0: error: invalid version number in '-target x86_64-apple-macos11.0'
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Combine.framework/Modules/Combine.swiftmodule/x86_64-apple-macos.swiftinterface:1:1: error: failed to build module 'Combine' from its module interface; the compiler that produced it, 'Apple Swift version 5.3 (swiftlang-1200.2.22.2 clang-1200.0.25.1)', may have used features that aren't supported by this compiler, 'Swift version 5.3-dev (LLVM b54b6b832e, Swift 4bb1458ec4)'
// swift-interface-format-version: 1.0
^
<unknown>:0: error: invalid Darwin version number: macos11.0
<unknown>:0: error: invalid version number in '-target x86_64-apple-macos11.0'

Not sure if this is fixed in a more recent snapshot, but if it is then carton needs to be updated.

Support resources for package dependencies

Currently package resources are only correctly handled for targets within the root package. Resources in packages that the root package depends on aren't handled, and even for their transitive dependencies to be handled we need to parse those packages from the Package.resolved file. This is probably blocked by #120, as I guess we need to use libSwiftPM to get that working.

Watcher should detect custom paths in Package.swift

Currently, the watcher defaults to the Sources directory for the dev command and Sources and Tests directories for the test command. If the source code is in a different location overriden in target definitions in Package.swift, the watcher doesn't pick those up.

Add `--watch` flag to `carton test`

carton test doesn't block and watch for changes by default, as it's primarily supposed to run on CI where this behaviour is undesired. At the same time, watching for changes in tests and their dependencies is still useful when developing locally.

Test all commands on CI

None of the implemented commands are currently tested end-to-end with GitHub Actions, but all of this can (and should) be automated.

Support local filesystem archives in `carton sdk install`

carton sdk install now can take either a version spec or a direct archive URL. There's another use case for archives downloaded from CI to the local filesystem. carton sdk install should recognize local filesystem paths and attempt to install those.

Watch `.swift-version` file for changes

This is a follow-up to #10, our current watcher can only watch whole directories, it's not granular enough to watch files.

Some special care is needed here, as we don't want to just rebuild the project, we need to make sure that it's rebuilt with the toolchain specified in .swift-version, and it should be downloaded if absent.

Support downloading Ubuntu 20.04 SDK

We currently don't check for distribution version on Linux, which means we could run on unsupported distributions, or download wrong toolchain that won't work. carton should check which Linux distribution it runs on, and then download a compatible toolchain archive for it, or notify the user about incompatibility.

Accordingly, it should check CPU architecture, as it would be great to support SwiftWasm on ARM64 Linux distributions, e.g. Raspbian after swiftwasm/swift#1854 is resolved.

No package found when invoking `carton dev`

I initialized a project with carton init, but when I carton dev, Error: No package found occurs.

Environment

MacOS: 10.15.5
SwiftWasm: wasm-DEVELOPMENT-SNAPSHOT-2020-07-02-a

Screen Shot 2020-07-26 at 9 59 40 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.