Skip to content

Commit

Permalink
Bump requirements to Swift 5.4, migrate to @resultBuilder (#442)
Browse files Browse the repository at this point in the history
This updates the project to use Swift 5.4 across all platforms. Swift 5.4 is now also the required version, which allows us to use `@resultBuilder` instead of the deprecated version of this attribute from Swift 5.3.

Use `carton` 0.11.0 or later from now on to build with SwiftWasm 5.4.0.
  • Loading branch information
MaxDesiatov authored Sep 8, 2021
1 parent e1fcd18 commit 3d9558f
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 22 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: swiftwasm/swiftwasm-action@v5.3
- uses: swiftwasm/swiftwasm-action@v5.4
with:
shell-action: carton bundle --product TokamakDemo

Expand All @@ -20,20 +20,20 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: swiftwasm/swiftwasm-action@v5.3
- uses: swiftwasm/swiftwasm-action@v5.4
with:
shell-action: carton test

core_macos_build:
runs-on: macos-11.0
runs-on: macos-11

steps:
- uses: actions/checkout@v2
- name: Run the test suite on macOS, build the demo project for iOS
shell: bash
run: |
set -ex
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer/
sudo xcode-select --switch /Applications/Xcode_12.5.app/Contents/Developer/
# avoid building unrelated products for testing by specifying the test product explicitly
swift build --product TokamakPackageTests
`xcrun --find xctest` .build/debug/TokamakPackageTests.xctest ||
Expand Down Expand Up @@ -64,15 +64,15 @@ jobs:
path: RenderingTests

gtk_macos_build:
runs-on: macos-latest
runs-on: macos-11

steps:
- uses: actions/checkout@v2
- name: Build the GTK renderer on macOS
shell: bash
run: |
set -ex
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer/
sudo xcode-select --switch /Applications/Xcode_12.5.app/Contents/Developer/
brew install gtk+3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
codecov:
container:
image: swift:5.3.2-bionic
image: swift:5.4-bionic
runs-on: ubuntu-latest
steps:
- run: apt-get update && apt-get install -y gtk+-3.0 libgtk+-3.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
git fetch --prune --no-tags --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/heads/${{ github.base_ref }}
# Diff pull request to current files, then SwiftLint changed files
- name: GitHub Action for SwiftLint
uses: ezraberch/action-swiftlint@3.2.3
uses: mayk-it/action-swiftlint@3.2.2
env:
DIFF_BASE: ${{ github.base_ref }}
DIFF_HEAD: HEAD
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
--wraparguments before-first
--funcattributes prev-line
--disable andOperator
--swiftversion 5.3
--swiftversion 5.4
12 changes: 6 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.4
// The swift-tools-version declares the minimum version of Swift required to
// build this package.

Expand Down Expand Up @@ -125,7 +125,7 @@ let package = Package(
),
]
),
.target(
.executableTarget(
name: "TokamakGTKDemo",
dependencies: ["TokamakGTK"],
resources: [.copy("logo-header.png")]
Expand All @@ -136,14 +136,14 @@ let package = Package(
"TokamakCore",
]
),
.target(
.executableTarget(
name: "TokamakCoreBenchmark",
dependencies: [
"Benchmark",
"TokamakCore",
]
),
.target(
.executableTarget(
name: "TokamakStaticHTMLBenchmark",
dependencies: [
"Benchmark",
Expand All @@ -167,7 +167,7 @@ let package = Package(
"OpenCombineJS",
]
),
.target(
.executableTarget(
name: "TokamakDemo",
dependencies: [
"TokamakShim",
Expand All @@ -185,7 +185,7 @@ let package = Package(
),
]
),
.target(
.executableTarget(
name: "TokamakStaticHTMLDemo",
dependencies: [
"TokamakStaticHTML",
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ app.

## Requirements for app developers

- macOS 10.15 and Xcode 11.4 or later. macOS 11.0 and Xcode 12.0 or later are required if you're
building a multi-platform app with Tokamak that also needs to support SwiftUI on macOS.
- [Swift 5.2 or later](https://swift.org/download/) and Ubuntu 18.04 if you'd like to use Linux.
- macOS 11 and Xcode 12.5. Xcode 13 is currently not supported.
- [Swift 5.4 or later](https://swift.org/download/) and Ubuntu 18.04 if you'd like to use Linux.
Other Linux distributions are currently not supported.

## Requirements for app users
Expand All @@ -142,7 +141,7 @@ app by following these steps:
brew install swiftwasm/tap/carton
```

If you had `carton` installed before this, make sure you have version 0.9.0 or greater:
If you had `carton` installed before this, make sure you have version 0.11.0 or greater:

```
carton --version
Expand Down
2 changes: 1 addition & 1 deletion Sources/TokamakCore/App/Scenes/SceneBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Created by Carson Katri on 7/16/20.
//

@_functionBuilder
@resultBuilder
public enum SceneBuilder {
public static func buildBlock<Content: Scene>(_ content: Content) -> some Scene {
content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
// Created by Carson Katri on 7/7/20.
//

@_functionBuilder public enum ToolbarContentBuilder<ID> {
@resultBuilder
public enum ToolbarContentBuilder<ID> {
public static func buildBlock<V>(_ content: ToolbarItem<ID, V>)
-> ToolbarItemGroup<ID, ToolbarItem<ID, V>> where V: View
{
Expand Down
3 changes: 2 additions & 1 deletion Sources/TokamakCore/Views/ViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ extension Optional: AnyOptional {
}
}

@_functionBuilder public enum ViewBuilder {
@resultBuilder
public enum ViewBuilder {
public static func buildBlock() -> EmptyView { EmptyView() }

public static func buildBlock<Content>(
Expand Down

0 comments on commit 3d9558f

Please sign in to comment.