diff options
author | marinofaggiana <marino@marinofaggiana.com> | 2020-08-09 14:58:21 +0300 |
---|---|---|
committer | marinofaggiana <marino@marinofaggiana.com> | 2020-08-09 14:58:21 +0300 |
commit | 4d3cdbc63c10aa6b9c4c9d2b9468f061f14e000d (patch) | |
tree | a9760618966621c9d74e738af7791e2f60bd78e7 /Carthage | |
parent | 0132660518da55d6daae44ab14c2435c28f0e381 (diff) |
disable disable_crash_service
Diffstat (limited to 'Carthage')
64 files changed, 1128 insertions, 636 deletions
diff --git a/Carthage/Checkouts/realm-cocoa/.gitignore b/Carthage/Checkouts/realm-cocoa/.gitignore index 158877276..f460e8092 100644 --- a/Carthage/Checkouts/realm-cocoa/.gitignore +++ b/Carthage/Checkouts/realm-cocoa/.gitignore @@ -117,3 +117,5 @@ Realm/ObjectServerTests/node_modules .swiftpm .build Package.resolved + +examples/installation/ios/swift/SwiftPackageManagerExample/SwiftPackageManagerExample.xcodeproj diff --git a/Carthage/Checkouts/realm-cocoa/.jenkins.yml b/Carthage/Checkouts/realm-cocoa/.jenkins.yml index 87d8d4fc9..192222ec9 100644 --- a/Carthage/Checkouts/realm-cocoa/.jenkins.yml +++ b/Carthage/Checkouts/realm-cocoa/.jenkins.yml @@ -4,12 +4,11 @@ # This is a generated file produced by scripts/pr-ci-matrix.rb. xcode_version: - - 10.3 - - 11.1 - - 11.2.1 - 11.3 - 11.4.1 - 11.5 + - 11.6 + - 12.0 target: - docs - swiftlint @@ -40,518 +39,434 @@ configuration: exclude: - - xcode_version: 10.3 - target: docs - configuration: Debug - - - xcode_version: 10.3 - target: docs - configuration: Release - - - xcode_version: 11.1 + - xcode_version: 11.3 target: docs configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.3 target: docs configuration: Release - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: docs configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: docs configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: docs configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: docs configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: docs configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: docs configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: docs configuration: Debug - - xcode_version: 10.3 - target: swiftlint - configuration: Debug - - - xcode_version: 10.3 - target: swiftlint - configuration: Release - - - xcode_version: 11.1 + - xcode_version: 11.3 target: swiftlint configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.3 target: swiftlint configuration: Release - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: swiftlint configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: swiftlint configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: swiftlint configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: swiftlint configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: swiftlint configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: swiftlint configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: swiftlint configuration: Debug - - xcode_version: 10.3 - target: osx-encryption - configuration: Debug - - - xcode_version: 11.1 + - xcode_version: 11.3 target: osx-encryption configuration: Debug - - xcode_version: 11.1 - target: osx-encryption - configuration: Release - - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: osx-encryption configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: osx-encryption configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: osx-encryption configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: osx-encryption configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: osx-encryption configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: osx-encryption configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: osx-encryption configuration: Debug - - xcode_version: 10.3 - target: osx-object-server - configuration: Debug - - - xcode_version: 11.1 + - xcode_version: 11.3 target: osx-object-server configuration: Debug - - xcode_version: 11.1 - target: osx-object-server - configuration: Release - - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: osx-object-server configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: osx-object-server configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: osx-object-server configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: osx-object-server configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: osx-object-server configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: osx-object-server configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: osx-object-server configuration: Debug - - xcode_version: 10.3 - target: ios-static - configuration: Debug - - - xcode_version: 11.1 + - xcode_version: 11.3 target: ios-static configuration: Debug - - xcode_version: 11.1 - target: ios-static - configuration: Release - - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: ios-static configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: ios-static configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: ios-static configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: ios-static configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: ios-static configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: ios-static configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: ios-static configuration: Debug - - xcode_version: 10.3 - target: ios-dynamic - configuration: Debug - - - xcode_version: 11.1 + - xcode_version: 11.3 target: ios-dynamic configuration: Debug - - xcode_version: 11.1 - target: ios-dynamic - configuration: Release - - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: ios-dynamic configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: ios-dynamic configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: ios-dynamic configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: ios-dynamic configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: ios-dynamic configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: ios-dynamic configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: ios-dynamic configuration: Debug - - xcode_version: 10.3 - target: watchos - configuration: Debug - - - xcode_version: 11.1 + - xcode_version: 11.3 target: watchos configuration: Debug - - xcode_version: 11.1 - target: watchos - configuration: Release - - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: watchos configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: watchos configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: watchos configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: watchos configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: watchos configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: watchos configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: watchos configuration: Debug - - xcode_version: 10.3 - target: tvos - configuration: Debug - - - xcode_version: 11.1 + - xcode_version: 11.3 target: tvos configuration: Debug - - xcode_version: 11.1 - target: tvos - configuration: Release - - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: tvos configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: tvos configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: tvos configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: tvos configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: tvos configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: tvos configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: tvos configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.3 target: ios-swift configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.4.1 target: ios-swift configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.4.1 target: ios-swift configuration: Release - - xcode_version: 11.2.1 + - xcode_version: 11.5 target: ios-swift configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.5 target: ios-swift configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.6 target: ios-swift configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.6 target: ios-swift configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 12.0 target: ios-swift configuration: Debug - - xcode_version: 11.4.1 - target: ios-swift - configuration: Release - - - xcode_version: 11.5 - target: ios-swift + - xcode_version: 11.3 + target: tvos-swift configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.4.1 target: tvos-swift configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.4.1 + target: tvos-swift + configuration: Release + + - xcode_version: 11.5 target: tvos-swift configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.5 target: tvos-swift configuration: Release - - xcode_version: 11.2.1 + - xcode_version: 11.6 target: tvos-swift configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.6 target: tvos-swift configuration: Release - - xcode_version: 11.3 + - xcode_version: 12.0 target: tvos-swift configuration: Debug - xcode_version: 11.3 - target: tvos-swift - configuration: Release + target: catalyst + configuration: Debug - xcode_version: 11.4.1 - target: tvos-swift + target: catalyst configuration: Debug - xcode_version: 11.4.1 - target: tvos-swift + target: catalyst configuration: Release - xcode_version: 11.5 - target: tvos-swift - configuration: Debug - - - xcode_version: 10.3 target: catalyst configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.5 target: catalyst configuration: Release - - xcode_version: 11.1 + - xcode_version: 11.6 target: catalyst configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.6 target: catalyst - configuration: Debug + configuration: Release - - xcode_version: 11.3 + - xcode_version: 12.0 target: catalyst configuration: Debug - - xcode_version: 11.4.1 - target: catalyst + - xcode_version: 11.3 + target: catalyst-swift configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.4.1 target: catalyst-swift configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.4.1 target: catalyst-swift configuration: Release - - xcode_version: 11.1 + - xcode_version: 11.5 target: catalyst-swift configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.5 target: catalyst-swift - configuration: Debug + configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.6 target: catalyst-swift configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: catalyst-swift - configuration: Debug + configuration: Release - - xcode_version: 10.3 - target: xcframework + - xcode_version: 12.0 + target: catalyst-swift configuration: Debug - - xcode_version: 10.3 - target: xcframework - configuration: Release - - - xcode_version: 11.1 + - xcode_version: 11.3 target: xcframework configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.3 target: xcframework configuration: Release - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: xcframework configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: xcframework configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: xcframework configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: xcframework configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: xcframework configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: xcframework configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: xcframework configuration: Debug - - xcode_version: 10.3 - target: cocoapods-osx - configuration: Debug - - - xcode_version: 11.1 - target: cocoapods-osx - configuration: Debug - - - xcode_version: 11.2.1 - target: cocoapods-osx - configuration: Debug - - xcode_version: 11.3 target: cocoapods-osx configuration: Debug @@ -564,278 +479,246 @@ exclude: target: cocoapods-osx configuration: Debug - - xcode_version: 10.3 - target: cocoapods-ios + - xcode_version: 11.6 + target: cocoapods-osx configuration: Debug - - xcode_version: 11.1 - target: cocoapods-ios + - xcode_version: 12.0 + target: cocoapods-osx configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.3 target: cocoapods-ios - configuration: Release + configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: cocoapods-ios configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: cocoapods-ios configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: cocoapods-ios configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: cocoapods-ios configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: cocoapods-ios configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: cocoapods-ios configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: cocoapods-ios configuration: Debug - - xcode_version: 10.3 - target: cocoapods-ios-dynamic - configuration: Debug - - - xcode_version: 11.1 + - xcode_version: 11.3 target: cocoapods-ios-dynamic configuration: Debug - - xcode_version: 11.1 - target: cocoapods-ios-dynamic - configuration: Release - - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: cocoapods-ios-dynamic configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: cocoapods-ios-dynamic configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: cocoapods-ios-dynamic configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: cocoapods-ios-dynamic configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: cocoapods-ios-dynamic configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: cocoapods-ios-dynamic configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: cocoapods-ios-dynamic configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.3 target: cocoapods-watchos configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.4.1 target: cocoapods-watchos configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.4.1 target: cocoapods-watchos configuration: Release - - xcode_version: 11.2.1 + - xcode_version: 11.5 target: cocoapods-watchos configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.5 target: cocoapods-watchos configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.6 target: cocoapods-watchos configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.6 target: cocoapods-watchos configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 12.0 target: cocoapods-watchos configuration: Debug - - xcode_version: 11.4.1 - target: cocoapods-watchos - configuration: Release - - - xcode_version: 11.5 - target: cocoapods-watchos + - xcode_version: 11.3 + target: swiftpm configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.4.1 target: swiftpm configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.4.1 target: swiftpm configuration: Release - - xcode_version: 11.1 + - xcode_version: 11.5 target: swiftpm configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.5 target: swiftpm - configuration: Debug + configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.6 target: swiftpm configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: swiftpm - configuration: Debug + configuration: Release - - xcode_version: 10.3 - target: swiftpm-address + - xcode_version: 12.0 + target: swiftpm configuration: Debug - - xcode_version: 10.3 - target: swiftpm-address - configuration: Release - - - xcode_version: 11.1 + - xcode_version: 11.3 target: swiftpm-address configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.3 target: swiftpm-address configuration: Release - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: swiftpm-address configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: swiftpm-address configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: swiftpm-address configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: swiftpm-address configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: swiftpm-address configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: swiftpm-address configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: swiftpm-address configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.3 target: swiftpm-thread configuration: Debug - - xcode_version: 10.3 + - xcode_version: 11.3 target: swiftpm-thread configuration: Release - - xcode_version: 11.1 + - xcode_version: 11.4.1 target: swiftpm-thread configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.4.1 target: swiftpm-thread configuration: Release - - xcode_version: 11.2.1 + - xcode_version: 11.5 target: swiftpm-thread configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.5 target: swiftpm-thread configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.6 target: swiftpm-thread configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.6 target: swiftpm-thread configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 12.0 target: swiftpm-thread configuration: Debug - - xcode_version: 11.4.1 - target: swiftpm-thread - configuration: Release - - - xcode_version: 11.5 - target: swiftpm-thread - configuration: Debug - - - xcode_version: 10.3 - target: swiftpm-ios - configuration: Debug - - - xcode_version: 10.3 - target: swiftpm-ios - configuration: Release - - - xcode_version: 11.1 + - xcode_version: 11.3 target: swiftpm-ios configuration: Debug - - xcode_version: 11.1 + - xcode_version: 11.3 target: swiftpm-ios configuration: Release - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: swiftpm-ios configuration: Debug - - xcode_version: 11.2.1 + - xcode_version: 11.4.1 target: swiftpm-ios configuration: Release - - xcode_version: 11.3 + - xcode_version: 11.5 target: swiftpm-ios configuration: Debug - - xcode_version: 11.3 + - xcode_version: 11.5 target: swiftpm-ios configuration: Release - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: swiftpm-ios configuration: Debug - - xcode_version: 11.4.1 + - xcode_version: 11.6 target: swiftpm-ios configuration: Release - - xcode_version: 11.5 + - xcode_version: 12.0 target: swiftpm-ios configuration: Debug diff --git a/Carthage/Checkouts/realm-cocoa/.travis.yml b/Carthage/Checkouts/realm-cocoa/.travis.yml index b9f2ee418..99c5f1b53 100644 --- a/Carthage/Checkouts/realm-cocoa/.travis.yml +++ b/Carthage/Checkouts/realm-cocoa/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode10.2 +osx_image: xcode11.6 branches: only: master script: placeholder # workaround for https://github.com/travis-ci/travis-ci/issues/4681 diff --git a/Carthage/Checkouts/realm-cocoa/CHANGELOG.md b/Carthage/Checkouts/realm-cocoa/CHANGELOG.md index 116416945..e58d6a997 100644 --- a/Carthage/Checkouts/realm-cocoa/CHANGELOG.md +++ b/Carthage/Checkouts/realm-cocoa/CHANGELOG.md @@ -1,3 +1,199 @@ +5.3.3 Release notes (2020-07-30) +============================================================= + +### Enhancements + +* Add support for the x86_64 watchOS simulator added in Xcode 12. + +### Fixed + +* (RLM)Results objects would incorrectly pin old read transaction versions + until they were accessed after a Realm was refreshed, resulting in the Realm + file growing to large sizes if a Results was retained but not accessed after + every write. ([#6677](https://github.com/realm/realm-cocoa/issues/6677), since 5.0.0). +* Fix linker errors when using SwiftUI previews with Xcode 12 when Realm was + installed via Swift Package Manager. ([#6625](https://github.com/realm/realm-cocoa/issues/6625)) + +### Compatibility + +* File format: Generates Realms with format v10 (Reads and upgrades all previous formats) +* Realm Object Server: 3.21.0 or later. +* Realm Studio: 3.11 or later. +* APIs are backwards compatible with all previous releases in the 5.x.y series. +* Carthage release for Swift is built with Xcode 11.6. + +### Internal + +* Upgraded realm-core from v6.0.12 to v6.0.14 +* Upgraded realm-sync from v5.0.12 to v5.0.14 + +5.3.2 Release notes (2020-07-21) +============================================================= + +### Fixed + +* Fix a file format upgrade bug when opening older Realm files. Could cause + assertions like "Assertion failed: ref != 0" during opning of a Realm. + ([Core #6644](https://github.com/realm/realm-cocoa/issues/6644), since 5.2.0) +* A use-after-free would occur if a Realm was compacted, opened on multiple + threads prior to the first write, then written to while reads were happening + on other threads. This could result in a variety of crashes, often inside + realm::util::EncryptedFileMapping::read_barrier. + (Since v5.0.0, [#6626](https://github.com/realm/realm-cocoa/issues/6626), + [#6628](https://github.com/realm/realm-cocoa/issues/6628), + [#6652](https://github.com/realm/realm-cocoa/issues/6652), + [#6655](https://github.com/realm/realm-cocoa/issues/6555), + [#6656](https://github.com/realm/realm-cocoa/issues/6656)). + +### Compatibility + +* File format: Generates Realms with format v10 (Reads and upgrades all previous formats) +* Realm Object Server: 3.21.0 or later. +* Realm Studio: 3.11 or later. +* APIs are backwards compatible with all previous releases in the 5.x.y series. +* Carthage release for Swift is built with Xcode 11.6. + +### Internal + +* Upgraded realm-core from v6.0.11 to v6.0.12 +* Upgraded realm-sync from v5.0.11 to v5.0.12 + +5.3.1 Release notes (2020-07-17) +============================================================= + +### Enhancements + +* Add prebuilt binary for Xcode 11.6 to the release package. + +### Fixed + +* Creating an object inside migration which changed that object type's primary + key would hit an assertion failure mentioning primary_key_col + ([#6613](https://github.com/realm/realm-cocoa/issues/6613), since 5.0.0). +* Modifying the value of a string primary key property inside a migration with + a Realm file which was upgraded from pre-5.0 would corrupt the property's + index, typically resulting in crashes. ([Core #3765](https://github.com/realm/realm-core/issues/3765), since 5.0.0). +* Some Realm files which hit assertion failures when upgrading from the pre-5.0 + file format should now upgrade correctly (Since 5.0.0). + +### Compatibility + +* File format: Generates Realms with format v10 (Reads and upgrades all previous formats) +* Realm Object Server: 3.21.0 or later. +* Realm Studio: 3.11 or later. +* APIs are backwards compatible with all previous releases in the 5.x.y series. +* Carthage release for Swift is built with Xcode 11.6. + +### Internal + +* Upgraded realm-core from v6.0.9 to v6.0.11 +* Upgraded realm-sync from v5.0.8 to v5.0.11 + +5.3.0 Release notes (2020-07-14) +============================================================= + +### Enhancements + +* Add `Realm.objectWillChange`, which is a Combine publisher that will emit a + notification each time the Realm is refreshed or a write transaction is + commited. + +### Fixed + +* Fix the spelling of `ObjectKeyIdentifiable`. The old spelling is available + and deprecated for compatiblity. +* Rename `RealmCollection.publisher` to `RealmCollection.collectionPublisher`. + The old name interacted with the `publisher` defined by `Sequence` in very + confusing ways, so we need to use a different name. The `publisher` name is + still available for compatiblity. ([#6516](https://github.com/realm/realm-cocoa/issues/6516)) +* Work around "xcodebuild timed out while trying to read + SwiftPackageManagerExample.xcodeproj" errors when installing Realm via + Carthage. ([#6549](https://github.com/realm/realm-cocoa/issues/6549)). +* Fix a performance regression when using change notifications. (Since 5.0.0, + [#6629](https://github.com/realm/realm-cocoa/issues/6629)). + +### Compatibility + +* File format: Generates Realms with format v10 (Reads and upgrades all previous formats) +* Realm Object Server: 3.21.0 or later. +* Realm Studio: 3.11 or later. +* APIs are backwards compatible with all previous releases in the 5.x.y series. +* Carthage release for Swift is built with Xcode 11.5. + +### Internal + +* Upgraded realm-core from v6.0.8 to v6.0.9 +* Upgraded realm-sync from v5.0.7 to v5.0.8 + +5.2.0 Release notes (2020-06-30) +============================================================= + +Xcode 11.3 and iOS 9 are now the minimum supported versions. + +### Enhancements + +* Add support for building with Xcode 12 beta 1. watchOS currently requires + removing x86_64 from the supported architectures. Support for the new 64-bit + watch simulator will come in a future release. + +### Fixed + +* Opening a Realm file in file format v6 (created by Realm Cocoa versions + between 2.4 and 2.10) would crash. (Since 5.0.0, [Core #3764](https://github.com/realm/realm-core/issues/3764)). +* Upgrading v9 (pre-5.0) Realm files would create a redundant search index for + primary key properties. This index would then be removed the next time the + Realm was opened, resulting in some extra i/o in the upgrade process. + (Since 5.0.0, [Core #3787](https://github.com/realm/realm-core/issues/3787)). +* Fixed a performance issue with upgrading v9 files with search indexes on + non-primary-key properties. (Since 5.0.0, [Core #3767](https://github.com/realm/realm-core/issues/3767)). +* `List.index(of:)` would give incorrect results if it was the very first thing + called on that List after a Realm was refreshed following a write which + modified the List. (Since 5.0.0, [#6606](https://github.com/realm/realm-cocoa/issues/6606)). +* If a ThreadSafeReference was the only remaining reference to a Realm, + multiple copies of the file could end up mapped into memory at once. This + probably did not have any symptoms other than increased memory usage. (Since 5.0.0). + +### Compatibility + +* File format: Generates Realms with format v10 (Reads and upgrades all previous formats) +* Realm Object Server: 3.21.0 or later. +* Realm Studio: 3.11 or later. +* APIs are backwards compatible with all previous releases in the 5.x.y series. +* Carthage release for Swift is built with Xcode 11.5. + +### Internal + +* Upgraded realm-core from v6.0.6 to v6.0.8 +* Upgraded realm-sync from v5.0.5 to v5.0.7 + +5.1.0 Release notes (2020-06-22) +============================================================= + +### Enhancements + +* Allow opening full-sync Realms in read-only mode. This disables local schema + initialization, which makes it possible to open a Realm which the user does + not have write access to without using asyncOpen. In addition, it will report + errors immediately when an operation would require writing to the Realm + rather than reporting it via the sync error handler only after the server + rejects the write. + +### Fixed + +* Opening a Realm using a configuration object read from an existing Realm + would incorrectly bind the new Realm to the original Realm's thread/queue, + resulting in "Realm accessed from incorrect thread." exceptions. + ([#6574](https://github.com/realm/realm-cocoa/issues/6574), + [#6559](https://github.com/realm/realm-cocoa/issues/6559), since 5.0.0). + +### Compatibility + +* File format: Generates Realms with format v10 (Reads and upgrades all previous formats) +* Realm Object Server: 3.21.0 or later. +* Realm Studio: 3.11 or later. +* APIs are backwards compatible with all previous releases in the 5.x.y series. +* Carthage release for Swift is built with Xcode 11.5. + 5.0.3 Release notes (2020-06-10) ============================================================= diff --git a/Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig b/Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig index 89ac3a2a3..c4d6f5e2f 100644 --- a/Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig +++ b/Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig @@ -24,6 +24,7 @@ CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; COMBINE_HIDPI_IMAGES = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -57,10 +58,20 @@ CODE_SIGN_IDENTITY[sdk=iphone*] = iPhone Developer; CODE_SIGNING_REQUIRED[sdk=macosx] = NO; MACOSX_DEPLOYMENT_TARGET = 10.9; -IPHONEOS_DEPLOYMENT_TARGET = 8.0; +IPHONEOS_DEPLOYMENT_TARGET = 9.0; WATCHOS_DEPLOYMENT_TARGET = 2.0; TVOS_DEPLOYMENT_TARGET = 9.0; -SWIFT_VERSION = 4.0; +// Xcode 11 "helpfully" "corrects" arm64 to x86_64 when you try to exclude +// arm64 on platforms that it doesn't support building for arm64 on. +REALM_ARM_ARCHS_1200 = arm64 arm64e; +REALM_ARM_ARCHS = $(REALM_ARM_ARCHS_$(XCODE_VERSION_MAJOR)) + +EXCLUDED_ARCHS[sdk=macosx*] = $(REALM_ARM_ARCHS); +EXCLUDED_ARCHS[sdk=watchsimulator*] = $(REALM_ARM_ARCHS); +EXCLUDED_ARCHS[sdk=iphonesimulator*] = $(REALM_ARM_ARCHS); +EXCLUDED_ARCHS[sdk=appletvsimulator*] = $(REALM_ARM_ARCHS); + +SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1,2,3,4; SDKROOT = $(REALM_SDKROOT); diff --git a/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm iOS static.xcconfig b/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm iOS static.xcconfig index 8dbe058bb..bada4105a 100644 --- a/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm iOS static.xcconfig +++ b/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm iOS static.xcconfig @@ -2,7 +2,7 @@ SUPPORTED_PLATFORMS = iphoneos iphonesimulator; TARGETED_DEVICE_FAMILY = 1,2; -IPHONEOS_DEPLOYMENT_TARGET = 8.0; +IPHONEOS_DEPLOYMENT_TARGET = 9.0; MACH_O_TYPE = staticlib; EXECUTABLE_NAME = Realm; diff --git a/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Tests iOS static.xcconfig b/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Tests iOS static.xcconfig index c9351017a..85cf7cc94 100644 --- a/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Tests iOS static.xcconfig +++ b/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Tests iOS static.xcconfig @@ -2,6 +2,6 @@ CONFIGURATION_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static; CONFIGURATION_TEMP_DIR = $(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static; -IPHONEOS_DEPLOYMENT_TARGET = 8.0; +IPHONEOS_DEPLOYMENT_TARGET = 9.0; TEST_HOST[sdk=iphone*] = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static/TestHost static.app/TestHost static; diff --git a/Carthage/Checkouts/realm-cocoa/Configuration/TestHost.xcconfig b/Carthage/Checkouts/realm-cocoa/Configuration/TestHost.xcconfig index c8cc93fc3..3042edff3 100644 --- a/Carthage/Checkouts/realm-cocoa/Configuration/TestHost.xcconfig +++ b/Carthage/Checkouts/realm-cocoa/Configuration/TestHost.xcconfig @@ -22,4 +22,4 @@ PRINCIPAL_CLASS[sdk=iphone*] = UIApplication; PRINCIPAL_CLASS[sdk=appletv*] = UIApplication; PRINCIPAL_CLASS[sdk=macosx*] = NSApplication; -IPHONEOS_DEPLOYMENT_TARGET = 8.0; +IPHONEOS_DEPLOYMENT_TARGET = 9.0; diff --git a/Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability b/Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability index 05ef51cff..7e9aac3d4 100644 --- a/Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability +++ b/Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability @@ -1,9 +1,9 @@ -xcodeVersions = ['10.3', '11.1', '11.2.1', '11.3', '11.4.1', '11.5'] +xcodeVersions = ['11.3', '11.4.1', '11.5', '11.6'] platforms = ['osx', 'ios', 'watchos', 'tvos', 'catalyst'] carthagePlatforms = ['osx', 'ios', 'watchos', 'tvos'] platformNames = ['osx': 'macOS', 'ios': 'iOS', 'watchos': 'watchOS', 'tvos': 'tvOS', 'catalyst': 'Catalyst'] carthageXcodeVersion = '11.5' -objcXcodeVersion = '10.3' +objcXcodeVersion = '11.3' docsSwiftVersion = '5.2.4' def installationTest(platform, test, language) { @@ -163,11 +163,6 @@ def doBuild() { unstash "${platform}-${objcXcodeVersion}" } - // The 10.x builds don't actually have a framework for catalyst, so - // use the 11.0 version instead - unstash 'catalyst-11.1' - sh "mv realm-framework-catalyst-11.1.zip realm-framework-catalyst-${objcXcodeVersion}.zip" - unstash 'ios-static' unstash 'examples' unstash 'source' diff --git a/Carthage/Checkouts/realm-cocoa/Realm.podspec b/Carthage/Checkouts/realm-cocoa/Realm.podspec index f1d9b2eee..df15d2694 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm.podspec +++ b/Carthage/Checkouts/realm-cocoa/Realm.podspec @@ -95,7 +95,7 @@ Pod::Spec.new do |s| } s.preserve_paths = %w(build.sh include) - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '9.0' s.ios.vendored_library = 'core/librealmcore-ios.a' s.osx.deployment_target = '10.9' diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm index 7395428ad..1841ba933 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm @@ -21,12 +21,15 @@ #import "RLMSyncSessionRefreshHandle+ObjectServerTests.h" #import "RLMSyncUser+ObjectServerTests.h" +#import "RLMObjectSchema_Private.hpp" #import "RLMRealm+Sync.h" #import "RLMRealmConfiguration_Private.h" #import "RLMRealmUtil.hpp" #import "RLMRealm_Dynamic.h" #import "RLMRealm_Private.hpp" +#import "RLMSchema_Private.h" #import "RLMSyncUtil_Private.h" + #import "shared_realm.hpp" #pragma mark - Test objects @@ -2351,4 +2354,98 @@ static NSURL *certificateURL(NSString *filename) { [self waitForExpectations:@[ex3, ex4] timeout:4.0]; } +#pragma mark - Read Only + +- (RLMSyncUser *)userForTest:(SEL)sel { + return [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(sel) + register:self.isParent] + server:[RLMObjectServerTests authServerURL]]; +} + +- (void)testPartialSyncCannotBeReadOnly { + RLMSyncUser *user = [self userForTest:_cmd]; + RLMRealmConfiguration *config = [user configurationWithURL:nil fullSynchronization:NO]; + RLMAssertThrowsWithReason(config.readOnly = true, + @"Read-only mode is not supported for query-based sync."); +} + +- (void)testOpenSynchronouslyInReadOnlyBeforeRemoteSchemaIsInitialized { + NSURL *url = REALM_URL(); + RLMSyncUser *user = [self userForTest:_cmd]; + + if (self.isParent) { + RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:YES]; + config.readOnly = true; + RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil]; + CHECK_COUNT(0, SyncObject, realm); + RLMRunChildAndWait(); + [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@3]]; + } else { + RLMRealm *realm = [self openRealmForURL:url user:user]; + [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]]; + [self waitForUploadsForRealm:realm]; + CHECK_COUNT(3, SyncObject, realm); + } +} + +- (void)testAddPropertyToReadOnlyRealmWithExistingLocalCopy { + NSURL *url = REALM_URL(); + RLMSyncUser *user = [self userForTest:_cmd]; + + if (!self.isParent) { + RLMRealm *realm = [self openRealmForURL:url user:user]; + [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]]; + [self waitForUploadsForRealm:realm]; + return; + } + RLMRunChildAndWait(); + + RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:YES]; + config.readOnly = true; + @autoreleasepool { + (void)[self asyncOpenRealmWithConfiguration:config]; + } + + RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:SyncObject.class]; + objectSchema.properties = [RLMObjectSchema schemaForObjectClass:HugeSyncObject.class].properties; + config.customSchema = [[RLMSchema alloc] init]; + config.customSchema.objectSchema = @[objectSchema]; + + RLMAssertThrowsWithReason([RLMRealm realmWithConfiguration:config error:nil], + @"Property 'SyncObject.dataProp' has been added."); + + @autoreleasepool { + NSError *error = [self asyncOpenErrorWithConfiguration:config]; + XCTAssertNotEqual([error.localizedDescription rangeOfString:@"Property 'SyncObject.dataProp' has been added."].location, + NSNotFound); + } +} + +- (void)testAddPropertyToReadOnlyRealmWithAsyncOpen { + NSURL *url = REALM_URL(); + RLMSyncUser *user = [self userForTest:_cmd]; + + if (!self.isParent) { + RLMRealm *realm = [self openRealmForURL:url user:user]; + [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]]; + [self waitForUploadsForRealm:realm]; + return; + } + RLMRunChildAndWait(); + + RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:YES]; + config.readOnly = true; + + RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:SyncObject.class]; + objectSchema.properties = [RLMObjectSchema schemaForObjectClass:HugeSyncObject.class].properties; + config.customSchema = [[RLMSchema alloc] init]; + config.customSchema.objectSchema = @[objectSchema]; + + @autoreleasepool { + NSError *error = [self asyncOpenErrorWithConfiguration:config]; + XCTAssertNotEqual([error.localizedDescription rangeOfString:@"Property 'SyncObject.dataProp' has been added."].location, + NSNotFound); + } +} + @end diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m index ce2d13166..6a47ff75d 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m @@ -555,6 +555,36 @@ static NSURL *makeTildeSubstitutedURL(NSURL *url, RLMSyncUser *user) { REVOKE_PERMISSION(p, admin); } +- (void)testReadAccessWithClassSuperset { + NSString *testName = NSStringFromSelector(_cmd); + + // Create a Realm with only a single object type + NSURL *userAURL = makeTestURL(testName, nil); + RLMRealmConfiguration *userAConfig = [self.userA configurationWithURL:userAURL fullSynchronization:YES]; + userAConfig.objectClasses = @[SyncObject.self]; + RLMRealm *userARealm = [self asyncOpenRealmWithConfiguration:userAConfig]; + [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-1", @"child-2", @"child-3"]]; + [self waitForUploadsForRealm:userARealm]; + CHECK_COUNT(3, SyncObject, userARealm); + + // Give user B read-only permissions to that Realm so that it can't add new object types + RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[userAURL path] + identity:self.userB.identity + accessLevel:RLMSyncAccessLevelRead]; + APPLY_PERMISSION(p, self.userA); + + // Open the same Realm s user B without limiting the set of object classes + NSURL *userBURL = makeTestURL(testName, self.userA); + RLMRealmConfiguration *userBConfig = [self.userB configurationWithURL:userBURL fullSynchronization:YES]; + userBConfig.readOnly = YES; + RLMRealm *userBRealm = [self asyncOpenRealmWithConfiguration:userBConfig]; + CHECK_COUNT(3, SyncObject, userBRealm); + + // Verify that syncing is actually working and new objects written by A show up in B's Realm + [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-4"]]; + CHECK_COUNT_PENDING_DOWNLOAD(4, SyncObject, userBRealm); +} + #pragma mark - Permission change API /// Setting a permission should work, and then that permission should be able to be retrieved. diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h index 42a23fbdc..e9ef6a4bb 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h @@ -58,6 +58,12 @@ NS_ASSUME_NONNULL_BEGIN /// Synchronously open a synced Realm and wait until the binding process has completed or failed. - (RLMRealm *)openRealmWithConfiguration:(RLMRealmConfiguration *)configuration; +/// Synchronously open a synced Realm via asyncOpen and return the Realm. +- (RLMRealm *)asyncOpenRealmWithConfiguration:(RLMRealmConfiguration *)configuration; + +/// Synchronously open a synced Realm via asyncOpen and return the expected error. +- (NSError *)asyncOpenErrorWithConfiguration:(RLMRealmConfiguration *)configuration; + /// Synchronously open a synced Realm. Also run a block right after the Realm is created. - (RLMRealm *)openRealmForURL:(NSURL *)url user:(RLMSyncUser *)user diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm index d114d0597..330c70581 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm @@ -349,6 +349,37 @@ static NSURL *syncDirectoryForChildProcess() { @"Timed out while trying to asynchronously open Realm for URL: %@", syncConfig.realmURL); return realm; } + +- (RLMRealm *)asyncOpenRealmWithConfiguration:(RLMRealmConfiguration *)config { + __block RLMRealm *realm = nil; + XCTestExpectation *ex = [self expectationWithDescription:@"Should asynchronously open a Realm"]; + [RLMRealm asyncOpenWithConfiguration:config + callbackQueue:dispatch_get_main_queue() + callback:^(RLMRealm *r, NSError *err){ + XCTAssertNil(err); + XCTAssertNotNil(r); + realm = r; + [ex fulfill]; + }]; + [self waitForExpectationsWithTimeout:10.0 handler:nil]; + return realm; +} + +- (NSError *)asyncOpenErrorWithConfiguration:(RLMRealmConfiguration *)config { + __block NSError *error = nil; + XCTestExpectation *ex = [self expectationWithDescription:@"Should fail to asynchronously open a Realm"]; + [RLMRealm asyncOpenWithConfiguration:config + callbackQueue:dispatch_get_main_queue() + callback:^(RLMRealm *r, NSError *err){ + XCTAssertNotNil(err); + XCTAssertNil(r); + error = err; + [ex fulfill]; + }]; + [self waitForExpectationsWithTimeout:10.0 handler:nil]; + return error; +} + - (RLMRealm *)immediatelyOpenRealmForURL:(NSURL *)url user:(RLMSyncUser *)user { return [self immediatelyOpenRealmForURL:url user:user @@ -542,7 +573,20 @@ static NSURL *syncDirectoryForChildProcess() { } - (void)resetSyncManager { - [RLMSyncManager.sharedManager._allUsers makeObjectsPerformSelector:@selector(logOut)]; + NSMutableArray *expectations = [NSMutableArray new]; + for (RLMSyncUser *user in RLMSyncManager.sharedManager._allUsers) { + [user logOut]; + // Sessions are removed from the user asynchronously after a logout. + // We need to wait for this to happen before calling resetForTesting as + // that expects all sessions to be cleaned up first. This doesn't apply + // to admin token users, which don't logout at all (and don't have an + // auth server). + if (user.authenticationServer && user.allSessions.count) { + [expectations addObject:[self expectationForPredicate:[NSPredicate predicateWithFormat:@"allSessions.@count == 0"] + evaluatedWithObject:user handler:nil]]; + } + } + [self waitForExpectations:expectations timeout:5.0]; [RLMSyncManager resetForTesting]; [RLMSyncSessionRefreshHandle calculateFireDateUsingTestLogic:NO blockOnRefreshCompletion:nil]; } diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/CodeCoverage.cmake b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/CodeCoverage.cmake index 17c09b90e..e9de69d8f 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/CodeCoverage.cmake +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/CodeCoverage.cmake @@ -20,8 +20,7 @@ find_program(LCOV_PATH lcov) find_program(GENHTML_PATH genhtml) find_program(GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests) -set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 -fprofile-arcs -ftest-coverage -DCATCH_CONFIG_FAST_COMPILE" - CACHE STRING "Flags used by the C++ compiler during coverage builds.") +set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 -fprofile-arcs -ftest-coverage -DCATCH_CONFIG_FAST_COMPILE") mark_as_advanced(CMAKE_CXX_FLAGS_COVERAGE) if(CMAKE_BUILD_TYPE STREQUAL "Coverage") @@ -50,7 +49,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Coverage") add_custom_target(${targetname}-cobertura COMMAND ${testrunner} - COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR}/src ./src -o coverage.xml + COMMAND ${GCOVR_PATH} -x -o coverage.xml -f 'src/.*' -f "${CMAKE_SOURCE_DIR}/src.*" --exclude-directories "${CMAKE_BINARY_DIR}/tests" --exclude-directories="${CMAKE_SOURCE_DIR}/\.tmp" --exclude ".*realm\-core.*" --exclude ".*realm\-sync.*" COMMAND echo Code coverage report written to coverage.xml WORKING_DIRECTORY ${CMAKE_BINARY_DIR} diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake index 5b0607600..1c440e340 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake @@ -200,7 +200,7 @@ function(download_realm_core core_version) set_property(TARGET realm PROPERTY IMPORTED_LOCATION_RELEASE ${core_library_release}) set_property(TARGET realm PROPERTY IMPORTED_LOCATION ${core_library_release}) - set_property(TARGET realm PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads ${CRYPTO_LIBRARIES}) + set_property(TARGET realm PROPERTY INTERFACE_LINK_LIBRARIES ${CRYPTO_LIBRARIES} Threads::Threads) # Create directories that are included in INTERFACE_INCLUDE_DIRECTORIES, as CMake requires they exist at # configure time, when they'd otherwise not be created until we download and extract core. @@ -223,8 +223,8 @@ macro(build_realm_core) BUILD_IN_SOURCE 1 UPDATE_DISCONNECTED 1 INSTALL_COMMAND "" - CONFIGURE_COMMAND cmake -B build.debug -DOpenSSL_DIR="${CMAKE_BINARY_DIR}/openssl/lib/cmake/OpenSSL" -D CMAKE_BUILD_TYPE=Debug ${CORE_SANITIZER_FLAGS} -G Ninja - && cmake -B build.release -DOpenSSL_DIR="${CMAKE_BINARY_DIR}/openssl/lib/cmake/OpenSSL" -D CMAKE_BUILD_TYPE=RelWithDebInfo ${CORE_SANITIZER_FLAGS} -G Ninja + CONFIGURE_COMMAND cmake -B build.debug -DOpenSSL_DIR=${CMAKE_BINARY_DIR}/openssl/lib/cmake/OpenSSL -D CMAKE_BUILD_TYPE=Debug ${CORE_SANITIZER_FLAGS} -G Ninja + && cmake -B build.release -DOpenSSL_DIR=${CMAKE_BINARY_DIR}/openssl/lib/cmake/OpenSSL -D CMAKE_BUILD_TYPE=RelWithDebInfo ${CORE_SANITIZER_FLAGS} -G Ninja BUILD_COMMAND cmake --build build.debug --target Storage --target QueryParser && cmake --build build.release --target Storage --target QueryParser diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Jenkinsfile b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Jenkinsfile index 7fb1b3eb2..1c74e9e3d 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Jenkinsfile +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Jenkinsfile @@ -1,4 +1,7 @@ #!groovy + +@Library('realm-ci') _ + def getSourceArchive() { deleteDir() unstash 'source' @@ -23,10 +26,11 @@ def buildDockerEnv(name, dockerfile='Dockerfile', extra_args='') { return docker.image(name) } -def publishReport(String label) { +def publishCoverageReport(String label) { // Unfortunately, we cannot add a title or tag to individual coverage reports. echo "Unstashing coverage-${label}" unstash("coverage-${label}") + step([ $class: 'CoberturaPublisher', autoUpdateHealth: false, @@ -46,7 +50,7 @@ if (env.BRANCH_NAME == 'master') { env.DOCKER_PUSH = "1" } -def doDockerBuild(String flavor, Boolean withCoverage, Boolean enableSync, String sanitizerFlags = "") { +def doDockerBuild(String flavor, Boolean enableSync, String sanitizerFlags = "") { def sync = enableSync ? "sync" : "" def label = "${flavor}${enableSync ? '-sync' : ''}" @@ -56,17 +60,9 @@ def doDockerBuild(String flavor, Boolean withCoverage, Boolean enableSync, Strin def image = buildDockerEnv("ci/realm-object-store:${flavor}") sshagent(['realm-ci-ssh']) { image.inside("-v /etc/passwd:/etc/passwd:ro -v ${env.HOME}:${env.HOME} -v ${env.SSH_AUTH_SOCK}:${env.SSH_AUTH_SOCK} -e HOME=${env.HOME}") { - if(withCoverage) { - sh "rm -rf coverage.build ${label}.build && ./workflow/test_coverage.sh ${sync} && mv coverage.build ${label}.build" - } else { - sh "./workflow/build.sh ${flavor} ${sync} ${sanitizerFlags}" - } + sh "./workflow/build.sh ${flavor} ${sync} ${sanitizerFlags}" } } - if(withCoverage) { - echo "Stashing coverage-${label}" - stash includes: "${label}.build/coverage.xml", name: "coverage-${label}" - } } } } @@ -166,10 +162,10 @@ stage('prepare') { stage('unit-tests') { parallel( - linux: doDockerBuild('linux', false, false), - linux_sync: doDockerBuild('linux', true, true), - linux_asan: doDockerBuild('linux', false, true, '-DSANITIZE_ADDRESS=1'), - linux_tsan: doDockerBuild('linux', false, true, '-DSANITIZE_THREAD=1'), + linux: doDockerBuild('linux', false), + linux_sync: doDockerBuild('linux', true), + linux_asan: doDockerBuild('linux', true, '-DSANITIZE_ADDRESS=1'), + linux_tsan: doDockerBuild('linux', true, '-DSANITIZE_THREAD=1'), android: doAndroidDockerBuild(), macos: doBuild('osx', 'macOS', false, ''), macos_sync: doBuild('osx', 'macOS', true, ''), @@ -181,7 +177,11 @@ stage('unit-tests') { stage('publish') { node('docker') { - publishReport('linux-sync') - publishReport('macOS-sync') + // we need sources to allow the coverage report to display them + rlmCheckout(scm) + // coverage reports assume sources are in the parent directory + dir("build") { + publishCoverageReport('macOS-sync') + } } } diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list index cf5151695..9710b0a6d 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list @@ -1,4 +1,4 @@ -REALM_CORE_VERSION=6.0.1 -REALM_SYNC_VERSION=5.0.0 +REALM_CORE_VERSION=6.0.10 +REALM_SYNC_VERSION=5.0.9 REALM_CORE_PACKAGING=2 OPENSSL_VERSION=1.1.1b diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/results_notifier.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/results_notifier.cpp index e8451a082..633ded68d 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/results_notifier.cpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/results_notifier.cpp @@ -181,13 +181,21 @@ void ResultsNotifier::do_prepare_handover(Transaction& sg) bool ResultsNotifier::prepare_to_deliver() { auto lock = lock_target(); - if (!get_realm()) { + auto realm = get_realm(); + if (!realm) { m_handover_tv.reset(); m_delivered_tv.reset(); return false; } - if (!m_handover_tv) + if (!m_handover_tv) { + bool transaction_is_stale = m_delivered_transaction && + (!realm->is_in_read_transaction() || realm->read_transaction_version() > m_delivered_transaction->get_version_of_current_transaction()); + if (transaction_is_stale) { + m_delivered_tv.reset(); + m_delivered_transaction.reset(); + } return true; + } m_results_were_used = !m_delivered_tv; m_delivered_tv.reset(); diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object.cpp index 11699290f..318da0c80 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object.cpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object.cpp @@ -124,6 +124,23 @@ Property const& Object::property_for_name(StringData prop_name) const return *prop; } +void Object::validate_property_for_setter(Property const& property) const +{ + verify_attached(); + m_realm->verify_in_write(); + + // Modifying primary keys is allowed in migrations to make it possible to + // add a new primary key to a type (or change the property type), but it + // is otherwise considered the immutable identity of the row + if (property.is_primary) { + if (!m_realm->is_in_migration()) + throw ModifyPrimaryKeyException(m_object_schema->name, property.name); + // Modifying the PK property while it's the PK will corrupt the table, + // so remove it and then restore it at the end of the migration (which will rebuild the table) + m_obj.get_table()->set_primary_key_column({}); + } +} + #if REALM_ENABLE_SYNC void Object::ensure_user_in_everyone_role() { diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object.hpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object.hpp index 06cea3a1b..1f2751a2f 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object.hpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object.hpp @@ -146,6 +146,7 @@ private: void verify_attached() const; Property const& property_for_name(StringData prop_name) const; + void validate_property_for_setter(Property const&) const; }; struct InvalidatedObjectException : public std::logic_error { diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object_accessor.hpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object_accessor.hpp index c49897ff3..f02b6f901 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object_accessor.hpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/object_accessor.hpp @@ -43,16 +43,8 @@ template <typename ValueType, typename ContextType> void Object::set_property_value(ContextType& ctx, StringData prop_name, ValueType value, CreatePolicy policy) { - verify_attached(); - m_realm->verify_in_write(); auto& property = property_for_name(prop_name); - - // Modifying primary keys is allowed in migrations to make it possible to - // add a new primary key to a type (or change the property type), but it - // is otherwise considered the immutable identity of the row - if (property.is_primary && !m_realm->is_in_migration()) - throw ModifyPrimaryKeyException(m_object_schema->name, property.name); - + validate_property_for_setter(property); set_property_value_impl(ctx, property, value, policy, false); } @@ -186,75 +178,91 @@ Object Object::create(ContextType& ctx, std::shared_ptr<Realm> const& realm, } template<typename ValueType, typename ContextType> +Mixed as_mixed(ContextType& ctx, ValueType& value, PropertyType type) +{ + if (!value) + return {}; + return switch_on_type(type, [&](auto* t) { + return Mixed(ctx.template unbox<NonObjTypeT<decltype(*t)>>(*value)); + }); +} + +template<typename ValueType, typename ContextType> Object Object::create(ContextType& ctx, std::shared_ptr<Realm> const& realm, ObjectSchema const& object_schema, ValueType value, CreatePolicy policy, ObjKey current_obj, Obj* out_row) { realm->verify_in_write(); - // get or create our accessor + // When setting each property, we normally want to skip over the primary key + // as that's set as part of object creation. However, during migrations the + // property marked as the primary key in the schema may not currently be + // considered a primary key by core, and so will need to be set. + bool skip_primary = true; + // If the input value is missing values for any of the properties we want to + // set the propery to the default value for new objects, but leave it + // untouched for existing objects. bool created = false; - // try to get existing row if updating Obj obj; auto table = realm->read_group().get_table(object_schema.table_key); - bool skip_primary = true; + // If there's a primary key, we need to first check if an object with the + // same primary key already exists. If it does, we either update that object + // or throw an exception if updating is disabled. if (auto primary_prop = object_schema.primary_key_property()) { - // search for existing object based on primary key type auto primary_value = ctx.value_for_property(value, *primary_prop, primary_prop - &object_schema.persisted_properties[0]); if (!primary_value) primary_value = ctx.default_value_for_property(object_schema, *primary_prop); - if (!primary_value) { - if (!is_nullable(primary_prop->type)) - throw MissingPropertyValueException(object_schema.name, primary_prop->name); - primary_value = ctx.null_value(); - } - auto key = get_for_primary_key_impl(ctx, *table, *primary_prop, *primary_value); - if (key) { - if (policy != CreatePolicy::ForceCreate) - obj = table->get_object(key); - else if (realm->is_in_migration()) { - // Creating objects with duplicate primary keys is allowed in migrations - // as long as there are no duplicates at the end, as adding an entirely - // new column which is the PK will inherently result in duplicates at first - obj = table->create_object(); - created = true; - skip_primary = false; - } - else { - throw std::logic_error(util::format("Attempting to create an object of type '%1' with an existing primary key value '%2'.", - object_schema.name, ctx.print(*primary_value))); + if (!primary_value && !is_nullable(primary_prop->type)) + throw MissingPropertyValueException(object_schema.name, primary_prop->name); + + // When changing the primary key of a table, we remove the existing pk (if any), call + // the migration function, then add the new pk (if any). This means that we can't call + // create_object_with_primary_key(), and creating duplicate primary keys is allowed as + // long as they're unique by the end of the migration. + if (table->get_primary_key_column() == ColKey{}) { + REALM_ASSERT(realm->is_in_migration()); + if (policy != CreatePolicy::ForceCreate) { + if (auto key = get_for_primary_key_impl(ctx, *table, *primary_prop, *primary_value)) + obj = table->get_object(key); } + if (!obj) + skip_primary = false; } else { - created = true; - Mixed primary_key; - if (primary_prop->type == PropertyType::Int) { - primary_key = ctx.template unbox<util::Optional<int64_t>>(*primary_value); - } - else if (primary_prop->type == PropertyType::String) { - primary_key = ctx.template unbox<StringData>(*primary_value); - } - else { - REALM_TERMINATE("Unsupported primary key type."); + obj = table->create_object_with_primary_key(as_mixed(ctx, primary_value, primary_prop->type), &created); + if (!created && policy == CreatePolicy::ForceCreate) { + if (!realm->is_in_migration()) { + throw std::logic_error(util::format("Attempting to create an object of type '%1' with an existing primary key value '%2'.", + object_schema.name, ctx.print(*primary_value))); + } + table->set_primary_key_column(ColKey{}); + skip_primary = false; + obj = {}; } - obj = table->create_object_with_primary_key(primary_key); } } - else { + + // No primary key (possibly temporarily due to migrations). If we're + // currently performing a recursive update on an existing object tree then + // an object key was passed in that we need to look up, and otherwise we + // need to create the new object. + if (!obj) { if (policy == CreatePolicy::UpdateModified && current_obj) { obj = table->get_object(current_obj); } else { - obj = table->create_object(); + obj = table->create_object(); created = true; } } - // populate Object object(realm, object_schema, obj); + // KVO in Cocoa requires that the obj ivar on the wrapper object be set + // *before* we start setting the properties, so it passes in a pointer to + // that. if (out_row) *out_row = obj; for (size_t i = 0; i < object_schema.persisted_properties.size(); ++i) { @@ -271,6 +279,9 @@ Object Object::create(ContextType& ctx, std::shared_ptr<Realm> const& realm, v = ctx.default_value_for_property(object_schema, prop); is_default = true; } + // We consider null or a missing value to be equivalent to an empty + // array for historical reasons; the original implementation did this + // accidentally and it's not worth changing. if ((!v || ctx.is_null(*v)) && !is_nullable(prop.type) && !is_array(prop.type)) { if (prop.is_primary || !ctx.allow_missing(value)) throw MissingPropertyValueException(object_schema.name, prop.name); diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/property.hpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/property.hpp index 9905c0b03..72198ae08 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/property.hpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/property.hpp @@ -173,6 +173,19 @@ inline constexpr bool is_nullable(PropertyType a) return to_underlying(a & PropertyType::Nullable) == to_underlying(PropertyType::Nullable); } +// Some of the places we use switch_on_type() the Obj version isn't instantiatable +// or reachable, so we want to map it to a valid type to let the unreachable code compile +template<typename T> +struct NonObjType { + using type = std::remove_reference_t<T>; +}; +template<> +struct NonObjType<Obj&> { + using type = int64_t; +}; +template<typename T> +using NonObjTypeT = typename NonObjType<T>::type; + template<typename ObjType=Obj, typename Fn> static auto switch_on_type(PropertyType type, Fn&& fn) { diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/thread_safe_reference.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/thread_safe_reference.cpp index b335e650a..ecae494ae 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/thread_safe_reference.cpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/thread_safe_reference.cpp @@ -24,6 +24,8 @@ #include "results.hpp" #include "shared_realm.hpp" +#include "impl/realm_coordinator.hpp" + #include <realm/db.hpp> #include <realm/keys.hpp> @@ -33,6 +35,7 @@ public: virtual ~Payload() = default; Payload(Realm& realm) : m_transaction(realm.is_in_read_transaction() ? realm.duplicate() : nullptr) + , m_coordinator(Realm::Internal::get_coordinator(realm).shared_from_this()) , m_created_in_write_transaction(realm.is_in_transaction()) { } @@ -43,7 +46,7 @@ protected: const TransactionRef m_transaction; private: - const VersionID m_target_version; + const std::shared_ptr<_impl::RealmCoordinator> m_coordinator; const bool m_created_in_write_transaction; }; @@ -106,19 +109,6 @@ private: std::string m_object_schema_name; }; -template<typename T> -struct ListType { - using type = Lst<std::remove_reference_t<T>>; -}; - -// The code path which would instantiate List<Obj> isn't reachable, but still -// produces errors about the type not being instantiable so we instead map it -// to an arbitrary valid type -template<> -struct ListType<Obj&> { - using type = Lst<int64_t>; -}; - template<> class ThreadSafeReference::PayloadImpl<Results> : public ThreadSafeReference::Payload { public: @@ -158,7 +148,7 @@ public: // match what happens for other types of handover where the // object doesn't exist. switch_on_type(ObjectSchema::from_core_type(*table, m_col_key), [&](auto* t) -> void { - list = std::make_unique<typename ListType<decltype(*t)>::type>(); + list = std::make_unique<Lst<NonObjTypeT<decltype(*t)>>>(); }); } return Results(r, std::move(list), m_ordering); diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/thread_safe_reference.hpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/thread_safe_reference.hpp index 326a2a703..7dba87f5e 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/thread_safe_reference.hpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/thread_safe_reference.hpp @@ -51,6 +51,9 @@ private: template<typename> class PayloadImpl; std::unique_ptr<Payload> m_payload; }; + +template<> ThreadSafeReference::ThreadSafeReference(std::shared_ptr<Realm> const&); +template<> std::shared_ptr<Realm> ThreadSafeReference::resolve(std::shared_ptr<Realm> const&); } #endif /* REALM_OS_THREAD_SAFE_REFERENCE_HPP */ diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/migrations.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/migrations.cpp index c944e4be5..5f4ca60b5 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/migrations.cpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/migrations.cpp @@ -716,6 +716,14 @@ TEST_CASE("migration: Automatic") { {"array target", { {"value", PropertyType::Int}, }}, + {"int pk", { + {"pk", PropertyType::Int, Property::IsPrimary{true}}, + {"value", PropertyType::Int}, + }}, + {"string pk", { + {"pk", PropertyType::String, Property::IsPrimary{true}}, + {"value", PropertyType::Int}, + }}, }; InMemoryTestFile config; @@ -909,10 +917,22 @@ TEST_CASE("migration: Automatic") { }); } + SECTION("upsert in new realm after modifying primary key") { + realm->update_schema(schema, 2, [&values](auto, auto new_realm, Schema&) { + get_table(new_realm, "all types")->set_primary_key_column(ColKey()); + REQUIRE(new_realm->is_in_transaction()); + CppContext ctx(new_realm); + any_cast<AnyDict&>(values)["bool"] = false; + Object obj = Object::create(ctx, new_realm, "all types", values, CreatePolicy::UpdateAll); + REQUIRE(get_table(new_realm, "all types")->size() == 1); + REQUIRE(get_table(new_realm, "link target")->size() == 2); + REQUIRE(get_table(new_realm, "array target")->size() == 2); + REQUIRE(any_cast<bool>(obj.get_property_value<util::Any>(ctx, "bool")) == false); + }); + } + SECTION("change primary key property type") { schema = set_type(schema, "all types", "pk", PropertyType::String); - // FIXME: changing the primary key of a type with binary columns currently crashes in core - schema = remove_property(schema, "all types", "data"); realm->update_schema(schema, 2, [](auto, auto new_realm, auto&) { Object obj(new_realm, "all types", 0); @@ -943,6 +963,169 @@ TEST_CASE("migration: Automatic") { REQUIRE_NOTHROW(realm->update_schema(schema, 2, good_migration)); REQUIRE(get_table(realm, "all types")->size() == 2); } + + SECTION("modify existing int primary key values in migration") { + // Create several more objects to increase the chance of things + // actually breaking if we're doing invalid things + CppContext ctx(realm); + auto object_schema = realm->schema().find("all types"); + realm->begin_transaction(); + for (int i = 1; i < 10; ++i) { + any_cast<AnyDict&>(values)["pk"] = INT64_C(1) + i; + any_cast<AnyDict&>(values)["int"] = INT64_C(5) + i; + Object::create(ctx, realm, *object_schema, values); + } + realm->commit_transaction(); + + // Increase the PK of each object by one in a migration + realm->update_schema(schema, 2, [](auto, auto new_realm, Schema&) { + CppContext ctx(new_realm); + Results results(new_realm, get_table(new_realm, "all types")); + for (size_t i = 0, count = results.size(); i < count; ++i) { + Object obj(new_realm, results.get<Obj>(i)); + util::Any v = 1 + any_cast<int64_t>(obj.get_property_value<util::Any>(ctx, "pk")); + obj.set_property_value(ctx, "pk", v); + } + }); + + // Create a new object with the no-longer-used pk of 1 + realm->begin_transaction(); + any_cast<AnyDict&>(values)["pk"] = INT64_C(1); + any_cast<AnyDict&>(values)["int"] = INT64_C(4); + object_schema = realm->schema().find("all types"); + Object::create(ctx, realm, *object_schema, values); + realm->commit_transaction(); + + // Verify results + auto table = get_table(realm, "all types"); + REQUIRE(table->size() == 11); + REQUIRE(table->get_primary_key_column() == table->get_column_key("pk")); + for (int i = 0; i < 10; ++i) { + auto obj = table->get_object(i); + REQUIRE(obj.get<int64_t>("pk") == i + 2); + REQUIRE(obj.get<int64_t>("int") == i + 5); + } + auto obj = table->get_object(10); + REQUIRE(obj.get<int64_t>("pk") == 1); + REQUIRE(obj.get<int64_t>("int") == 4); + } + + SECTION("modify existing string primary key values in migration") { + // Create several objects to increase the chance of things + // actually breaking if we're doing invalid things + CppContext ctx(realm); + auto object_schema = realm->schema().find("string pk"); + realm->begin_transaction(); + for (int64_t i = 0; i < 10; ++i) { + util::Any values = AnyDict{ + {"pk", util::to_string(i)}, + {"value", i + 1}, + }; + Object::create(ctx, realm, *object_schema, values); + } + realm->commit_transaction(); + + // Increase the PK of each object by one in a migration + realm->update_schema(schema, 2, [](auto, auto new_realm, Schema&) { + CppContext ctx(new_realm); + Results results(new_realm, get_table(new_realm, "string pk")); + for (size_t i = 0, count = results.size(); i < count; ++i) { + Object obj(new_realm, results.get<Obj>(i)); + util::Any v = util::to_string(any_cast<int64_t>(obj.get_property_value<util::Any>(ctx, "value"))); + obj.set_property_value(ctx, "pk", v); + } + }); + + // Create a new object with the no-longer-used pk of 0 + realm->begin_transaction(); + util::Any values = AnyDict{ + {"pk", "0"s}, + {"value", INT64_C(0)}, + }; + object_schema = realm->schema().find("string pk"); + Object::create(ctx, realm, *object_schema, values); + realm->commit_transaction(); + + // Verify results + auto table = get_table(realm, "string pk"); + REQUIRE(table->size() == 11); + REQUIRE(table->get_primary_key_column() == table->get_column_key("pk")); + for (auto& obj : *table) { + REQUIRE(util::to_string(obj.get<int64_t>("value")).c_str() == obj.get<StringData>("pk")); + } + } + + SECTION("create and modify int primary key inside migration") { + SECTION("with index") { + realm->begin_transaction(); + auto table = get_table(realm, "int pk"); + table->add_search_index(table->get_column_key("pk")); + realm->commit_transaction(); + } + SECTION("no index") { + } + + realm->update_schema(schema, 2, [](auto, auto new_realm, Schema&) { + CppContext ctx(new_realm); + for (int64_t i = 0; i < 10; ++i) { + auto obj = Object::create(ctx, new_realm, *new_realm->schema().find("int pk"), + util::Any(AnyDict{ + {"pk", INT64_C(0)}, + {"value", i} + })); + obj.set_property_value(ctx, "pk", util::Any(i)); + } + }); + + auto table = get_table(realm, "int pk"); + REQUIRE(table->size() == 10); + REQUIRE(table->get_primary_key_column() == table->get_column_key("pk")); + for (int i = 0; i < 10; ++i) { + auto obj = table->get_object(i); + REQUIRE(obj.get<int64_t>("pk") == i); + REQUIRE(obj.get<int64_t>("value") == i); + } + } + + SECTION("create and modify string primary key inside migration") { + SECTION("with index") { + realm->begin_transaction(); + auto table = get_table(realm, "string pk"); + table->add_search_index(table->get_column_key("pk")); + realm->commit_transaction(); + } + SECTION("no index") { + } + + realm->update_schema(schema, 2, [](auto, auto new_realm, Schema&) { + CppContext ctx(new_realm); + for (int64_t i = 0; i < 10; ++i) { + auto obj = Object::create(ctx, new_realm, *new_realm->schema().find("string pk"), + util::Any(AnyDict{ + {"pk", ""s}, + {"value", i} + })); + obj.set_property_value(ctx, "pk", util::Any(util::to_string(i))); + } + }); + + auto table = get_table(realm, "string pk"); + REQUIRE(table->size() == 10); + REQUIRE(table->get_primary_key_column() == table->get_column_key("pk")); + for (auto& obj : *table) + REQUIRE(obj.get<StringData>("pk") == util::to_string(obj.get<int64_t>("value")).c_str()); + } + + SECTION("create object after adding primary key") { + schema = set_primary_key(schema, "all types", ""); + realm->update_schema(schema, 2); + schema = set_primary_key(schema, "all types", "pk"); + REQUIRE_NOTHROW(realm->update_schema(schema, 3, [&](auto, auto new_realm, Schema&) { + CppContext ctx(new_realm); + any_cast<AnyDict&>(values)["pk"] = INT64_C(2); + Object::create(ctx, realm, "all types", values); + })); + } } SECTION("property renaming") { @@ -1132,6 +1315,27 @@ TEST_CASE("migration: Automatic") { schema = set_indexed(schema, "object", "value", true); SUCCESSFUL_RENAME(schema, schema2, {"object", "value", "new"}); } + + SECTION("create object inside migration after renaming pk") { + schema = set_primary_key(schema, "object", "value"); + auto new_schema = set_primary_key(rename_value(schema), "object", "new"); + init(schema); + REQUIRE_NOTHROW(realm->update_schema(new_schema, 2, [](auto, auto realm, Schema& schema) { + ObjectStore::rename_property(realm->read_group(), schema, + "object", "value", "new"); + + CppContext ctx(realm); + util::Any values = AnyDict{{"new", INT64_C(11)}}; + Object::create(ctx, realm, "object", values); + })); + REQUIRE(realm->schema() == new_schema); + VERIFY_SCHEMA(*realm, false); + auto table = ObjectStore::table_for_object_type(realm->read_group(), "object"); + auto key = table->get_column_keys()[0]; + auto it = table->begin(); + REQUIRE(it->get<int64_t>(key) == 10); + REQUIRE((++it)->get<int64_t>(key) == 11); + } } } diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/results.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/results.cpp index 9e7a8a4c4..5327a050c 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/results.cpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/results.cpp @@ -980,6 +980,7 @@ TEST_CASE("notifications: TableView delivery") { InMemoryTestFile config; config.automatic_change_notifications = false; + config.max_number_of_active_versions = 5; auto r = Realm::get_shared_realm(config); r->update_schema({ @@ -1092,6 +1093,15 @@ TEST_CASE("notifications: TableView delivery") { REQUIRE(results.size() == 11); r->cancel_transaction(); } + + SECTION("unused background TVs do not pin old versions forever") { + // This will exceed the maximum active version count (5) if any + // transactions are being pinned, resulting in make_remote_change() throwing + for (int i = 0; i < 10; ++i) { + REQUIRE_NOTHROW(make_remote_change()); + advance_and_notify(*r); + } + } } diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/thread_safe_reference.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/thread_safe_reference.cpp index 507b91e34..2594e3a12 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/thread_safe_reference.cpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/thread_safe_reference.cpp @@ -31,6 +31,7 @@ #include "util/scheduler.hpp" #include "impl/object_accessor_impl.hpp" +#include "impl/realm_coordinator.hpp" #include <realm/db.hpp> #include <realm/history.hpp> @@ -858,10 +859,19 @@ TEST_CASE("thread safe reference") { SECTION("lifetime") { SECTION("retains source realm") { // else version will become unpinned auto ref = ThreadSafeReference(foo); + foo = {}; r = nullptr; r = Realm::get_shared_realm(config); REQUIRE_NOTHROW(ref.resolve<Object>(r)); } + + SECTION("retains source RealmCoordinator") { + auto ref = ThreadSafeReference(foo); + auto coordinator = _impl::RealmCoordinator::get_existing_coordinator(config.path).get(); + foo = {}; + r = nullptr; + REQUIRE(coordinator == _impl::RealmCoordinator::get_existing_coordinator(config.path).get()); + } } SECTION("metadata") { diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp index b4f415f8e..8aa6fa3b7 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp @@ -142,7 +142,7 @@ struct SyncTestFile : TestFile { }; struct TestSyncManager { - TestSyncManager(std::string const& base_path="", realm::SyncManager::MetadataMode = realm::SyncManager::MetadataMode::NoEncryption); + TestSyncManager(std::string const& base_path="", realm::SyncManager::MetadataMode = realm::SyncManager::MetadataMode::NoMetadata); ~TestSyncManager(); static void configure(std::string const& base_path, realm::SyncManager::MetadataMode); }; diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh index 644778fbb..731053ba9 100755 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh @@ -6,11 +6,6 @@ sync=${1} deps_suffix="${2}" -nprocs=1 -if [ "$(uname)" = "Linux" ]; then - nprocs=$(grep -c ^processor /proc/cpuinfo) -fi - : ${OPENSSL_ROOT_DIR:=/usr/local} set -e @@ -30,7 +25,7 @@ if [ "${sync}" = "sync" ]; then cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_SERVER=1 -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}" fi -cmake ${cmake_flags} -DCMAKE_BUILD_TYPE=Coverage -DDEPENDENCIES_FILE="dependencies${deps_suffix}.list" .. -make VERBOSE=1 -j${nprocs} generate-coverage-cobertura +cmake ${cmake_flags} -G Ninja -DCMAKE_BUILD_TYPE=Coverage -DDEPENDENCIES_FILE="dependencies${deps_suffix}.list" .. +ninja -v generate-coverage-cobertura find $TMPDIR -name 'realm*' -exec rm -rf "{}" \+ || true diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm+Sync.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm+Sync.h index 42f161655..e459bfc52 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm+Sync.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm+Sync.h @@ -18,7 +18,7 @@ #import <Foundation/Foundation.h> -#import "RLMRealm.h" +#import <Realm/RLMRealm.h> @class RLMResults, RLMSyncSession; diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.h index 17595d142..f3a476b99 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.h @@ -17,7 +17,7 @@ //////////////////////////////////////////////////////////////////////////// #import <Foundation/Foundation.h> -#import "RLMConstants.h" +#import <Realm/RLMConstants.h> @class RLMRealmConfiguration, RLMRealm, RLMObject, RLMSchema, RLMMigration, RLMNotificationToken, RLMThreadSafeReference, RLMAsyncOpenTask; struct RLMRealmPrivileges; diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.mm b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.mm index f8eb3fe73..e25bbefc6 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.mm +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.mm @@ -450,7 +450,7 @@ REALM_NOINLINE static void translateSharedGroupOpenException(NSError **error) { } { - Realm::Config& config = configuration.config; + Realm::Config const& config = configuration.config; // try to reuse existing realm first if (cache || dynamic) { @@ -496,6 +496,11 @@ REALM_NOINLINE static void translateSharedGroupOpenException(NSError **error) { throw RLMException(@"Realm opened from incorrect dispatch queue."); } } + else { + // If the source config was read from a Realm it may already have a + // scheduler, and we don't want to reuse it. + config.scheduler = nullptr; + } realm->_realm = Realm::get_shared_realm(config); } catch (...) { diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration+Sync.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration+Sync.h index abd51bf59..a8392b20d 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration+Sync.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration+Sync.h @@ -18,7 +18,7 @@ #import <Realm/RLMRealmConfiguration.h> -#import "RLMSyncUtil.h" +#import <Realm/RLMSyncUtil.h> @class RLMSyncConfiguration; diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.h index 04eba7a5f..4689f4899 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.h @@ -79,13 +79,23 @@ typedef BOOL (^RLMShouldCompactOnLaunchBlock)(NSUInteger totalBytes, NSUInteger /// Whether to open the Realm in read-only mode. /// -/// This is required to be able to open Realm files which are not writeable or -/// are in a directory which is not writeable. This should only be used on files -/// which will not be modified by anyone while they are open, and not just to -/// get a read-only view of a file which may be written to by another thread or -/// process. Opening in read-only mode requires disabling Realm's reader/writer -/// coordination, so committing a write transaction from another process will -/// result in crashes. +/// For non-synchronized Realms, this is required to be able to open Realm +/// files which are not writeable or are in a directory which is not writeable. +/// This should only be used on files which will not be modified by anyone +/// while they are open, and not just to get a read-only view of a file which +/// may be written to by another thread or process. Opening in read-only mode +/// requires disabling Realm's reader/writer coordination, so committing a +/// write transaction from another process will result in crashes. +/// +/// Syncronized Realms must always be writeable (as otherwise no +/// synchronization could happen), and this instead merely disallows performing +/// write transactions on the Realm. In addition, it will skip some automatic +/// writes made to the Realm, such as to initialize the Realm's schema. Setting +/// `readOnly = YES` is not strictly required for Realms which the sync user +/// does not have write access to, but is highly recommended as it will improve +/// error reporting and catch some errors earlier. +/// +/// Realms using query-based sync cannot be opened in read-only mode. @property (nonatomic) BOOL readOnly; /// The current schema version. diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.mm b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.mm index 96ff08db4..aa6218966 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.mm +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.mm @@ -205,7 +205,14 @@ static void RLMNSStringToStdString(std::string &out, NSString *in) { } - (BOOL)readOnly { - return _config.immutable(); + return _config.immutable() || _config.read_only_alternative(); +} + +static bool isSync(realm::Realm::Config const& config) { +#if REALM_ENABLE_SYNC + return !!config.sync_config; +#endif + return false; } - (void)setReadOnly:(BOOL)readOnly { @@ -215,10 +222,15 @@ static void RLMNSStringToStdString(std::string &out, NSString *in) { } else if (self.shouldCompactOnLaunch) { @throw RLMException(@"Cannot set `readOnly` when `shouldCompactOnLaunch` is set."); } - _config.schema_mode = realm::SchemaMode::Immutable; +#if REALM_ENABLE_SYNC + if (_config.sync_config && _config.sync_config->is_partial) { + @throw RLMException(@"Read-only mode is not supported for query-based sync."); + } +#endif + _config.schema_mode = isSync(_config) ? realm::SchemaMode::ReadOnlyAlternative : realm::SchemaMode::Immutable; } else if (self.readOnly) { - _config.schema_mode = realm::SchemaMode::Automatic; + _config.schema_mode = isSync(_config) ? realm::SchemaMode::Additive : realm::SchemaMode::Automatic; } } @@ -300,7 +312,7 @@ static void RLMNSStringToStdString(std::string &out, NSString *in) { - (void)setShouldCompactOnLaunch:(RLMShouldCompactOnLaunchBlock)shouldCompactOnLaunch { if (shouldCompactOnLaunch) { - if (self.readOnly) { + if (_config.immutable()) { @throw RLMException(@"Cannot set `shouldCompactOnLaunch` when `readOnly` is set."); } _config.should_compact_on_launch_function = [=](size_t totalBytes, size_t usedBytes) { diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncCredentials.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncCredentials.h index 6c99ce596..deb28aade 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncCredentials.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncCredentials.h @@ -18,7 +18,7 @@ #import <Foundation/Foundation.h> -#import "RLMSyncUtil.h" +#import <Realm/RLMSyncUtil.h> NS_ASSUME_NONNULL_BEGIN diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncManager.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncManager.h index debb5d4a4..9637f771e 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncManager.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncManager.h @@ -18,7 +18,7 @@ #import <Foundation/Foundation.h> -#import "RLMSyncUtil.h" +#import <Realm/RLMSyncUtil.h> @class RLMSyncSession, RLMSyncTimeoutOptions; diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.h index 3b26184f5..cc66103d9 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.h @@ -18,7 +18,7 @@ #import <Foundation/Foundation.h> -#import "RLMRealm.h" +#import <Realm/RLMRealm.h> /** The current state of the session represented by a session object. diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.mm b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.mm index cddaade2f..f0a844be6 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.mm +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.mm @@ -231,6 +231,21 @@ static RLMSyncConnectionState convertConnectionState(SyncSession::ConnectionStat return nil; } +- (NSString *)description { + return [NSString stringWithFormat: + @"<RLMSyncSession: %p> {\n" + "\tstate = %d;\n" + "\tconnectionState = %d;\n" + "\trealmURL = %@;\n" + "\tuser = %@;\n" + "}", + (__bridge void *)self, + static_cast<int>(self.state), + static_cast<int>(self.connectionState), + self.realmURL, + self.parentUser.identity]; +} + @end // MARK: - Error action token diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncUser.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncUser.h index d871490f6..02e29e5ad 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncUser.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncUser.h @@ -18,9 +18,9 @@ #import <Foundation/Foundation.h> -#import "RLMRealmConfiguration.h" -#import "RLMSyncCredentials.h" -#import "RLMSyncPermission.h" +#import <Realm/RLMRealmConfiguration.h> +#import <Realm/RLMSyncCredentials.h> +#import <Realm/RLMSyncPermission.h> @class RLMSyncUser, RLMSyncUserInfo, RLMSyncCredentials, RLMSyncPermission, RLMSyncSession, RLMRealm, RLMSyncPermissionOffer; diff --git a/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist b/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist index 144ebe539..13fc0e414 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist +++ b/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist @@ -17,11 +17,11 @@ <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> - <string>5.0.3</string> + <string>5.3.3</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>5.0.3</string> + <string>5.3.3</string> <key>NSHumanReadableCopyright</key> <string>Copyright © 2014 Realm. All rights reserved.</string> <key>NSPrincipalClass</key> diff --git a/Carthage/Checkouts/realm-cocoa/Realm/Tests/KVOTests.mm b/Carthage/Checkouts/realm-cocoa/Realm/Tests/KVOTests.mm index 808c15331..887072761 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/Tests/KVOTests.mm +++ b/Carthage/Checkouts/realm-cocoa/Realm/Tests/KVOTests.mm @@ -233,6 +233,7 @@ public: XCTFail(@"%@", e.description); } XCTAssertEqual(0U, _notifications.count); + static_cast<void>(self); // Pre-12 versions of Xcode require the self variable but 12 doesn't use it } // record a single notification @@ -241,6 +242,7 @@ public: XCTAssertEqual(obj, _obj); XCTAssertEqualObjects(key, _keyPath); [_notifications addObject:changeDictionary.copy]; + static_cast<void>(self); // Pre-12 versions of Xcode require the self variable but 12 doesn't use it } // ensure that the observed object is updated for any changes made to the diff --git a/Carthage/Checkouts/realm-cocoa/Realm/Tests/MigrationTests.mm b/Carthage/Checkouts/realm-cocoa/Realm/Tests/MigrationTests.mm index d11d31388..9090f1f67 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/Tests/MigrationTests.mm +++ b/Carthage/Checkouts/realm-cocoa/Realm/Tests/MigrationTests.mm @@ -50,6 +50,7 @@ static void RLMAssertRealmSchemaMatchesTable(id self, RLMRealm *realm) { XCTAssertEqual(indexed, table->has_search_index(column)); } } + static_cast<void>(self); } @interface MigrationTestObject : RLMObject diff --git a/Carthage/Checkouts/realm-cocoa/Realm/Tests/RealmTests.mm b/Carthage/Checkouts/realm-cocoa/Realm/Tests/RealmTests.mm index 176e85fa1..0f5eea7cf 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/Tests/RealmTests.mm +++ b/Carthage/Checkouts/realm-cocoa/Realm/Tests/RealmTests.mm @@ -1621,6 +1621,27 @@ }); } +- (void)testReusingConfigOnMultipleQueues { + auto config = [RLMRealmConfiguration defaultConfiguration]; + auto q1 = dispatch_queue_create("queue 1", DISPATCH_QUEUE_SERIAL); + auto q2 = dispatch_queue_create("queue 2", DISPATCH_QUEUE_SERIAL); + + dispatch_sync(q1, ^{ + XCTAssertNoThrow([RLMRealm realmWithConfiguration:config queue:q1 error:nil]); + }); + dispatch_sync(q2, ^{ + XCTAssertNoThrow([RLMRealm realmWithConfiguration:config queue:q2 error:nil]); + }); +} + +- (void)testConfigurationFromExistingRealmOnNewThread { + auto r1 = [RLMRealm defaultRealm]; + [self dispatchAsyncAndWait:^{ + auto r2 = [RLMRealm realmWithConfiguration:r1.configuration error:nil]; + XCTAssertNoThrow([r2 refresh]); + }]; +} + #pragma mark - In-memory Realms - (void)testInMemoryRealm { diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift.podspec b/Carthage/Checkouts/realm-cocoa/RealmSwift.podspec index f8db6bd7c..c8a6b28dc 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift.podspec +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES' } - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '9.0' s.osx.deployment_target = '10.9' s.watchos.deployment_target = '2.0' s.tvos.deployment_target = '9.0' diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/List.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/List.swift index f7c4eb422..69056611b 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/List.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/List.swift @@ -527,11 +527,7 @@ extension List: RealmCollection { // MARK: - MutableCollection conformance, range replaceable collection emulation extension List: MutableCollection { -#if swift(>=4.1) public typealias SubSequence = Slice<List> -#else - public typealias SubSequence = RandomAccessSlice<List> -#endif /** Returns the objects at the given range (get), or replaces the objects at the @@ -598,7 +594,6 @@ extension List: MutableCollection { currentIndex += 1 } } - #if swift(>=4.1.50) /** Removes objects from the list at the given range. @@ -610,69 +605,6 @@ extension List: MutableCollection { remove(at: bounds.lowerBound) } } - #else - /** - Removes objects from the list at the given range. - - - warning: This method may only be called during a write transaction. - */ - public func removeSubrange(_ bounds: Range<Int>) { - removeSubrange(bounds.lowerBound..<bounds.upperBound) - } - - /// :nodoc: - public func removeSubrange(_ bounds: ClosedRange<Int>) { - removeSubrange(bounds.lowerBound...bounds.upperBound) - } - - /// :nodoc: - public func removeSubrange(_ bounds: CountableRange<Int>) { - for _ in bounds { - remove(at: bounds.lowerBound) - } - } - - /// :nodoc: - public func removeSubrange(_ bounds: CountableClosedRange<Int>) { - for _ in bounds { - remove(at: bounds.lowerBound) - } - } - - /// :nodoc: - public func removeSubrange(_ bounds: DefaultRandomAccessIndices<List>) { - removeSubrange(bounds.startIndex..<bounds.endIndex) - } - - /// :nodoc: - public func replaceSubrange<C: Collection>(_ subrange: ClosedRange<Int>, with newElements: C) - where C.Iterator.Element == Element { - removeSubrange(subrange) - insert(contentsOf: newElements, at: subrange.lowerBound) - } - - /// :nodoc: - public func replaceSubrange<C: Collection>(_ subrange: CountableRange<Int>, with newElements: C) - where C.Iterator.Element == Element { - removeSubrange(subrange) - insert(contentsOf: newElements, at: subrange.lowerBound) - } - - /// :nodoc: - public func replaceSubrange<C: Collection>(_ subrange: CountableClosedRange<Int>, with newElements: C) - where C.Iterator.Element == Element { - removeSubrange(subrange) - insert(contentsOf: newElements, at: subrange.lowerBound) - } - - - /// :nodoc: - public func replaceSubrange<C: Collection>(_ subrange: DefaultRandomAccessIndices<List>, with newElements: C) - where C.Iterator.Element == Element { - removeSubrange(subrange) - insert(contentsOf: newElements, at: subrange.startIndex) - } -#endif /// :nodoc: public func remove(atOffsets offsets: IndexSet) { for offset in offsets.reversed() { @@ -700,7 +632,6 @@ extension List: MutableCollection { // MARK: - Codable -#if swift(>=4.1) extension List: Decodable where Element: Decodable { public convenience init(from decoder: Decoder) throws { self.init() @@ -719,7 +650,6 @@ extension List: Encodable where Element: Encodable { } } } -#endif // MARK: - AssistedObjectiveCBridgeable diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Optional.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Optional.swift index ec0b571dd..3161591cb 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Optional.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Optional.swift @@ -65,7 +65,6 @@ public final class RealmOptional<Value: RealmOptionalType>: RLMOptionalBase { } } -#if swift(>=4.1) extension RealmOptional: Codable where Value: Codable { public convenience init(from decoder: Decoder) throws { self.init() @@ -79,7 +78,6 @@ extension RealmOptional: Codable where Value: Codable { try self.value.encode(to: encoder) } } -#endif internal protocol RealmOptionalProtocol { } extension RealmOptional: RealmOptionalProtocol { } diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmConfiguration.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmConfiguration.swift index 7db110a8e..d5b1589ea 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmConfiguration.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmConfiguration.swift @@ -20,14 +20,6 @@ import Foundation import Realm import Realm.Private -#if !swift(>=4.1) -fileprivate extension Sequence { - func compactMap<T>(_ fn: (Self.Iterator.Element) throws -> T?) rethrows -> [T] { - return try flatMap(fn) - } -} -#endif - extension Realm { /** A `Configuration` instance describes the different options used to create an instance of a Realm. @@ -160,11 +152,21 @@ extension Realm { /** Whether to open the Realm in read-only mode. - This is required to be able to open Realm files which are not writeable or are in a directory which is not - writeable. This should only be used on files which will not be modified by anyone while they are open, and not - just to get a read-only view of a file which may be written to by another thread or process. Opening in - read-only mode requires disabling Realm's reader/writer coordination, so committing a write transaction from - another process will result in crashes. + For non-synchronized Realms, this is required to be able to open Realm files which are not + writeable or are in a directory which is not writeable. This should only be used on files + which will not be modified by anyone while they are open, and not just to get a read-only + view of a file which may be written to by another thread or process. Opening in read-only + mode requires disabling Realm's reader/writer coordination, so committing a write + transaction from another process will result in crashes. + + Syncronized Realms must always be writeable (as otherwise no synchronization could happen), + and this instead merely disallows performing write transactions on the Realm. In addition, + it will skip some automatic writes made to the Realm, such as to initialize the Realm's + schema. Setting `readOnly = YES` is not strictly required for Realms which the sync user + does not have write access to, but is highly recommended as it will improve error reporting + and catch some errors earlier. + + Realms using query-based sync cannot be opened in read-only mode. */ public var readOnly: Bool = false diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Results.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Results.swift index 6827a2407..1e7f65687 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Results.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Results.swift @@ -413,7 +413,6 @@ extension Results: AssistedObjectiveCBridgeable { // MARK: - Codable -#if swift(>=4.1) extension Results: Encodable where Element: Encodable { public func encode(to encoder: Encoder) throws { var container = encoder.unkeyedContainer() @@ -422,4 +421,3 @@ extension Results: Encodable where Element: Encodable { } } } -#endif diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift index eb781c339..5c7c8bf77 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift @@ -107,7 +107,7 @@ class KVOTests: TestCase { block() obj.removeObserver(self, forKeyPath: key) - XCTAssert(changeDictionary != nil, "Did not get a notification", file: fileName, line: lineNumber) + XCTAssert(changeDictionary != nil, "Did not get a notification", file: (fileName), line: lineNumber) guard changeDictionary != nil else { return } let actualOld = changeDictionary![.oldKey]! as? T @@ -115,10 +115,10 @@ class KVOTests: TestCase { XCTAssert(old == actualOld, "Old value: expected \(String(describing: old)), got \(String(describing: actualOld))", - file: fileName, line: lineNumber) + file: (fileName), line: lineNumber) XCTAssert(new == actualNew, "New value: expected \(String(describing: new)), got \(String(describing: actualNew))", - file: fileName, line: lineNumber) + file: (fileName), line: lineNumber) changeDictionary = nil } @@ -128,15 +128,15 @@ class KVOTests: TestCase { let kvoOptions: NSKeyValueObservingOptions = [.old, .new] var gotNotification = false let observation = obj.observe(keyPath, options: kvoOptions) { _, change in - XCTAssertEqual(change.oldValue, old, file: fileName, line: lineNumber) - XCTAssertEqual(change.newValue, new, file: fileName, line: lineNumber) + XCTAssertEqual(change.oldValue, old, file: (fileName), line: lineNumber) + XCTAssertEqual(change.newValue, new, file: (fileName), line: lineNumber) gotNotification = true } block() observation.invalidate() - XCTAssertTrue(gotNotification, file: fileName, line: lineNumber) + XCTAssertTrue(gotNotification, file: (fileName), line: lineNumber) } func observeChange<T: Equatable>(_ obj: SwiftKVOObject, _ keyPath: KeyPath<SwiftKVOObject, T?>, _ old: T?, _ new: T?, @@ -145,14 +145,14 @@ class KVOTests: TestCase { var gotNotification = false let observation = obj.observe(keyPath, options: kvoOptions) { _, change in if let oldValue = change.oldValue { - XCTAssertEqual(oldValue, old, file: fileName, line: lineNumber) + XCTAssertEqual(oldValue, old, file: (fileName), line: lineNumber) } else { - XCTAssertNil(old, file: fileName, line: lineNumber) + XCTAssertNil(old, file: (fileName), line: lineNumber) } if let newValue = change.newValue { - XCTAssertEqual(newValue, new, file: fileName, line: lineNumber) + XCTAssertEqual(newValue, new, file: (fileName), line: lineNumber) } else { - XCTAssertNil(new, file: fileName, line: lineNumber) + XCTAssertNil(new, file: (fileName), line: lineNumber) } gotNotification = true } @@ -160,7 +160,7 @@ class KVOTests: TestCase { block() observation.invalidate() - XCTAssertTrue(gotNotification, file: fileName, line: lineNumber) + XCTAssertTrue(gotNotification, file: (fileName), line: lineNumber) } func observeListChange(_ obj: NSObject, _ key: String, _ kind: NSKeyValueChange, _ indexes: NSIndexSet = NSIndexSet(index: 0), @@ -168,15 +168,15 @@ class KVOTests: TestCase { obj.addObserver(self, forKeyPath: key, options: [.old, .new], context: nil) block() obj.removeObserver(self, forKeyPath: key) - XCTAssert(changeDictionary != nil, "Did not get a notification", file: fileName, line: lineNumber) + XCTAssert(changeDictionary != nil, "Did not get a notification", file: (fileName), line: lineNumber) guard changeDictionary != nil else { return } let actualKind = NSKeyValueChange(rawValue: (changeDictionary![NSKeyValueChangeKey.kindKey] as! NSNumber).uintValue)! let actualIndexes = changeDictionary![NSKeyValueChangeKey.indexesKey]! as! NSIndexSet - XCTAssert(actualKind == kind, "Change kind: expected \(kind), got \(actualKind)", file: fileName, + XCTAssert(actualKind == kind, "Change kind: expected \(kind), got \(actualKind)", file: (fileName), line: lineNumber) XCTAssert(actualIndexes.isEqual(indexes), "Changed indexes: expected \(indexes), got \(actualIndexes)", - file: fileName, line: lineNumber) + file: (fileName), line: lineNumber) changeDictionary = nil } diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift index c9e1a8d61..34af40866 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift @@ -19,14 +19,6 @@ import XCTest import RealmSwift -#if !swift(>=4.1) -extension Sequence { - func compactMap<ElementOfResult>(_ transform: (Self.Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] { - return try flatMap(transform) - } -} -#endif - class ListTests: TestCase { var str1: SwiftStringObject? var str2: SwiftStringObject? @@ -204,8 +196,8 @@ class ListTests: TestCase { assertEqual(str2, array[0]) assertEqual(str1, array[1]) - assertThrows(_ = array.insert(str2, at: 200)) - assertThrows(_ = array.insert(str2, at: -200)) + assertThrows(array.insert(str2, at: 200)) + assertThrows(array.insert(str2, at: -200)) } func testRemoveAtIndex() { diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift index c740d9ca5..2f36efe49 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift @@ -381,8 +381,8 @@ class PrimitiveListTests<O: ObjectFactory, V: ValueFactory>: PrimitiveListTestsB XCTAssertEqual(values[0], array[1]) XCTAssertEqual(values[2], array[2]) - assertThrows(_ = array.insert(values[0], at: 4)) - assertThrows(_ = array.insert(values[0], at: -1)) + assertThrows(array.insert(values[0], at: 4)) + assertThrows(array.insert(values[0], at: -1)) } func testRemove() { diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/RealmTests.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/RealmTests.swift index 908f2e97f..feb3da89a 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/RealmTests.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/RealmTests.swift @@ -315,7 +315,7 @@ class RealmTests: TestCase { func testAddSingleObject() { let realm = try! Realm() - assertThrows(_ = realm.add(SwiftObject())) + assertThrows(realm.add(SwiftObject())) XCTAssertEqual(0, realm.objects(SwiftObject.self).count) var defaultRealmObject: SwiftObject! try! realm.write { @@ -329,7 +329,7 @@ class RealmTests: TestCase { let testRealm = realmWithTestPath() try! testRealm.write { - self.assertThrows(_ = testRealm.add(defaultRealmObject)) + self.assertThrows(testRealm.add(defaultRealmObject)) } } @@ -348,13 +348,13 @@ class RealmTests: TestCase { let testRealm = realmWithTestPath() try! testRealm.write { - self.assertThrows(_ = testRealm.add(defaultRealmObject, update: .all)) + self.assertThrows(testRealm.add(defaultRealmObject, update: .all)) } } func testAddMultipleObjects() { let realm = try! Realm() - assertThrows(_ = realm.add([SwiftObject(), SwiftObject()])) + assertThrows(realm.add([SwiftObject(), SwiftObject()])) XCTAssertEqual(0, realm.objects(SwiftObject.self).count) try! realm.write { let objs = [SwiftObject(), SwiftObject()] @@ -365,7 +365,7 @@ class RealmTests: TestCase { let testRealm = realmWithTestPath() try! testRealm.write { - self.assertThrows(_ = testRealm.add(realm.objects(SwiftObject.self))) + self.assertThrows(testRealm.add(realm.objects(SwiftObject.self))) } } @@ -381,7 +381,7 @@ class RealmTests: TestCase { let testRealm = realmWithTestPath() try! testRealm.write { - self.assertThrows(_ = testRealm.add(realm.objects(SwiftPrimaryStringObject.self), update: .all)) + self.assertThrows(testRealm.add(realm.objects(SwiftPrimaryStringObject.self), update: .all)) } } @@ -390,24 +390,24 @@ class RealmTests: TestCase { func testDeleteSingleObject() { let realm = try! Realm() XCTAssertEqual(0, realm.objects(SwiftObject.self).count) - assertThrows(_ = realm.delete(SwiftObject())) + assertThrows(realm.delete(SwiftObject())) var defaultRealmObject: SwiftObject! try! realm.write { defaultRealmObject = SwiftObject() - self.assertThrows(_ = realm.delete(defaultRealmObject)) + self.assertThrows(realm.delete(defaultRealmObject)) XCTAssertEqual(0, realm.objects(SwiftObject.self).count) realm.add(defaultRealmObject) XCTAssertEqual(1, realm.objects(SwiftObject.self).count) realm.delete(defaultRealmObject) XCTAssertEqual(0, realm.objects(SwiftObject.self).count) } - assertThrows(_ = realm.delete(defaultRealmObject)) + assertThrows(realm.delete(defaultRealmObject)) XCTAssertEqual(0, realm.objects(SwiftObject.self).count) let testRealm = realmWithTestPath() - assertThrows(_ = testRealm.delete(defaultRealmObject)) + assertThrows(testRealm.delete(defaultRealmObject)) try! testRealm.write { - self.assertThrows(_ = testRealm.delete(defaultRealmObject)) + self.assertThrows(testRealm.delete(defaultRealmObject)) } } @@ -425,9 +425,9 @@ class RealmTests: TestCase { XCTAssertEqual(0, realm.objects(SwiftObject.self).count) let testRealm = realmWithTestPath() - assertThrows(_ = testRealm.delete(objs)) + assertThrows(testRealm.delete(objs)) try! testRealm.write { - self.assertThrows(_ = testRealm.delete(objs)) + self.assertThrows(testRealm.delete(objs)) } } diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/TestCase.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/TestCase.swift index e1aef2fd7..5d36fe318 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/TestCase.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/TestCase.swift @@ -104,13 +104,13 @@ class TestCase: RLMTestCaseBase { return } XCTFail("Objects expected to be equal, but weren't. First: \(String(describing: o1)), " - + "second: \(String(describing: o2))", file: fileName, line: lineNumber) + + "second: \(String(describing: o2))", file: (fileName), line: lineNumber) } /// Check whether two collections containing Realm objects are equal. func assertEqual<C: Collection>(_ c1: C, _ c2: C, fileName: StaticString = #file, lineNumber: UInt = #line) where C.Iterator.Element: Object { - XCTAssertEqual(c1.count, c2.count, "Collection counts were incorrect", file: fileName, line: lineNumber) + XCTAssertEqual(c1.count, c2.count, "Collection counts were incorrect", file: (fileName), line: lineNumber) for (o1, o2) in zip(c1, c2) { assertEqual(o1, o2, fileName: fileName, lineNumber: lineNumber) } @@ -119,14 +119,14 @@ class TestCase: RLMTestCaseBase { func assertEqual<T: Equatable>(_ expected: [T?], _ actual: [T?], file: StaticString = #file, line: UInt = #line) { if expected.count != actual.count { XCTFail("assertEqual failed: (\"\(expected)\") is not equal to (\"\(actual)\")", - file: file, line: line) + file: (file), line: line) return } - XCTAssertEqual(expected.count, actual.count, "Collection counts were incorrect", file: file, line: line) + XCTAssertEqual(expected.count, actual.count, "Collection counts were incorrect", file: (file), line: line) for (e, a) in zip(expected, actual) where e != a { XCTFail("assertEqual failed: (\"\(expected)\") is not equal to (\"\(actual)\")", - file: file, line: line) + file: (file), line: line) return } } @@ -155,7 +155,7 @@ class TestCase: RLMTestCaseBase { try block() } catch { XCTFail("Expected no error, but instead caught <\(error)>.", - file: fileName, line: lineNumber) + file: (fileName), line: lineNumber) } } @@ -165,12 +165,12 @@ class TestCase: RLMTestCaseBase { do { _ = try block() XCTFail("Expected to catch <\(expectedError)>, but no error was thrown.", - file: fileName, line: lineNumber) + file: (fileName), line: lineNumber) } catch let e as Realm.Error where e.code == expectedError { // Success! } catch { XCTFail("Expected to catch <\(expectedError)>, but instead caught <\(error)>.", - file: fileName, line: lineNumber) + file: (fileName), line: lineNumber) } } @@ -180,18 +180,18 @@ class TestCase: RLMTestCaseBase { do { _ = try block() XCTFail("Expected to catch <\(expectedError)>, but no error was thrown.", - file: fileName, line: lineNumber) + file: (fileName), line: lineNumber) } catch let e where e._code == expectedError._code { // Success! } catch { XCTFail("Expected to catch <\(expectedError)>, but instead caught <\(error)>.", - file: fileName, line: lineNumber) + file: (fileName), line: lineNumber) } } func assertNil<T>(block: @autoclosure() -> T?, _ message: String? = nil, fileName: StaticString = #file, lineNumber: UInt = #line) { - XCTAssert(block() == nil, message ?? "", file: fileName, line: lineNumber) + XCTAssert(block() == nil, message ?? "", file: (fileName), line: lineNumber) } func assertMatches(_ block: @autoclosure () -> String, _ regexString: String, _ message: String? = nil, diff --git a/Carthage/Checkouts/realm-cocoa/build.sh b/Carthage/Checkouts/realm-cocoa/build.sh index b6df3c7b8..1decac82b 100755 --- a/Carthage/Checkouts/realm-cocoa/build.sh +++ b/Carthage/Checkouts/realm-cocoa/build.sh @@ -557,11 +557,6 @@ case "$COMMAND" in ;; "catalyst") - if (( $(xcode_version_major) < 11 )); then - echo 'Building for Catalyst requires Xcode 11' - exit 1 - fi - xc "-scheme Realm -configuration $CONFIGURATION \ REALM_CATALYST_FLAGS='-target x86_64-apple-ios13.0-macabi' \ REALM_PLATFORM_SUFFIX='maccatalyst' \ @@ -570,11 +565,6 @@ case "$COMMAND" in ;; "catalyst-swift") - if (( $(xcode_version_major) < 11 )); then - echo 'Building for Catalyst requires Xcode 11' - exit 1 - fi - sh build.sh catalyst # FIXME: change this to just "-destination variant='Mac Catalyst'" once the CI machines are running 10.15 xc "-scheme 'RealmSwift' -configuration $CONFIGURATION build \ @@ -590,11 +580,6 @@ case "$COMMAND" in ;; "xcframework") - if (( $(xcode_version_major) < 11 )); then - echo 'Building a xcframework requires Xcode 11' - exit 1 - fi - export REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS BUILD_LIBRARY_FOR_DISTRIBUTION=YES REALM_OBJC_MACH_O_TYPE=staticlib" # Build all of the requested frameworks @@ -760,10 +745,8 @@ case "$COMMAND" in sh build.sh test-tvos-devices || failed=1 sh build.sh test-osx || failed=1 sh build.sh test-osx-swift || failed=1 - if (( $(xcode_version_major) >= 11 )); then - sh build.sh test-catalyst || failed=1 - sh build.sh test-catalyst-swift || failed=1 - fi + sh build.sh test-catalyst || failed=1 + sh build.sh test-catalyst-swift || failed=1 exit $failed ;; @@ -902,10 +885,8 @@ case "$COMMAND" in sh build.sh verify-swiftlint sh build.sh verify-swiftpm sh build.sh verify-osx-object-server - if (( $(xcode_version_major) >= 11 )); then - sh build.sh verify-catalyst - sh build.sh verify-catalyst-swift - fi + sh build.sh verify-catalyst + sh build.sh verify-catalyst-swift ;; "verify-cocoapods") @@ -1221,16 +1202,6 @@ case "$COMMAND" in # CocoaPods ###################################### "cocoapods-setup") - if [ ! -d core ]; then - sh build.sh download-sync - rm core - mv sync-* core - mv core/librealm-ios.a core/librealmcore-ios.a - mv core/librealm-macosx.a core/librealmcore-macosx.a - mv core/librealm-tvos.a core/librealmcore-tvos.a - mv core/librealm-watchos.a core/librealmcore-watchos.a - fi - if [[ "$2" != "swift" ]]; then if [ ! -d Realm/ObjectStore/src ]; then cat >&2 <<EOM @@ -1246,6 +1217,16 @@ EOM exit 1 fi + if [ ! -d core ]; then + sh build.sh download-sync + rm core + mv sync-* core + mv core/librealm-ios.a core/librealmcore-ios.a + mv core/librealm-macosx.a core/librealmcore-macosx.a + mv core/librealm-tvos.a core/librealmcore-tvos.a + mv core/librealm-watchos.a core/librealmcore-watchos.a + fi + rm -rf include mkdir -p include mv core/include include/core @@ -1407,11 +1388,7 @@ EOM set_xcode_and_swift_versions - if [[ "$PLATFORM" = "catalyst" ]] && (( $(xcode_version_major) < 11 )); then - mkdir -p build/catalyst/swift-$REALM_XCODE_VERSION - else - sh build.sh $PLATFORM-swift - fi + sh build.sh $PLATFORM-swift cd build/$PLATFORM zip --symlinks -r realm-framework-$PLATFORM-$REALM_XCODE_VERSION.zip swift-$REALM_XCODE_VERSION @@ -1567,7 +1544,7 @@ x.y.z Release notes (yyyy-MM-dd) * Realm Object Server: 3.21.0 or later. * Realm Studio: 3.11 or later. * APIs are backwards compatible with all previous releases in the 5.x.y series. -* Carthage release for Swift is built with Xcode 11.5. +* Carthage release for Swift is built with Xcode 11.6. ### Internal * Upgraded realm-core from ? to ? diff --git a/Carthage/Checkouts/realm-cocoa/dependencies.list b/Carthage/Checkouts/realm-cocoa/dependencies.list index a73995ce3..f8d416371 100644 --- a/Carthage/Checkouts/realm-cocoa/dependencies.list +++ b/Carthage/Checkouts/realm-cocoa/dependencies.list @@ -1,4 +1,4 @@ -VERSION=5.0.3 -REALM_CORE_VERSION=6.0.6 -REALM_SYNC_VERSION=5.0.5 +VERSION=5.3.3 +REALM_CORE_VERSION=6.0.14 +REALM_SYNC_VERSION=5.0.14 REALM_OBJECT_SERVER_VERSION=3.28.5 diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/build.sh b/Carthage/Checkouts/realm-cocoa/examples/installation/build.sh index 88363d502..10de66d68 100755 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/build.sh +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/build.sh @@ -40,9 +40,6 @@ command: test-watchos-swift-xcframework: tests watchOS Swift xcframework example. test-watchos-swift-cocoapods: tests watchOS Swift CocoaPods example. test-watchos-swift-carthage: tests watchOS Swift Carthage example. - test-watchos-spm: tests watchOS Swift Package Manager example. - - test-tvos-spm: tests tvOS Swift Package Manager example. EOF } @@ -167,11 +164,9 @@ case "$COMMAND" in for target in ios-swift-dynamic ios-swift-cocoapods osx-swift-dynamic ios-swift-carthage osx-swift-carthage; do ./build.sh test-$target || exit 1 done - if (( $(xcode_version_major) >= 11 )); then - for target in ios osx watchos tvos; do - ./build.sh test-$target-spm || exit 1 - done - fi + for target in ios osx; do + ./build.sh test-$target-spm || exit 1 + done ;; test-*-*-cocoapods) @@ -199,6 +194,13 @@ case "$COMMAND" in ;; test-ios-spm) + # We have to "hide" the spm example from carthage because otherwise + # it'll fetch the example's package dependencies as part of deciding + # what to build from this repo. + if ! [ -L ios/swift/SwiftPackageManagerExample/SwiftPackageManagerExample.xcodeproj/project.pbxproj ]; then + mkdir -p ios/swift/SwiftPackageManagerExample/SwiftPackageManagerExample.xcodeproj + ln -s ../project.pbxproj ios/swift/SwiftPackageManagerExample/SwiftPackageManagerExample.xcodeproj + fi xctest "$PLATFORM" swift SwiftPackageManagerExample ;; diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/objc/CocoaPodsDynamicExample/Podfile b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/objc/CocoaPodsDynamicExample/Podfile index abf7004d6..1aa26a234 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/objc/CocoaPodsDynamicExample/Podfile +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/objc/CocoaPodsDynamicExample/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '6.0' +platform :ios, '9.0' use_frameworks! branch = ENV['sha'] diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/objc/CocoaPodsExample/Podfile b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/objc/CocoaPodsExample/Podfile index f926386c5..1ddbc34b7 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/objc/CocoaPodsExample/Podfile +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/objc/CocoaPodsExample/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '6.0' +platform :ios, '9.0' branch = ENV['sha'] diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/Podfile b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/Podfile index 12754e16f..dd6ebed8e 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/Podfile +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '6.0' +platform :ios, '9.0' branch = ENV['sha'] diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/objc/Podfile b/Carthage/Checkouts/realm-cocoa/examples/ios/objc/Podfile index ccccb1779..27c48fbfb 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/objc/Podfile +++ b/Carthage/Checkouts/realm-cocoa/examples/ios/objc/Podfile @@ -1,4 +1,4 @@ -platform :ios, '7.0' +platform :ios, '9.0' target 'RACTableView' do pod 'ReactiveCocoa', :inhibit_warnings => true diff --git a/Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb b/Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb index 09a87d08b..d383a2a5f 100755 --- a/Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb +++ b/Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb @@ -41,7 +41,7 @@ base_examples = [ "examples/tvos/swift", ] -xcode_versions = %w(10.3 11.1 11.2.1 11.3 11.4.1 11.5) +xcode_versions = %w(11.3 11.4.1 11.5 11.6) # Remove reference to Realm.xcodeproj from all example workspaces. base_examples.each do |example| diff --git a/Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb b/Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb index 542ded533..5641d9221 100755 --- a/Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb +++ b/Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb @@ -141,9 +141,11 @@ begin end end - # Error code 161-163 indicate that the given device is not supported by the runtime, such as the iPad 2 and - # iPhone 4s not being supported by the iOS 10 simulator runtime. - next if output =~ /(domain=com.apple.CoreSimulator.SimError, code=16[123])/ + # Not all runtime and device pairs are valid as newer simulator runtimes + # don't support older devices. The exact error code for this changes + # every few versions of Xcode, so this just lists all the ones we've + # seen. + next if /domain=com.apple.CoreSimulator.SimError, code=(?<code>\d+)/ =~ output and [161, 162, 163, 403].include? code.to_i puts "Failed to create device of type #{device_type['identifier']} with runtime #{runtime['identifier']}:" output.each_line do |line| |