Resolves#114.
As support for SwiftLint in Danger seems a bit buggy (causing duplicate warning comments sometimes), this PR calls SwiftLint through a separate action that displays warnings only in the PR diff and hopefully in better way.
* Add support for Ubuntu 20.04
* Refine formatting
* Move SwiftLint to a separate GitHub Action
* Fix linker warnings
* Remove `danger.yml` and `Dangerfile.swift`
* Remove `--strict` argument from `swiftlint.yml`
* Update README.md
In the latest 5.3 toolchain all known issues with IndexStoreDB and SwiftPM support were resolved.
Resolves the second point of #42.
Thanks to this you no longer need to maintain `LinuxMain.swift` and `XCTestManifests.swift` files in your test suites, so these are deleted from the test app `Tests` directory.
TTY terminal output is unavailable on CI, or when users redirect output to a file or a pipe. In those cases `TerminalController` initializer returns `nil`. SwiftPM has a wrapper `InteractiveWriter` class for it, which writes output to stdout directly in that case. I've copied that, and replaced all uses of `TerminalController` with it. A VSCode task is added to test that.
In my testing it looks like download progress reporting is quite spammy, so it now has `removeDuplicates` Combine operator added to make it output only when values differ significantly from each other.
Additionally, SDK installs can hit GitHub API rate limit on CI nodes, so `carton` now reads `GITHUB_TOKEN` environment variable, which gives much higher limits to authenticated API users.
We can now also run various `carton` commands on CI for basic end-to-end testing.
Resolves#112.
Handling of the `static.zip` archive has changed slightly, where now the archive no longer has a nested `static` directory in it, which makes packaging slightly more predictable. For some reason passing wildcards to `zip` no longer works for me.
This change requires `wasm-5.3-SNAPSHOT-2020-09-08-a` or later, therefore the default toolchain version has been bumped.
Implements the `carton dev` part of #38, `carton bundle` support will be implemented in a future PR.
Resolves#77.
Also updates the Tokamak template to use the `App`/`Scene` lifecycle and to depend on the 0.3 version.
JavaScriptKit version check is also updated.
Previously, initial manifest parsing error was ignored with `try?` and `ToolchainError.missingPackageManifest` was thrown instead. Now the `package` property is no longer optional, but is of `Result` type, where the package manifest parsing error is stored and re-thrown later.
Resolves#78.
* fix(install): fix crash caused by force try install invalid version
* fix: update message when downloading an invalid version
Co-authored-by: Max Desiatov <max@desiatov.com>
Co-authored-by: Max Desiatov <max@desiatov.com>
Currently, when `carton dev` is launched in any subdirectory of the package not containing `Package.swift` it crashes. It's caused by `traverseRecursively` precondition failing when a non-directory (or non-existent) path is passed to it. I think `traverseRecursively` can handle non-existing paths well by returning an empty array, and the path itself when it's a file and not a directory. Thus the precondition check is not needed at all.
Non-existent paths were created due to a wrong assumption that the root package directory is always the current directory. This is now fixed by adding a new `inferManifestDirectory` function, which correctly calculates absolute paths of source directories before passing them to the watcher.
Additionally the watcher code in the `TSCBasic` code has its own precondition for non-empty path arrays passed to it. To avoid triggering it and staying extra-safe, we check for an empty watcher paths array and avoid watching anything at all.
`dev.js` entrypoint has been updated to include the recent JavaScriptKit runtime fix: https://github.com/swiftwasm/JavaScriptKit/pull/19
I've also added a new subcommand to `carton-release`, which is now able to automaticallly create a new `static.zip` and record updated hashes in the source code. It still doesn't upload the archive automatically to previous release assets, but I wonder if that should be done manually anyway, at least until we have some kind of tests that verify the whole process end-to-end.
Additionally, since the new runtime is not compatible with the old Swift parts of JavaScriptKit, `carton dev` now checks the revision of JavaScriptKit that projects have specified in their `Package.swift`. It doesn't block the build process, but I hope it gives enough warning about the incompatibility.
This also adds a separate `Toolchain` type that abstracts a lot of the common operations. The giant toolchain-related `FileSystem` extension is now hidden in the separate `SwiftToolchain` module that also contains the new `Toolchain` type.
New `Destination` model type is added to facilitate automatic creation of destination files in a future PR.