Skip to content

Commit

Permalink
Use SwiftWasm 5.5.0, bump version to 0.12.0 (#266)
Browse files Browse the repository at this point in the history
`async-http-client` package is now pinned to 1.6.4, as 1.7.0 and later versions caused issues with toolchain downloads (see swift-server/async-http-client#488 for more details).

I've also updated toolchain downloader code to bubble up download errors, which previously were hidden and made it very hard to diagnose these issues.

* Use SwiftWasm 5.5.0, bump version to 0.12.0

* Pin AHC to 1.8.0

* Pin AHC to 1.6.4, always remove downloaded archives

* Fix `defer` build issue
  • Loading branch information
MaxDesiatov authored Nov 24, 2021
1 parent 4514347 commit 0e163ec
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 27 deletions.
12 changes: 6 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/swift-server/async-http-client.git",
"state": {
"branch": null,
"revision": "1081b0b0541f535ca088acdb56f5ca5598bc6247",
"version": "1.6.3"
"revision": "170fd536f931c0bffb58f37a53fc238e77f42258",
"version": "1.6.4"
}
},
{
Expand Down Expand Up @@ -132,8 +132,8 @@
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "6aa9347d9bc5bbfe6a84983aec955c17ffea96ef",
"version": "2.33.0"
"revision": "addf69cfe60376c325397c8926589415576b1dd1",
"version": "2.34.0"
}
},
{
Expand Down Expand Up @@ -195,8 +195,8 @@
"repositoryURL": "https://github.com/vapor/vapor.git",
"state": {
"branch": null,
"revision": "27119271502bf266be293be5325f0fb72435e8fd",
"version": "4.49.2"
"revision": "6a5a3b5244d39e2614382c77ddf62e63b712ad06",
"version": "4.53.0"
}
},
{
Expand Down
9 changes: 6 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ let package = Package(
.executable(name: "carton-release", targets: ["carton-release"]),
],
dependencies: [
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.6.3"),
.package(
url: "https://github.com/swift-server/async-http-client.git",
.upToNextMinor(from: "1.6.4")
),
.package(
url: "https://github.com/apple/swift-argument-parser.git",
from: "0.4.3"
),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.33.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.34.0"),
.package(
name: "SwiftPM",
url: "https://github.com/apple/swift-package-manager.git",
Expand All @@ -37,7 +40,7 @@ let package = Package(
.branch("release/5.5")
),
.package(url: "https://github.com/OpenCombine/OpenCombine.git", from: "0.12.0"),
.package(url: "https://github.com/vapor/vapor.git", from: "4.49.2"),
.package(url: "https://github.com/vapor/vapor.git", from: "4.53.0"),
.package(url: "https://github.com/apple/swift-crypto.git", from: "1.1.0"),
.package(url: "https://github.com/JohnSundell/Splash.git", from: "0.16.0"),
.package(
Expand Down
2 changes: 1 addition & 1 deletion Sources/CartonHelpers/DefaultToolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
// See the License for the specific language governing permissions and
// limitations under the License.

public let defaultToolchainVersion = "wasm-5.5-SNAPSHOT-2021-11-16-a"
public let defaultToolchainVersion = "wasm-5.5.0-RELEASE"
2 changes: 1 addition & 1 deletion Sources/CartonHelpers/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
// See the License for the specific language governing permissions and
// limitations under the License.

public let cartonVersion = "0.11.0"
public let cartonVersion = "0.12.0"
21 changes: 17 additions & 4 deletions Sources/SwiftToolchain/ToolchainInstallation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,24 @@ extension ToolchainSystem {
var subscriptions = [AnyCancellable]()
let request = try HTTPClient.Request.get(url: url)

// Clean up the downloaded file (especially important for failed downloads, otherwise running
// `carton` again will fail trying to pick up the broken download).
defer {
do {
try fileSystem.removeFileTree(archivePath)
} catch {
terminal.write("Failed to remove downloaded file with error \(error)\n", inColor: .red)
}
}

_ = try tsc_await { (completion: @escaping (Result<(), Error>) -> ()) in
client.execute(request: request, delegate: delegate).futureResult.whenComplete { _ in
subject.send(completion: .finished)
client.execute(request: request, delegate: delegate).futureResult.whenComplete {
switch $0 {
case .success:
subject.send(completion: .finished)
case let .failure(error):
subject.send(completion: .failure(error))
}
}

subject
Expand Down Expand Up @@ -101,8 +116,6 @@ extension ToolchainSystem {
terminal.logLookup("Unpacking the archive: ", arguments.joined(separator: " "))
_ = try processDataOutput(arguments)

try fileSystem.removeFileTree(archivePath)

return installationPath
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/Fixtures/TestApp/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/swiftwasm/JavaScriptKit",
"state": {
"branch": null,
"revision": "b19e7c8b10a2750ed47753e31ed13613171f3294",
"version": "0.10.1"
"revision": "309e63c03d8116210ad0437f5d1f09a26d4de48b",
"version": "0.11.1"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/TestApp/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let package = Package(
.executable(name: "TestApp", targets: ["TestApp"]),
],
dependencies: [
.package(url: "https://github.com/swiftwasm/JavaScriptKit", from: "0.10.1"),
.package(url: "https://github.com/swiftwasm/JavaScriptKit", from: "0.11.1"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "carton",
"version": "0.11.0",
"version": "0.12.0",
"description": "📦 Watcher, bundler, and test runner for your SwiftWasm apps ",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 0e163ec

Please sign in to comment.