Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimum support version to Swift 5.10 #57

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-13
xcode-version: "15.1" # Swift 5.9.2
- os: macos-14
xcode-version: "15.3" # Swift 5.10
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 1
OPENSWIFTUI_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_SWIFT_LOG: 0
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
Expand All @@ -36,15 +41,3 @@ jobs:
--build-path .build-compatibility-test-debug
env:
OPENSWIFTUI_COMPATIBILITY_TEST: 1
# - name: Run compatibility tests on OpenSwiftUI + iOS
# run: |
# swift test \
# --build-path .build-compatibility-test-debug
# env:
# OPENSWIFTUI_COMPATIBILITY_TEST: 0
# - name: Run compatibility tests on SwiftUI + iOS
# run: |
# swift test \
# --build-path .build-compatibility-test-debug
# env:
# OPENSWIFTUI_COMPATIBILITY_TEST: 1
19 changes: 12 additions & 7 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-13
xcode-version: "15.2" # Swift 5.9.2
- os: macos-14
xcode-version: "15.3" # Swift 5.10
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 1
OPENSWIFTUI_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 0
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
Expand All @@ -29,15 +35,14 @@ jobs:
xcodebuild build \
-scheme OpenSwiftUI \
-configuration Debug \
-skipMacroValidation -skipPackagePluginValidation \
-destination "platform=iOS-Simulator" \
# OpenSwiftUI-Package is not listed currently
# OTHER_SWIFT_FLAGS="-warnings-as-errors" \ AccessLevelOnImport will cause build warning via xcodebuild
-skipMacroValidation \
-skipPackagePluginValidation
- name: Build and run tests in debug mode
run: |
xcodebuild test \
-scheme OpenSwiftUI \
-configuration Debug \
-skipMacroValidation -skipPackagePluginValidation \
-destination "platform=iOS-Simulator" \
# OTHER_SWIFT_FLAGS="-warnings-as-errors"
-skipMacroValidation \
-skipPackagePluginValidation
10 changes: 8 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-13
xcode-version: "15.2" # Swift 5.9.2
- os: macos-14
xcode-version: "15.3" # Swift 5.10
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 1
OPENSWIFTUI_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 0
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ jobs:
strategy:
fail-fast: false
matrix:
swift_version: ["5.9.2"]
swift_version: ["5.10"]
runs-on: ubuntu-22.04
env:
OPENSWIFTUI_WERROR: 1
OPENSWIFTUI_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 0
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 1
container: swift:${{ matrix.swift_version }}-jammy
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@ jobs:
strategy:
fail-fast: false
matrix:
swift_version: ["wasm-5.9.1-RELEASE"]
swift_version: ["5.10-SNAPSHOT-2024-03-30-a"] # "5.10-RELEASE" is not release for WASM, tracked via https://github.com/swiftwasm/swift/issues/5570
os: [ubuntu-22.04]
include:
- swift_version: "wasm-5.9.1-RELEASE"
extra_params: "-Xswiftc -Xfrontend -Xswiftc -disable-round-trip-debug-types" # https://github.com/swiftwasm/swift/issues/5563#issuecomment-1913533592
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: swiftwasm/setup-swiftwasm@v1
with:
swift-version: ${{ matrix.swift_version }}
swift-version: wasm-${{ matrix.swift_version }}
- name: build
run: |
swift build --triple wasm32-unknown-wasi ${{ matrix.extra_params }}
Expand Down
13 changes: 7 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
{
"originHash" : "c92107a159713b44e293a2fe944a02f419f98dc401c81653bfee56d07c8a2b70",
"pins" : [
{
"identity" : "opengraph",
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
"state" : {
"branch" : "main",
"revision" : "6bdaabae4e0e23868f657c24fd09580f8915519c"
"revision" : "dd6cacbdcf2af1d8f7ce2b0e7194a920935326de"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "64889f0c732f210a935a0ad7cda38f77f876262d",
"version" : "509.1.1"
"revision" : "fa8f95c2d536d6620cc2f504ebe8a6167c9fc2dd",
"version" : "510.0.1"
}
},
{
"identity" : "swift-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-testing",
"state" : {
"revision" : "126e4be6857bda76aab3f45282bc6cfff5ac876a",
"version" : "0.3.0"
"revision" : "8097dd8bcf7f2ed85f8aa8883635ce413012f53b",
"version" : "0.6.0"
}
}
],
"version" : 2
"version" : 3
}
7 changes: 4 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.9
// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.

import Foundation
Expand All @@ -18,6 +18,7 @@ func envEnable(_ key: String, default defaultValue: Bool = false) -> Bool {
}

let isXcodeEnv = Context.environment["__CFBundleIdentifier"] == "com.apple.dt.Xcode"
let development = envEnable("OPENSWIFTUI_DEVELOPMENT", default: false)

// Xcode use clang as linker which supports "-iframework" while SwiftPM use swiftc as linker which supports "-Fsystem"
let systemFrameworkSearchFlag = isXcodeEnv ? "-iframework" : "-Fsystem"
Expand All @@ -27,7 +28,7 @@ var sharedSwiftSettings: [SwiftSetting] = [
.define("OPENSWIFTUI_SUPPRESS_DEPRECATED_WARNINGS"),
]

let warningsAsErrorsCondition = envEnable("OPENSWIFTUI_WERROR", default: isXcodeEnv)
let warningsAsErrorsCondition = envEnable("OPENSWIFTUI_WERROR", default: isXcodeEnv && development)
if warningsAsErrorsCondition {
sharedSwiftSettings.append(.unsafeFlags(["-warnings-as-errors"]))
}
Expand Down Expand Up @@ -167,7 +168,7 @@ let swiftTestingCondition = envEnable("OPENSWIFTUI_SWIFT_TESTING", default: true
if swiftTestingCondition {
package.dependencies.append(
// Fix it to be 0.3.0 before we bump to Swift 5.10
.package(url: "https://github.com/apple/swift-testing", exact: "0.3.0")
.package(url: "https://github.com/apple/swift-testing", exact: "0.6.0")
)
openSwiftUITestTarget.dependencies.append(
.product(name: "Testing", package: "swift-testing")
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenSwiftUI/Data/Model/State/ObservedObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public struct ObservedObject<ObjectType> where ObjectType: ObservableObject {
/// When you change a wrapped value, you can access the new value
/// immediately. However, OpenSwiftUI updates views that display the value
/// asynchronously, so the interface might not update immediately.
@MainActor
@MainActor(unsafe)
public var wrappedValue: ObjectType

/// A projection of the observed object that creates bindings to its
Expand All @@ -183,7 +183,7 @@ public struct ObservedObject<ObjectType> where ObjectType: ObservableObject {
/// }
/// }
///
@MainActor
@MainActor(unsafe)
public var projectedValue: ObservedObject<ObjectType>.Wrapper {
.init(root: wrappedValue)
}
Expand Down
Loading