Skip to content

Commit

Permalink
Update packaging for Xcode 15.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed Mar 6, 2024
1 parent 8fa79cc commit 7ef840c
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 85 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/master-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "master"
- "release/**"
env:
XCODE_VERSION: "['14.2', '14.3.1', '15.1', '15.2']"
XCODE_VERSION: "['14.2', '14.3.1', '15.1', '15.2', '15.3']"
PLATFORM: "['ios', 'osx', 'watchos', 'tvos', 'catalyst', 'visionos']"
BUILD_PLATFORM: "['ios', 'iossimulator', 'osx', 'watchos', 'watchossimulator', 'tvos', 'tvossimulator', 'catalyst', 'visionos', 'visionossimulator']"
DOC_VERSION: '15.2'
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
version="$(sed -n 's/^VERSION=\(.*\)$/\1/p' "${GITHUB_WORKSPACE}/dependencies.list")"
echo "VERSION=$version" >> $GITHUB_OUTPUT
build-docs:
runs-on: macos-13
runs-on: macos-14
name: Package docs
needs: prepare
steps:
Expand All @@ -65,7 +65,7 @@ jobs:
name: realm-docs
path: docs/realm-docs.zip
build-examples:
runs-on: macos-13
runs-on: macos-14
name: Package examples
needs: prepare
steps:
Expand All @@ -78,7 +78,7 @@ jobs:
name: realm-examples
path: realm-examples.zip
build-product: # Creates framework for each platform, xcode version, target and configuration
runs-on: macos-13
runs-on: macos-14
name: Package framework
needs: prepare
strategy:
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
path: xcode-cloud-build-${{ steps.build-run.outputs.BUILD_RUN_ID }}.zip
compression-level: 0
package-xcframework-platform: # Creates xcframework for each platform and xcode version
runs-on: macos-13
runs-on: macos-14
name: Package xcframework for platform
needs: [build-product, prepare]
strategy:
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:
name: realm-${{ matrix.platform }}-${{ matrix.xcode-version }}
path: realm-${{ matrix.platform }}-${{ matrix.xcode-version }}.zip
package-release: # Creates xcframework for each platform and xcode version
runs-on: macos-13
runs-on: macos-14
name: Package release file
needs: [package-xcframework-platform, prepare]
steps:
Expand All @@ -231,7 +231,7 @@ jobs:
name: realm-swift-${{ needs.prepare.outputs.VERSION }}
path: pkg/realm-swift-${{ needs.prepare.outputs.VERSION }}.zip
test-package-examples:
runs-on: macos-13
runs-on: macos-14
name: Test examples
needs: [package-release, prepare]
steps:
Expand All @@ -245,7 +245,7 @@ jobs:
- name: Test examples
run: sh -x build.sh release-test-examples
test-ios-static:
runs-on: macos-13
runs-on: macos-14
name: Run tests on iOS with configuration Static
needs: package-release
steps:
Expand All @@ -255,7 +255,7 @@ jobs:
- name: Test ios static
run: sh -x build.sh test-ios-static
test-osx-static:
runs-on: macos-13
runs-on: macos-14
name: Run tests on macOS
needs: package-release
steps:
Expand All @@ -267,7 +267,7 @@ jobs:
export REALM_DISABLE_METADATA_ENCRYPTION=1
sh -x build.sh test-osx
test-installation:
runs-on: macos-13
runs-on: macos-14
name: Run installation test
needs: [package-release, prepare]
strategy:
Expand Down Expand Up @@ -310,7 +310,7 @@ jobs:
cd examples/installation
bundle exec ./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }}
test-installation-xcframework:
runs-on: macos-13
runs-on: macos-14
name: Run installation test for xcframework
needs: [package-release, prepare]
env:
Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ x.y.z Release notes (yyyy-MM-dd)
=============================================================
### Enhancements
* Lifted a limitation that would prevent declaring a model with only computed properties. ([#8414](https://github.com/realm/realm-swift/issues/8414))
* Add Xcode 15.3 to the release package ([PR #8502](https://github.com/realm/realm-swift/pull/8502)).

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-swift/issues/????), since v?.?.?)
* Fix multiple arguments support via the `REALM_EXTRA_BUILD_ARGUMENTS` environment variable in `build.sh`. ([PR #8413](https://github.com/realm/realm-swift/pulls/8413)). Thanks, [@hisaac](https://github.com/hisaac)!
* Fix some of the new sendability warnings introduced in Xcode 15.3 ([PR #8502](https://github.com/realm/realm-swift/pull/8502)).

<!-- ### Breaking Changes - ONLY INCLUDE FOR NEW MAJOR version -->

### Compatibility
* Realm Studio: 14.0.1 or later.
* APIs are backwards compatible with all previous releases in the 10.x.y series.
* Carthage release for Swift is built with Xcode 15.2.0.
* Carthage release for Swift is built with Xcode 15.3.0.
* CocoaPods: 1.10 or later.
* Xcode: 14.2-15.2.0.
* Xcode: 14.2-15.3.0.

### Internal
* Upgraded realm-core from ? to ?
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ source "https://rubygems.org"
gem 'cocoapods'
gem 'fileutils'
gem 'jazzy'
gem 'jwt'
gem 'octokit'
gem 'pathname'
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ GEM
sqlite3 (~> 1.3)
xcinvoke (~> 0.3.0)
json (2.7.1)
jwt (2.8.1)
base64
liferaft (0.0.6)
minitest (5.22.2)
molinillo (0.8.0)
Expand Down Expand Up @@ -135,13 +137,15 @@ GEM
rexml (~> 3.2.4)

PLATFORMS
arm64-darwin-22
arm64-darwin-23
x86_64-darwin-20

DEPENDENCIES
cocoapods
fileutils
jazzy
jwt
octokit
pathname

Expand Down
1 change: 1 addition & 0 deletions Realm/Tests/SwiftUITestHost/SwiftUITestHostApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ struct Footer: View {
}
}

@MainActor
struct ContentView: View {
@State var searchFilter: String = ""

Expand Down
2 changes: 1 addition & 1 deletion RealmSwift/BSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Realm

/// A tag protocol which marks types that can be used as the partition value
/// for synchronized Realms.
public protocol PartitionValue {
public protocol PartitionValue: Sendable {
}

/// Protocol representing a BSON value.
Expand Down
16 changes: 16 additions & 0 deletions RealmSwift/Impl/RealmCollectionImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,15 @@ internal func with<A: Actor, Value: ThreadConfined, Return: Sendable>(
let unchecked = Unchecked(wrappedValue: value)
return try await actor.invoke { actor in
if !Task.isCancelled {
#if swift(>=5.10)
// As of Swift 5.10 the compiler incorrectly thinks that this
// is an async hop even though the isolation context is
// unchanged. This is fixed in 5.11.
nonisolated(unsafe) let value = unchecked.wrappedValue
return try await block(actor, value)
#else
return try await block(actor, unchecked.wrappedValue)

Check notice on line 195 in RealmSwift/Impl/RealmCollectionImpl.swift

View check run for this annotation

Xcode Cloud / RealmSwift | osx-swift_15.2 | Test - macOS

RealmSwift/Impl/RealmCollectionImpl.swift#L195

Passing argument of non-sendable type 'Value' outside of actor-isolated context may introduce data races

Check notice on line 195 in RealmSwift/Impl/RealmCollectionImpl.swift

View check run for this annotation

Xcode Cloud / RealmSwift | osx-swift_15.1 | Test - macOS

RealmSwift/Impl/RealmCollectionImpl.swift#L195

Passing argument of non-sendable type 'Value' outside of actor-isolated context may introduce data races
#endif
}
return nil
}
Expand All @@ -202,7 +210,15 @@ internal func with<A: Actor, Value: ThreadConfined, Return: Sendable>(
guard let value = tsr.resolve(in: realm) else {
return nil
}
#if swift(>=5.10)
// As above; this is safe but 5.10's sendability checking can't prove it
// nonisolated(unsafe) can't be applied to a let in guard so we need
// a second variable
nonisolated(unsafe) let v = value
return try await block(actor, v)
#else
return try await block(actor, value)

Check notice on line 220 in RealmSwift/Impl/RealmCollectionImpl.swift

View check run for this annotation

Xcode Cloud / RealmSwift | osx-swift_15.2 | Test - macOS

RealmSwift/Impl/RealmCollectionImpl.swift#L220

Passing argument of non-sendable type 'Value' outside of actor-isolated context may introduce data races

Check notice on line 220 in RealmSwift/Impl/RealmCollectionImpl.swift

View check run for this annotation

Xcode Cloud / RealmSwift | osx-swift_15.1 | Test - macOS

RealmSwift/Impl/RealmCollectionImpl.swift#L220

Passing argument of non-sendable type 'Value' outside of actor-isolated context may introduce data races
#endif
}
}
#endif
38 changes: 16 additions & 22 deletions RealmSwift/Projection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -788,28 +788,22 @@ private struct ProjectionProperty: @unchecked Sendable {
let label: String
}

// An adaptor for os_unfair_lock to make it implement NSLocking
@available(OSX 10.12, watchOS 3.0, iOS 10.0, tvOS 10.0, *)
private final class UnfairLock: NSLocking, Sendable {
func lock() {
os_unfair_lock_lock(impl)
}
func unlock() {
os_unfair_lock_unlock(impl)
}

// A subset of OSAllocatedUnfairLock, which requires iOS 16
internal final class AllocatedUnfairLock<Value>: @unchecked Sendable {
private var value: Value
private let impl: os_unfair_lock_t = .allocate(capacity: 1)
init() {

init(_ value: Value) {
impl.initialize(to: os_unfair_lock())
self.value = value
}
}

// We want to use os_unfair_lock when it's available, but fall back to NSLock otherwise
private func createLock() -> NSLocking {
if #available(macOS 10.12, watchOS 3.0, iOS 10.0, tvOS 10.0, *) {
return UnfairLock()
func withLock<R>(_ body: (inout Value) -> R) -> R {
os_unfair_lock_lock(impl)
let ret = body(&value)
os_unfair_lock_unlock(impl)
return ret
}
return NSLock()
}

// A property wrapper which unsafely disables concurrency checking for a property
Expand All @@ -828,12 +822,11 @@ internal struct Unchecked<Wrapped>: @unchecked Sendable {
}

private final class ProjectionSchemaCache: @unchecked Sendable {
@Unchecked private static var schema = [ObjectIdentifier: [ProjectionProperty]]()
private static let lock = createLock()
private static let schema = AllocatedUnfairLock([ObjectIdentifier: [ProjectionProperty]]())

fileprivate func schema<T: ProjectionObservable>(for obj: T) -> [ProjectionProperty] {
let identifier = ObjectIdentifier(type(of: obj))
if let schema = Self.lock.withLock({ Self.schema[identifier] }) {
if let schema = Self.schema.withLock({ $0[identifier] }) {
return schema
}

Expand All @@ -850,11 +843,12 @@ private final class ProjectionSchemaCache: @unchecked Sendable {
originPropertyKeyPathString: originPropertyLabel,
label: String(label)))
}
Self.lock.withLock {
let p = properties
Self.schema.withLock {
// This might overwrite a schema generated by a different thread
// if we happened to do the initialization on multiple threads at
// once, but if so that's fine.
Self.schema[identifier] = properties
$0[identifier] = p
}
return properties
}
Expand Down
2 changes: 1 addition & 1 deletion RealmSwift/Query.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Realm
import Realm.Private

/// Enum representing an option for `String` queries.
public struct StringOptions: OptionSet {
public struct StringOptions: OptionSet, Sendable {
/// :doc:
public let rawValue: Int8
/// :doc:
Expand Down
Loading

0 comments on commit 7ef840c

Please sign in to comment.