Commit Graph

24 Commits

Author SHA1 Message Date
Max Desiatov 4635766c61
Fix support for Ubuntu 20.04, use GHA for SwiftLint (#134)
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
2020-10-21 14:27:50 +01:00
Max Desiatov 08956baf1d
Add separate Builder class, use WasmTransformer (#131)
Resolves #127.

* Add separate Builder class, use WasmTransformer

* Don't apply the transformer in non-browser environments

* Fix macOS Swift 5.2 build failure

* Fix Package.swift errors

* Fix cyclic dependency in `Package.swift`

* Bump WasmTransformer requirement to 0.0.1

* Rename `case wasmer` to `case other`
2020-10-21 08:48:03 +01:00
Max Desiatov 703078dd83
Bump toolchain, use `--enable-test-discovery` (#130)
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.
2020-10-20 09:29:25 +01:00
Carson Katri 97a7e4fbac
Pretty print diagnostics (#122) 2020-10-14 07:26:31 -04:00
Max Desiatov 511ed784ed
Update Toolchain.swift 2020-09-29 11:31:12 +01:00
Max Desiatov cd660a8d86
Use raw stdout if TerminalController is unavailable (#113)
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.
2020-09-28 20:14:18 +01:00
Max Desiatov 1e49463d64
Implement resources copying in `carton bundle` (#109)
* Define `resourcesPath` on `SwiftToolchain.Package`

* Implement resources copying in `carton bundle`

* Remove redundant newline in log output
2020-09-20 09:46:49 +01:00
Max Desiatov 3478fb082e
Bump JavaScriptKit dependency to 0.6.0 (#107)
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.
2020-09-14 12:36:06 +01:00
Max Desiatov 9c94fd02b1
Implement support for static resources in `carton dev` (#104)
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.
2020-09-14 10:36:09 +01:00
Yuta Saito 86c9998a32
Add carton package cmd (#96)
* Ignore generate-xcodeproj artifact

* Add carton package command which proxies to swift-package in the selected toolchain
2020-08-28 17:35:15 +09:00
Max Desiatov ef8bd948c0
Fix broken `carton init` templates (#88)
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.
2020-08-20 11:35:35 +01:00
Max Desiatov a2e928ac92
Propagate package manifest parsing errors (#86)
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.
2020-08-19 09:26:36 +01:00
ninjiacoder 853c289c1c
Fix crash caused by use of `try!` while installing invalid version (#73)
* 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>
2020-07-28 22:56:28 +08:00
Carson Katri 00877353b8
Add verbose/concise logging levels (#69) 2020-07-26 10:24:44 -04:00
Max Desiatov db504a06c5
Fix watcher crashing in package subdirectories (#67)
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.
2020-07-25 15:32:42 +01:00
Max Desiatov 749a17d730
Update static.zip, automate its release process (#60)
`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.
2020-07-19 21:53:04 +01:00
Carson Katri 537da48876
Add `carton init` command (#54) 2020-07-16 12:17:12 -04:00
Max Desiatov 76769443d6
Implement simple wasmer runner for `test` command (#51)
Implements the first part of https://github.com/swiftwasm/carton/issues/42.
2020-07-15 18:05:31 +01:00
Max Desiatov 8b326b6181
Always pass --enable-test-discovery to swift build (#49)
Thanks to this the presence of `LinuxMain.swift` file is no longer needed.
2020-07-15 11:24:32 +01:00
Max Desiatov 01fc71b320
Fix watcher missing root directories (#48) 2020-07-14 20:44:08 +01:00
Max Desiatov dc56e8387b
Update to Vapor 4.15.2, fix formatting (#47) 2020-07-14 19:28:43 +01:00
Jaap Wijnen 6b4f7035f3
Add sources to watcher per target (#46)
Sources are added per target and use a custom path if provided by the package manifest. Resolves #1.
2020-07-14 18:38:24 +01:00
Max Desiatov 9ebc500d77
Automatically link Foundation w/ destination.json (#41)
Resolves #4.
2020-07-13 21:26:39 +01:00
Max Desiatov 5c590230ec
Add separate CartonHelpers/SwiftToolchain modules (#35)
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.
2020-07-08 22:16:11 +01:00