Browse Source

roll-back library realm

marinofaggiana 5 years ago
parent
commit
9b5e64c2d0
65 changed files with 866 additions and 894 deletions
  1. 1 1
      Cartfile
  2. 1 1
      Cartfile.resolved
  3. 200 265
      Carthage/Checkouts/realm-cocoa/.jenkins.yml
  4. 0 5
      Carthage/Checkouts/realm-cocoa/.swiftlint.yml
  5. 0 46
      Carthage/Checkouts/realm-cocoa/CHANGELOG.md
  6. 1 3
      Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig
  7. 3 5
      Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm.xcconfig
  8. 43 64
      Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability
  9. 81 54
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake
  10. 0 3
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/Sanitizers.cmake
  11. 3 3
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Dockerfile
  12. 6 6
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Jenkinsfile
  13. 2 2
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list
  14. 3 2
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/CMakeLists.txt
  15. 4 4
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/apple/external_commit_helper.cpp
  16. 1 1
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/epoll/external_commit_helper.cpp
  17. 3 4
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.cpp
  18. 1 1
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.hpp
  19. 1 2
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/shared_realm.cpp
  20. 0 9
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/realm.cpp
  21. 6 16
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.cpp
  22. 3 13
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp
  23. 2 5
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/build.sh
  24. 1 9
      Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh
  25. 5 8
      Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.h
  26. 6 22
      Carthage/Checkouts/realm-cocoa/Realm/RLMPlatform.h.in
  27. 0 1
      Carthage/Checkouts/realm-cocoa/Realm/RLMSyncConfiguration.mm
  28. 2 2
      Carthage/Checkouts/realm-cocoa/Realm/RLMSyncCredentials.h
  29. 2 2
      Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist
  30. 28 0
      Carthage/Checkouts/realm-cocoa/RealmSwift/RealmCollection.swift
  31. 6 0
      Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift
  32. 9 1
      Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift
  33. 2 2
      Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/MigrationTests.swift
  34. 1 1
      Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ObjectTests.swift
  35. 174 1
      Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift
  36. 209 259
      Carthage/Checkouts/realm-cocoa/build.sh
  37. 3 3
      Carthage/Checkouts/realm-cocoa/dependencies.list
  38. 1 13
      Carthage/Checkouts/realm-cocoa/examples/installation/build.sh
  39. 2 2
      Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/AppDelegate.swift
  40. 1 0
      Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/ViewController.swift
  41. 2 2
      Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/AppDelegate.swift
  42. 1 0
      Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/ViewController.swift
  43. 2 2
      Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/AppDelegate.swift
  44. 1 0
      Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/ViewController.swift
  45. 1 0
      Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/AppDelegate.swift
  46. 1 0
      Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/ViewController.swift
  47. 1 0
      Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/AppDelegate.swift
  48. 1 0
      Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/ViewController.swift
  49. 1 1
      Carthage/Checkouts/realm-cocoa/examples/ios/swift/Backlink/AppDelegate.swift
  50. 1 1
      Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/AppDelegate.swift
  51. 1 1
      Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/ViewController.swift
  52. 1 1
      Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/AppDelegate.swift
  53. 1 1
      Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/TableViewController.swift
  54. 2 2
      Carthage/Checkouts/realm-cocoa/examples/ios/swift/Migration/AppDelegate.swift
  55. 1 1
      Carthage/Checkouts/realm-cocoa/examples/ios/swift/Simple/AppDelegate.swift
  56. 1 1
      Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/AppDelegate.swift
  57. 3 0
      Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/TableViewController.swift
  58. 2 2
      Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/AppDelegate.swift
  59. 5 5
      Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/RepositoriesViewController.swift
  60. 2 2
      Carthage/Checkouts/realm-cocoa/examples/tvos/swift/PreloadedData/AppDelegate.swift
  61. 5 3
      Carthage/Checkouts/realm-cocoa/scripts/generate-rlmplatform.sh
  62. 1 1
      Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb
  63. 8 23
      Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb
  64. 2 2
      iOSClient/BrowserWeb/NCBrowserWeb.storyboard
  65. 2 2
      iOSClient/Login/CCLogin.storyboard

+ 1 - 1
Cartfile

@@ -7,7 +7,7 @@ github "ealeksandrov/EAIntroView" == 2.12.0
 github "calimarkus/JDStatusBarNotification" == 1.6.0
 github "ChangbaDevs/KTVHTTPCache" == 2.0.1
 github "jdg/MBProgressHUD" == 1.1.0
-github "realm/realm-cocoa"
+github "realm/realm-cocoa" == 3.17.3
 github "SVGKit/SVGKit" "3.x"
 github "WeTransfer/WeScan" == 1.1.0
 github "malcommac/SwiftRichString"

+ 1 - 1
Cartfile.resolved

@@ -16,7 +16,7 @@ github "krzyzanowskim/OpenSSL" "1.0.219"
 github "malcommac/SwiftRichString" "3.0.2"
 github "marinofaggiana/AFNetworking" "2967678c3e0e98c9b8d7e06222ad12d1f49c26f2"
 github "marinofaggiana/FastScroll" "81967c2309d29bc2c330d422da612160a30bade8"
-github "realm/realm-cocoa" "v3.18.0"
+github "realm/realm-cocoa" "v3.17.3"
 github "rechsteiner/Parchment" "v1.6.0"
 github "tilltue/TLPhotoPicker" "2.0.1"
 github "weichsel/ZIPFoundation" "0.9.9"

+ 200 - 265
Carthage/Checkouts/realm-cocoa/.jenkins.yml

@@ -1,373 +1,308 @@
-
 # Yaml Axis Plugin
 # https://wiki.jenkins-ci.org/display/JENKINS/Yaml+Axis+Plugin
-# This is a generated file produced by scripts/pr-ci-matrix.rb.
 
-xcode_version: 
- - 10.0
- - 10.1
- - 10.2.1
- - 10.3
- - 11.0
-target: 
- - docs
- - swiftlint
- - osx
- - osx-encryption
- - osx-object-server
- - ios-static
- - ios-dynamic
- - watchos
- - tvos
- - ios-swift
- - osx-swift
- - tvos-swift
- - cocoapods-osx
- - cocoapods-ios
- - cocoapods-watchos
- - swiftpm
-configuration: 
- - Debug
- - Release
+xcode_version:
+  - 9.4
+  - 10.0
+  - 10.1
+  - 10.2.1
+  - 10.3
+target:
+  - osx
+  - docs
+  - ios-static
+  - ios-dynamic
+  - ios-swift
+  - osx-swift
+  - watchos
+  - cocoapods-ios
+  - cocoapods-osx
+  - cocoapods-watchos
+  - swiftlint
+  - tvos
+  - osx-encryption
+  - osx-object-server
+  - swiftpm
+
+  # These are disabled because the machinen with the devices attached is currently offline
+  # - ios-device-objc-ios8
+  # - ios-device-objc-ios10
+  # - tvos-device
+  # These are disabled because they were very unreliable on CI
+  # - ios-device-swift-ios8
+  # - ios-device-swift-ios10
+configuration:
+  - Debug
+  - Release
+
+# Combinations have to be excluded in a way that's hard to read.
+# This table shows which jobs will run:
+
+# +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+# | Configuration Matrix | osx | docs | ios-static | ios-dynamic | ios-swift | osx-swift | watchos | cocoapods-ios | cocoapods-osx | cocoapods-watchos | swiftlint | swiftpm | tvos | osx-encryption | osx-object-server | ios-device-objc-ios8 | ios-device-swift-ios8 | ios-device-objc-ios10 | ios-device-swift-ios10 | tvos-device |
+# | -------------------- | --- | ---- | ---------- | ----------- | --------- | --------- | ------- | ------------- | ------------- | ----------------- | --------- | ------- | ---- | -------------- | ----------------- | -------------------- | --------------------- | --------------------- | ---------------------- | ----------- |
+# | 9.4   | Debug        | X   |      | X          |             |           |           |         |               |               |                   |           |         |      |                |                   |                      |                       |                       |                        |             |
+# | 9.4   | Release      | X   |      | X          | X           | X         | X         | X       | X             | X             | X                 |           |         | X    | X              | X                 | X                    |                       | X                     |                        |             |
+# | -------------------- | --- | ---- | ---------- | ----------- | --------- | --------- | ------- | ------------- | ------------- | ----------------- | --------- | ------- | ---- | -------------- | ----------------- | -------------------- | --------------------- | --------------------- | ---------------------- | ----------- |
+# | 10.0  | Debug        | X   |      |            |             |           |           |         |               |               |                   |           |         |      |                |                   |                      |                       |                       |                        |             |
+# | 10.0  | Release      | X   |      | X          | X           | X         | X         | X       | X             | X             | X                 |           |         | X    |                |                   |                      |                       |                       |                        |             |
+# | -------------------- | --- | ---- | ---------- | ----------- | --------- | --------- | ------- | ------------- | ------------- | ----------------- | --------- | ------- | ---- | -------------- | ----------------- | -------------------- | --------------------- | --------------------- | ---------------------- | ----------- |
+# | 10.1  | Debug        | X   |      |            |             |           |           |         |               |               |                   |           |         |      |                |                   |                      |                       |                       |                        |             |
+# | 10.1  | Release      | X   |      | X          | X           | X         | X         | X       | X             | X             | X                 |           |         | X    |                |                   |                      |                       |                       |                        |             |
+# | -------------------- | --- | ---- | ---------- | ----------- | --------- | --------- | ------- | ------------- | ------------- | ----------------- | --------- | ------- | ---- | -------------- | ----------------- | -------------------- | --------------------- | --------------------- | ---------------------- | ----------- |
+# | 10.2.1| Debug        | X   |      |            |             |           |           |         |               |               |                   |           |         |      |                |                   |                      |                       |                       |                        |             |
+# | 10.2.1| Release      | X   |      | X          | X           | X         | X         | X       | X             | X             | X                 |           |         | X    |                |                   |                      |                       |                       |                        |             |
+# | -------------------- | --- | ---- | ---------- | ----------- | --------- | --------- | ------- | ------------- | ------------- | ----------------- | --------- | ------- | ---- | -------------- | ----------------- | -------------------- | --------------------- | --------------------- | ---------------------- | ----------- |
+# | 10.3  | Debug        | X   |      |            | X           | X         | X         | X       |               |               |                   |           |         | X    |                |                   |                      |                       |                       |                        |             |
+# | 10.3  | Release      | X   | X    | X          | X           | X         | X         | X       | X             | X             | X                 | X         | X       | X    | X              | X                 |                      |                       | X                     |                        | X           |
+# +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 
 exclude:
-
-  - xcode_version: 10.0
+  ################
+  # docs
+  ################
+  # Just run on 10.4 Release
+  - xcode_version: 9.4
     target: docs
-    configuration: Debug
-
   - xcode_version: 10.0
     target: docs
-    configuration: Release
-
   - xcode_version: 10.1
     target: docs
-    configuration: Debug
-
-  - xcode_version: 10.1
-    target: docs
-    configuration: Release
-
-  - xcode_version: 10.2.1
-    target: docs
-    configuration: Debug
-
   - xcode_version: 10.2.1
     target: docs
-    configuration: Release
-
-  - xcode_version: 10.3
-    target: docs
-    configuration: Debug
-
-  - xcode_version: 10.3
-    target: docs
-    configuration: Release
-
-  - xcode_version: 11.0
-    target: docs
+  - target: docs
     configuration: Debug
 
+  ################
+  # ios-static
+  ################
+  # Skip Debug on everything but 9.4
   - xcode_version: 10.0
-    target: swiftlint
+    target: ios-static
     configuration: Debug
-
-  - xcode_version: 10.0
-    target: swiftlint
-    configuration: Release
-
   - xcode_version: 10.1
-    target: swiftlint
+    target: ios-static
     configuration: Debug
-
-  - xcode_version: 10.1
-    target: swiftlint
-    configuration: Release
-
   - xcode_version: 10.2.1
-    target: swiftlint
+    target: ios-static
     configuration: Debug
-
-  - xcode_version: 10.2.1
-    target: swiftlint
-    configuration: Release
-
   - xcode_version: 10.3
-    target: swiftlint
+    target: ios-static
     configuration: Debug
 
-  - xcode_version: 10.3
-    target: swiftlint
-    configuration: Release
-
-  - xcode_version: 11.0
-    target: swiftlint
+  ################
+  # ios-dynamic
+  ################
+  # Skip Debug on everything but 10.3
+  - xcode_version: 9.4
+    target: ios-dynamic
     configuration: Debug
-
   - xcode_version: 10.0
-    target: osx-encryption
-    configuration: Debug
-
-  - xcode_version: 10.1
-    target: osx-encryption
+    target: ios-dynamic
     configuration: Debug
-
   - xcode_version: 10.1
-    target: osx-encryption
-    configuration: Release
-
-  - xcode_version: 10.2.1
-    target: osx-encryption
+    target: ios-dynamic
     configuration: Debug
-
   - xcode_version: 10.2.1
-    target: osx-encryption
-    configuration: Release
-
-  - xcode_version: 10.3
-    target: osx-encryption
+    target: ios-dynamic
     configuration: Debug
 
-  - xcode_version: 10.3
-    target: osx-encryption
-    configuration: Release
-
-  - xcode_version: 11.0
-    target: osx-encryption
+  ################
+  # ios-swift
+  ################
+  # Skip Debug on everything but 10.3
+  - xcode_version: 9.4
+    target: ios-swift
     configuration: Debug
-
   - xcode_version: 10.0
-    target: osx-object-server
-    configuration: Debug
-
-  - xcode_version: 10.1
-    target: osx-object-server
+    target: ios-swift
     configuration: Debug
-
   - xcode_version: 10.1
-    target: osx-object-server
-    configuration: Release
-
-  - xcode_version: 10.2.1
-    target: osx-object-server
+    target: ios-swift
     configuration: Debug
-
   - xcode_version: 10.2.1
-    target: osx-object-server
-    configuration: Release
-
-  - xcode_version: 10.3
-    target: osx-object-server
+    target: ios-swift
     configuration: Debug
 
-  - xcode_version: 10.3
-    target: osx-object-server
-    configuration: Release
-
-  - xcode_version: 11.0
-    target: osx-object-server
+  ################
+  # osx-swift
+  ################
+  # Skip Debug on everything but 10.3
+  - xcode_version: 9.4
+    target: osx-swift
     configuration: Debug
-
   - xcode_version: 10.0
-    target: ios-static
+    target: osx-swift
     configuration: Debug
-
   - xcode_version: 10.1
-    target: ios-static
+    target: osx-swift
     configuration: Debug
-
   - xcode_version: 10.2.1
-    target: ios-static
+    target: osx-swift
     configuration: Debug
 
-  - xcode_version: 10.3
-    target: ios-static
+  ################
+  # watchos
+  ################
+  # Skip Debug on everything but 10.3
+  - xcode_version: 9.4
+    target: watchos
     configuration: Debug
-
   - xcode_version: 10.0
-    target: ios-dynamic
+    target: watchos
     configuration: Debug
-
   - xcode_version: 10.1
-    target: ios-dynamic
+    target: watchos
     configuration: Debug
-
   - xcode_version: 10.2.1
-    target: ios-dynamic
+    target: watchos
     configuration: Debug
 
-  - xcode_version: 10.3
-    target: ios-dynamic
+  ################
+  # cocoapods
+  ################
+  # Skip Debug
+  - target: cocoapods-ios
     configuration: Debug
-
-  - xcode_version: 10.0
-    target: watchos
+  - target: cocoapods-osx
     configuration: Debug
-
-  - xcode_version: 10.1
-    target: watchos
+  - target: cocoapods-watchos
     configuration: Debug
 
+  ################
+  # swiftlint
+  ################
+  # Just run on 10.3 Release
+  - xcode_version: 9.4
+    target: swiftlint
+  - xcode_version: 10.0
+    target: swiftlint
+  - xcode_version: 10.1
+    target: swiftlint
   - xcode_version: 10.2.1
-    target: watchos
+    target: swiftlint
+  - target: swiftlint
     configuration: Debug
 
-  - xcode_version: 10.3
-    target: watchos
+  ################
+  # swiftpm
+  ################
+  # Just run on 10.2/10.3 Release
+  - xcode_version: 9.4
+    target: swiftpm
+  - xcode_version: 10.0
+    target: swiftpm
+  - xcode_version: 10.1
+    target: swiftpm
+  - target: swiftpm
     configuration: Debug
 
+  ################
+  # tvos
+  ################
+  # Skip Debug on everything but 10.3
+  - xcode_version: 9.4
+    target: tvos
+    configuration: Debug
   - xcode_version: 10.0
     target: tvos
     configuration: Debug
-
   - xcode_version: 10.1
     target: tvos
     configuration: Debug
-
   - xcode_version: 10.2.1
     target: tvos
     configuration: Debug
 
-  - xcode_version: 10.3
-    target: tvos
-    configuration: Debug
-
+  ################
+  # osx-encryption
+  ################
+  # Just run on 9.4/10.3 Release
   - xcode_version: 10.0
-    target: ios-swift
-    configuration: Debug
-
+    target: osx-encryption
   - xcode_version: 10.1
-    target: ios-swift
-    configuration: Debug
-
+    target: osx-encryption
   - xcode_version: 10.2.1
-    target: ios-swift
-    configuration: Debug
-
-  - xcode_version: 10.3
-    target: ios-swift
+    target: osx-encryption
+  - target: osx-encryption
     configuration: Debug
 
+  ################
+  # osx-object-server
+  ################
+  # Just run on 9.4/10.3 Release
   - xcode_version: 10.0
-    target: osx-swift
-    configuration: Debug
-
+    target: osx-object-server
   - xcode_version: 10.1
-    target: osx-swift
-    configuration: Debug
-
+    target: osx-object-server
   - xcode_version: 10.2.1
-    target: osx-swift
-    configuration: Debug
-
-  - xcode_version: 10.3
-    target: osx-swift
+    target: osx-object-server
+  - target: osx-object-server
     configuration: Debug
 
+  ################
+  # ios-device-objc-ios8
+  ################
+  # Just run on 9.4/10.3 Release
   - xcode_version: 10.0
-    target: tvos-swift
-    configuration: Debug
-
+    target: ios-device-objc-ios8
   - xcode_version: 10.1
-    target: tvos-swift
-    configuration: Debug
-
+    target: ios-device-objc-ios8
   - xcode_version: 10.2.1
-    target: tvos-swift
-    configuration: Debug
-
-  - xcode_version: 10.3
-    target: tvos-swift
+    target: ios-device-objc-ios8
+  - target: ios-device-objc-ios8
     configuration: Debug
 
+  ################
+  # ios-device-swift-ios8
+  ################
+  # Just run on 9.4/10.3 Release
   - xcode_version: 10.0
-    target: cocoapods-osx
-    configuration: Debug
-
+    target: ios-device-swift-ios8
   - xcode_version: 10.1
-    target: cocoapods-osx
-    configuration: Debug
-
+    target: ios-device-swift-ios8
   - xcode_version: 10.2.1
-    target: cocoapods-osx
-    configuration: Debug
-
-  - xcode_version: 10.3
-    target: cocoapods-osx
-    configuration: Debug
-
-  - xcode_version: 11.0
-    target: cocoapods-osx
+    target: ios-device-swift-ios8
+  - target: ios-device-swift-ios8
     configuration: Debug
 
+  ################
+  # ios-device-objc-ios10
+  ################
+  # Just run on 9.3/10.3 Release
   - xcode_version: 10.0
-    target: cocoapods-ios
-    configuration: Debug
-
+    target: ios-device-objc-ios10
   - xcode_version: 10.1
-    target: cocoapods-ios
-    configuration: Debug
-
+    target: ios-device-objc-ios10
   - xcode_version: 10.2.1
-    target: cocoapods-ios
-    configuration: Debug
-
-  - xcode_version: 10.3
-    target: cocoapods-ios
-    configuration: Debug
-
-  - xcode_version: 11.0
-    target: cocoapods-ios
+    target: ios-device-objc-ios10
+  - target: ios-device-objc-ios10
     configuration: Debug
 
+  ################
+  # ios-device-swift-ios10
+  ################
+  # Just run on 9.4/10.3 Release
   - xcode_version: 10.0
-    target: cocoapods-watchos
-    configuration: Debug
-
+    target: ios-device-swift-ios10
   - xcode_version: 10.1
-    target: cocoapods-watchos
-    configuration: Debug
-
+    target: ios-device-swift-ios10
   - xcode_version: 10.2.1
-    target: cocoapods-watchos
-    configuration: Debug
-
-  - xcode_version: 10.3
-    target: cocoapods-watchos
-    configuration: Debug
-
-  - xcode_version: 11.0
-    target: cocoapods-watchos
+    target: ios-device-swift-ios10
+  - target: ios-device-swift-ios10
     configuration: Debug
 
+  ################
+  # tvos-device
+  ################
+  # Just run on 10.2 Release
+  - xcode_version: 9.4
+    target: tvos-device
   - xcode_version: 10.0
-    target: swiftpm
-    configuration: Debug
-
-  - xcode_version: 10.0
-    target: swiftpm
-    configuration: Release
-
+    target: tvos-device
   - xcode_version: 10.1
-    target: swiftpm
-    configuration: Debug
-
-  - xcode_version: 10.1
-    target: swiftpm
-    configuration: Release
-
-  - xcode_version: 10.2.1
-    target: swiftpm
-    configuration: Debug
-
+    target: tvos-device
   - xcode_version: 10.2.1
-    target: swiftpm
-    configuration: Release
-
-  - xcode_version: 10.3
-    target: swiftpm
-    configuration: Debug
-
-  - xcode_version: 11.0
-    target: swiftpm
+    target: tvos-device
+  - target: tvos-device
     configuration: Debug

+ 0 - 5
Carthage/Checkouts/realm-cocoa/.swiftlint.yml

@@ -2,11 +2,6 @@ included:
   - Realm/ObjectServerTests
   - RealmSwift
   - Realm/Swift
-  - examples/installation/watchos/swift
-  - examples/installation/osx/swift
-  - examples/installation/ios/swift
-  - examples/ios/swift
-  - examples/tvos/swift
 identifier_name:
   min_length: # not possible to disable this partial rule, so set it to zero
     warning: 0

+ 0 - 46
Carthage/Checkouts/realm-cocoa/CHANGELOG.md

@@ -1,49 +1,3 @@
-3.18.0 Release notes (2019-08-13)
-=============================================================
-
-The file format for synchronized Realms has changed. Old Realms will be
-automatically upgraded when they are opened. Once upgraded, the files will not
-be openable by older versions of Realm. The upgrade should not take a
-significant amount of time to run or run any risk of errors.
-
-This does not effect non-synchronized Realms.
-
-### Enhancements
-
-* Improve performance of queries on Date properties
-  ([Core #3344](https://github.com/realm/realm-core/pull/3344), [Core #3351](https://github.com/realm/realm-core/pull/3351)).
-* Syncronized Realms are now more aggressive about trimming local history that
-  is no longer needed. This should reduce file size growth in write-heavy
-  workloads. ([Sync #3007](https://github.com/realm/realm-sync/issues/3007)).
-* Add support for building Realm as an xcframework.
-  ([PR #6237](https://github.com/realm/realm-cocoa/pull/6237)).
-* Add prebuilt libraries for Xcode 11 to the release package.
-  ([PR #6248](https://github.com/realm/realm-cocoa/pull/6248)).
-* Add a prebuilt library for Catalyst/UIKit For Mac to the release package
-  ([PR #6248](https://github.com/realm/realm-cocoa/pull/6248)).
-
-### Fixed
-
-* If a signal interrupted a msync() call, Realm would throw an exception and
-  the write transaction would fail. This behavior has new been changed to retry
-  the system call instead. ([Core #3352](https://github.com/realm/realm-core/issues/3352))
-* Queries on the sum or average of an integer property would sometimes give
-  incorrect results. ([Core #3356](https://github.com/realm/realm-core/pull/3356)).
-* Opening query-based synchronized Realms with a small number of subscriptions
-  performed an unneccesary write transaction. ([ObjectStore #815](https://github.com/realm/realm-object-store/pull/815)).
-
-### Compatibility
-
-* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
-* Realm Object Server: 3.21.0 or later.
-* Carthage release for Swift is built with Xcode 11.0
-
-### Deprecations
-
-* `RLMIdentityProviderNickname` has been deprecated in favor of `RLMIdentityProviderUsernamePassword`.
-* `+[RLMIdentityProvider credentialsWithNickname]` has been deprecated in favor of `+[RLMIdentityProvider credentialsWithUsername]`.
-* `Sync.nickname(String, Bool)` has been deprecated in favor of `Sync.usernamePassword(String, String, Bool)`.
-
 3.17.3 Release notes (2019-07-24)
 =============================================================
 

+ 1 - 3
Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig

@@ -45,9 +45,7 @@ GCC_WARN_UNUSED_VARIABLE = YES;
 SWIFT_COMPILATION_MODE = wholemodule;
 SWIFT_OPTIMIZATION_LEVEL = -Owholemodule;
 WARNING_CFLAGS = -Wmismatched-tags -Wunused-private-field -Wpartial-availability;
-OTHER_CFLAGS = -fvisibility-inlines-hidden $(REALM_CATALYST_FLAGS);
-OTHER_LDFLAGS = $(REALM_CATALYST_FLAGS);
-OTHER_SWIFT_FLAGS = $(REALM_CATALYST_FLAGS);
+OTHER_CFLAGS = -fvisibility-inlines-hidden;
 
 OTHER_CPLUSPLUSFLAGS = $(inherited) -isystem core/include;
 HEADER_SEARCH_PATHS = $(inherited) Realm/ObjectStore/src;

+ 3 - 5
Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm.xcconfig

@@ -11,8 +11,7 @@ DEFINES_MODULE = YES;
 DYLIB_COMPATIBILITY_VERSION = 1;
 DYLIB_CURRENT_VERSION = 1;
 DYLIB_INSTALL_NAME_BASE = @rpath;
-REALM_OBJC_MACH_O_TYPE = mh_dylib;
-MACH_O_TYPE = $(REALM_OBJC_MACH_O_TYPE);
+MACH_O_TYPE = mh_dylib;
 FRAMEWORK_VERSION = A;
 
 APPLICATION_EXTENSION_API_ONLY = YES;
@@ -28,9 +27,8 @@ LD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = $(inherited) @executable_path/Frameworks
 LD_RUNPATH_SEARCH_PATHS[sdk=watch*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;
 LD_RUNPATH_SEARCH_PATHS[sdk=appletv*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks;
 
-REALM_PLATFORM_SUFFIX = $(PLATFORM_NAME);
-OTHER_LDFLAGS[sdk=macosx*] = -lrealm-$(REALM_PLATFORM_SUFFIX)$(REALM_LIBRARY_SUFFIX) $(REALM_CATALYST_FLAGS);
-OTHER_LIBTOOLFLAGS[sdk=macosx*] = -lrealm-$(REALM_PLATFORM_SUFFIX)$(REALM_LIBRARY_SUFFIX) $(REALM_CATALYST_FLAGS);
+OTHER_LDFLAGS[sdk=macosx*] = -lrealm$(REALM_LIBRARY_SUFFIX);
+OTHER_LIBTOOLFLAGS[sdk=macosx*] = -lrealm$(REALM_LIBRARY_SUFFIX);
 OTHER_LDFLAGS[sdk=iphone*] = -lrealm-ios$(REALM_LIBRARY_SUFFIX);
 OTHER_LIBTOOLFLAGS[sdk=iphone*] = -lrealm-ios$(REALM_LIBRARY_SUFFIX);
 OTHER_LDFLAGS[sdk=watch*] = -lrealm-watchos$(REALM_LIBRARY_SUFFIX);

+ 43 - 64
Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability

@@ -1,10 +1,8 @@
-xcodeVersions = ['10.0', '10.1', '10.2.1', '10.3', '11.0']
-platforms = ['osx', 'ios', 'watchos', 'tvos', 'catalyst']
-carthagePlatforms = ['osx', 'ios', 'watchos', 'tvos']
-platformNames = ['osx': 'macOS', 'ios': 'iOS', 'watchos': 'watchOS', 'tvos': 'tvOS', 'catalyst': 'Catalyst']
-carthageXcodeVersion = '11.0'
-objcXcodeVersion = '10.1'
-docsSwiftVersion = '5.1'
+xcodeVersions = ['9.4', '10.0', '10.1', '10.2.1', '10.3']
+platforms = ['osx', 'ios', 'watchos', 'tvos']
+platformNames = ['osx': 'macOS', 'ios': 'iOS', 'watchos': 'watchOS', 'tvos': 'tvOS']
+carthageXcodeVersion = '10.3'
+docsSwiftVersion = '5.0.1'
 
 def installationTest(platform, test, language) {
   return {
@@ -22,9 +20,8 @@ def installationTest(platform, test, language) {
 
       if [[ -f \$archive ]]; then
         mv \$archive .
-        unzip realm-${language}-*.zip
-        rm realm-${language}-*.zip
-        mv realm-${language}-* realm-${language}-latest
+        unzip realm-${language}-*zip
+        find . -name 'realm-${language}-*' -print0 | xargs -J% mv % realm-${language}-latest
       fi
 
       export REALM_XCODE_VERSION=${carthageXcodeVersion}
@@ -34,6 +31,20 @@ def installationTest(platform, test, language) {
   }
 }
 
+def buildObjC(platform, outputDirectory=null) {
+  return {
+    node('osx') {
+      deleteDir()
+      unstash 'source'
+      sh "XCMODE=xcpretty ./build.sh package-${platform}"
+      dir(outputDirectory ?: "build/${platform}") {
+        stash includes: "realm-framework-${platform}.zip", name: "${platform}-objc"
+      }
+    }
+  }
+}
+
+
 def doBuild() {
   stage('prepare') {
     node('docker') {
@@ -83,19 +94,14 @@ def doBuild() {
         }
       },
 
-      'iOS Obj-C static': {
-        node('osx') {
-          deleteDir()
-          unstash 'source'
-          sh "XCMODE=xcpretty REALM_XCODE_VERSION=${objcXcodeVersion} ./build.sh package-ios-static"
-          dir("build/ios-static") {
-            stash includes: "realm-framework-ios-static.zip", name: "ios-static"
-          }
-        }
-      }
+      'macOS Obj-C': buildObjC('osx', 'build/DerivedData/Realm/Build/Products/Release'),
+      'iOS Obj-C': buildObjC('ios'),
+      'watchOS Obj-C': buildObjC('watchos'),
+      'tvOS Obj-C': buildObjC('tvos'),
+      'iOS Obj-C static': buildObjC('ios-static'),
     ]
 
-    for (def p in carthagePlatforms) {
+    for (def p in platforms) {
       def platform = p
       def platformName = platformNames[platform]
       parallelBuilds["${platformName} Carthage"] = {
@@ -107,10 +113,6 @@ def doBuild() {
           . ./scripts/swift-version.sh
           set_xcode_and_swift_versions
 
-          if [ "${platform}" != osx ]; then
-            ./scripts/reset-simulators.rb
-          fi
-
           carthage build --no-skip-current --platform ${platform}
           carthage archive --output Carthage-${platform}.framework.zip
           """
@@ -125,14 +127,14 @@ def doBuild() {
       def platformName = platformNames[platform]
       for (def v in xcodeVersions) {
         def xcodeVersion = v
-        parallelBuilds["${platformName} ${xcodeVersion}"] = {
+        parallelBuilds["${platformName} Swift ${xcodeVersion}"] = {
           node('osx') {
             deleteDir()
             unstash 'source'
-            sh "XCMODE=xcpretty REALM_XCODE_VERSION=${xcodeVersion} ./build.sh package ${platform}"
+            sh "XCMODE=xcpretty ./build.sh package-${platform}-swift-${xcodeVersion}"
             dir("build/${platform}") {
-              stash includes: "realm-framework-${platform}-${xcodeVersion}.zip",
-                    name: "${platform}-${xcodeVersion}"
+              stash includes: "realm-swift-framework-${platform}-swift-${xcodeVersion}.zip",
+                    name: "${platform}-swift-${xcodeVersion}"
             }
           }
         }
@@ -149,19 +151,14 @@ def doBuild() {
           deleteDir()
 
           for (def platform in platforms) {
-            unstash "${platform}-${objcXcodeVersion}"
+            unstash "${platform}-objc"
           }
 
-          // The 10.x builds don't actually have a framework for catalyst, so
-          // use the 11.0 version instead
-          unstash 'catalyst-11.0'
-          sh "mv realm-framework-catalyst-11.0.zip realm-framework-catalyst-${objcXcodeVersion}.zip"
-
-          unstash 'ios-static'
+          unstash 'ios-static-objc'
           unstash 'examples'
           unstash 'source'
 
-          sh "REALM_XCODE_VERSION=${objcXcodeVersion} ./build.sh package-release objc"
+          sh './build.sh package-release objc'
           stash include: 'realm-objc-*.zip', name: 'objc-packaged'
           archiveArtifacts artifacts: 'realm-objc-*.zip'
         }
@@ -172,7 +169,7 @@ def doBuild() {
 
           for (def platform in platforms) {
             for (def xcodeVersion in xcodeVersions) {
-              unstash "${platform}-${xcodeVersion}"
+              unstash "${platform}-swift-${xcodeVersion}"
             }
           }
 
@@ -180,6 +177,7 @@ def doBuild() {
           unstash 'source'
 
           sh './build.sh package-release swift'
+          sh 'rm realm-swift-framework-*.zip'
           stash include: 'realm-swift-*.zip', name: 'swift-packaged'
           archiveArtifacts artifacts: 'realm-swift-*.zip'
         }
@@ -188,7 +186,7 @@ def doBuild() {
         node('osx') {
           deleteDir()
 
-          for (def platform in carthagePlatforms) {
+          for (def platform in platforms) {
             unstash "${platform}-carthage"
           }
 
@@ -208,30 +206,12 @@ def doBuild() {
 
   stage('test') {
     def parallelBuilds = [
-      'Test Obj-C Examples': {
+      'Test Examples': {
         node('osx') {
           deleteDir()
 
+          // FIXME: Split Obj-C and Swift.
           unstash 'objc-packaged'
-
-          def sha = params.sha
-          sh """
-          curl -O https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/build.sh
-          mkdir -p scripts
-          curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/swift-version.sh -o scripts/swift-version.sh
-          curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/reset-simulators.sh -o scripts/reset-simulators.sh
-          curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/reset-simulators.rb -o scripts/reset-simulators.rb
-          chmod +x scripts/reset-simulators.rb
-
-          XCMODE=xcpretty sh build.sh package-test-examples-objc
-          """
-        }
-      },
-
-      'Test Swift Examples': {
-        node('osx') {
-          deleteDir()
-
           unstash 'swift-packaged'
 
           def sha = params.sha
@@ -243,7 +223,7 @@ def doBuild() {
           curl https://raw.githubusercontent.com/realm/realm-cocoa/${sha}/scripts/reset-simulators.rb -o scripts/reset-simulators.rb
           chmod +x scripts/reset-simulators.rb
 
-          XCMODE=xcpretty sh build.sh package-test-examples-swift
+          XCMODE=xcpretty sh build.sh package-test-examples
           """
         }
       },
@@ -253,8 +233,7 @@ def doBuild() {
           deleteDir()
           unstash 'source'
 
-          sh './scripts/reset-simulators.rb'
-          sh 'XCMODE=xcpretty sh build.sh test-ios-static'
+          sh 'XCMODE=xcpretty IS_RUNNING_PACKAGING=1 sh build.sh test-ios-static'
         }
       },
 
@@ -268,7 +247,7 @@ def doBuild() {
       }
     ]
 
-    for (def platform in ["osx", "ios", "watchos"]) {
+    for (def platform in ["osx", "ios"]) {
       def platformName = platformNames[platform]
       for (def test in ["dynamic", "cocoapods", "carthage"]) {
         parallelBuilds["Installation - ${platformName} Obj-C ${test}"] = installationTest(platform, test, 'objc')
@@ -278,7 +257,7 @@ def doBuild() {
     parallelBuilds["Installation - iOS Obj-C static"] = installationTest('ios', 'static', 'objc')
     parallelBuilds["Installation - iOS Obj-C CocoaPods dynamic"] = installationTest('ios', 'cocoapods-dynamic', 'objc')
 
-    for (def platform in ["osx", "ios", "watchos"]) {
+    for (def platform in ["osx", "ios"]) {
       def platformName = platformNames[platform]
       for (def test in ["cocoapods", "carthage"]) {
         parallelBuilds["Installation - ${platformName} Swift ${test}"] = installationTest(platform, test, 'swift')

+ 81 - 54
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake

@@ -53,6 +53,18 @@ else()
     set(SSL_LIBRARIES OpenSSL::SSL)
 endif()
 
+
+set(MAKE_FLAGS "REALM_HAVE_CONFIG=1")
+
+if(SANITIZER_FLAGS)
+    set(MAKE_FLAGS ${MAKE_FLAGS} "EXTRA_CFLAGS=${SANITIZER_FLAGS}" "EXTRA_LDFLAGS=${SANITIZER_FLAGS}")
+endif()
+
+ProcessorCount(NUM_JOBS)
+if(NOT NUM_JOBS EQUAL 0)
+    set(MAKE_FLAGS ${MAKE_FLAGS} "-j${NUM_JOBS}")
+endif()
+
 if (${CMAKE_VERSION} VERSION_GREATER "3.4.0")
     set(USES_TERMINAL_BUILD USES_TERMINAL_BUILD 1)
 endif()
@@ -61,7 +73,7 @@ function(use_realm_core enable_sync core_prefix sync_prefix)
     if(core_prefix)
         build_existing_realm_core(${core_prefix})
         if(sync_prefix)
-            build_existing_realm_sync(${core_prefix} ${sync_prefix})
+            build_existing_realm_sync(${sync_prefix})
         endif()
     elseif(enable_sync)
         # FIXME: Support building against prebuilt sync binaries.
@@ -221,7 +233,6 @@ endfunction()
 macro(build_realm_core)
     set(core_prefix_directory "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/realm-core")
 
-    separate_arguments(core_cfg_args UNIX_COMMAND "-D REALM_BUILD_LIB_ONLY=YES -D REALM_SKIP_SHARED_LIB=YES -G Ninja ${CORE_SANITIZER_FLAGS}")
     ExternalProject_Add(realm-core
         PREFIX ${core_prefix_directory}
         BUILD_IN_SOURCE 1
@@ -229,11 +240,11 @@ macro(build_realm_core)
         INSTALL_COMMAND ""
         CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory build.debug
                         && cd build.debug
-                        && cmake -D CMAKE_BUILD_TYPE=Debug ${core_cfg_args} ..
+                        && cmake -D CMAKE_BUILD_TYPE=Debug -DREALM_BUILD_LIB_ONLY=YES -G Ninja ..
                         && cd ..
                         && ${CMAKE_COMMAND} -E make_directory build.release
                         && cd build.release
-                        && cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo ${core_cfg_args} ..
+                        && cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -DREALM_BUILD_LIB_ONLY=YES -G Ninja ..
 
         BUILD_COMMAND cd build.debug
                    && cmake --build .
@@ -303,52 +314,57 @@ function(build_existing_realm_core core_directory)
                      )
 endfunction()
 
-macro(build_realm_sync core_directory)
-    set(sync_prefix_directory "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/realm-sync")
+macro(build_realm_sync)
+    set(cmake_files ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+    if(REALM_PLATFORM STREQUAL "Android")
+        set(build_cmd sh build.sh build-android)
+    else()
+        set(build_cmd make -C src/realm librealm-sync.a librealm-sync-dbg.a librealm-server.a librealm-server-dbg.a ${MAKE_FLAGS})
+    endif()
 
-    separate_arguments(sync_cfg_args UNIX_COMMAND "-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -DREALM_BUILD_TESTS=OFF -DREALM_BUILD_COMMANDLINE_TOOLS=OFF -G Ninja ${CORE_SANITIZER_FLAGS}")
     ExternalProject_Add(realm-sync-lib
-        PREFIX ${sync_prefix_directory}
+        DEPENDS realm-core
+        PREFIX ${cmake_files}/realm-sync
         BUILD_IN_SOURCE 1
         UPDATE_DISCONNECTED 1
+        BUILD_COMMAND ${build_cmd}
+        CONFIGURE_COMMAND ""
         INSTALL_COMMAND ""
-        CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory build.debug
-                        && cd build.debug
-                        && cmake -D CMAKE_BUILD_TYPE=Debug -DREALM_CORE_BUILDTREE=${core_directory}/build.debug ${sync_cfg_args} -DREALM_BUILD_DOGLESS=OFF ..
-                        && cd ..
-                        && ${CMAKE_COMMAND} -E make_directory build.release
-                        && cd build.release
-                        && cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -DREALM_CORE_BUILDTREE=${core_directory}/build.release ${sync_cfg_args} -DREALM_BUILD_DOGLESS=OFF ..
-
-        BUILD_COMMAND cd build.debug
-                   && cmake --build .
-                   && cd ..
-                   && cd build.release
-                   && cmake --build .
         ${USES_TERMINAL_BUILD}
         ${ARGN}
         )
+
+    if(APPLE)
+        set(platform "")
+    elseif(REALM_PLATFORM STREQUAL "Android")
+        if(ANDROID_ABI STREQUAL "armeabi-v7a")
+            set(platform "-android-arm-v7a")
+        else()
+            set(platform "-android-${ANDROID_ABI}")
+        endif()
+    endif()
+
+
     ExternalProject_Get_Property(realm-sync-lib SOURCE_DIR)
-    add_dependencies(realm-sync-lib realm-core)
+    set(sync_directory ${SOURCE_DIR})
+    if(REALM_PLATFORM STREQUAL "Android")
+        set(sync_library_directory ${sync_directory}/android-lib)
+    else()
+        set(sync_library_directory ${sync_directory}/src/realm)
+    endif()
 
-    set(sync_debug_binary_dir "${SOURCE_DIR}/build.debug")
-    set(sync_release_binary_dir "${SOURCE_DIR}/build.release")
-    set(sync_library_debug "${sync_debug_binary_dir}/src/realm/${CMAKE_STATIC_LIBRARY_PREFIX}realm-sync-dbg${CMAKE_STATIC_LIBRARY_SUFFIX}")
-    set(sync_library_release "${sync_release_binary_dir}/src/realm/${CMAKE_STATIC_LIBRARY_PREFIX}realm-sync${CMAKE_STATIC_LIBRARY_SUFFIX}")
-    set(sync_server_library_debug "${sync_debug_binary_dir}/src/realm/${CMAKE_STATIC_LIBRARY_PREFIX}realm-server-dbg${CMAKE_STATIC_LIBRARY_SUFFIX}")
-    set(sync_server_library_release "${sync_release_binary_dir}/src/realm/${CMAKE_STATIC_LIBRARY_PREFIX}realm-server${CMAKE_STATIC_LIBRARY_SUFFIX}")
+    set(sync_library_debug ${sync_library_directory}/librealm-sync${platform}-dbg.a)
+    set(sync_library_release ${sync_library_directory}/librealm-sync${platform}.a)
+    set(sync_libraries ${sync_library_debug} ${sync_library_release})
 
     ExternalProject_Add_Step(realm-sync-lib ensure-libraries
+        BYPRODUCTS ${sync_libraries}
         DEPENDEES build
-        BYPRODUCTS ${sync_library_debug} ${sync_library_release}
-                   ${sync_server_library_debug} ${sync_server_library_release}
         )
 
-    set(sync_generated_headers_dir_debug "${sync_debug_binary_dir}/src")
-    set(sync_generated_headers_dir_release "${sync_release_binary_dir}/src")
-
     add_library(realm-sync STATIC IMPORTED)
     add_dependencies(realm-sync realm-sync-lib)
+
     set_property(TARGET realm-sync PROPERTY IMPORTED_LOCATION_DEBUG ${sync_library_debug})
     set_property(TARGET realm-sync PROPERTY IMPORTED_LOCATION_COVERAGE ${sync_library_debug})
     set_property(TARGET realm-sync PROPERTY IMPORTED_LOCATION_RELEASE ${sync_library_release})
@@ -358,41 +374,52 @@ macro(build_realm_sync core_directory)
 
     # 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 build sync.
-    file(MAKE_DIRECTORY "${sync_generated_headers_dir_debug}" "${sync_generated_headers_dir_release}" "${SOURCE_DIR}/src")
+    file(MAKE_DIRECTORY ${sync_directory}/src)
+    set_property(TARGET realm-sync PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${sync_directory}/src)
 
-    set_property(TARGET realm-sync PROPERTY INTERFACE_INCLUDE_DIRECTORIES
-        ${SOURCE_DIR}/src
-        $<$<CONFIG:Debug>:${sync_generated_headers_dir_debug}>
-        $<$<NOT:$<CONFIG:Debug>>:${sync_generated_headers_dir_release}>
-    )
+    # Sync server library is built as part of the sync library build
+    set(sync_server_library_debug ${sync_library_directory}/librealm-server${platform}-dbg.a)
+    set(sync_server_library_release ${sync_library_directory}/librealm-server${platform}.a)
+    set(sync_server_libraries ${sync_server_library_debug} ${sync_server_library_release})
+
+    ExternalProject_Add_Step(realm-sync-lib ensure-server-libraries
+        BYPRODUCTS ${sync_server_libraries}
+        DEPENDEES build
+        )
 
     add_library(realm-sync-server STATIC IMPORTED)
-    add_dependencies(realm realm-sync)
+    add_dependencies(realm-sync-server realm-sync-lib)
+
     set_property(TARGET realm-sync-server PROPERTY IMPORTED_LOCATION_DEBUG ${sync_server_library_debug})
     set_property(TARGET realm-sync-server PROPERTY IMPORTED_LOCATION_COVERAGE ${sync_server_library_debug})
     set_property(TARGET realm-sync-server PROPERTY IMPORTED_LOCATION_RELEASE ${sync_server_library_release})
     set_property(TARGET realm-sync-server PROPERTY IMPORTED_LOCATION ${sync_server_library_release})
+
+    find_package(PkgConfig)
+    pkg_check_modules(YAML QUIET yaml-cpp)
+    set_property(TARGET realm-sync-server PROPERTY INTERFACE_LINK_LIBRARIES ${SSL_LIBRARIES} ${YAML_LDFLAGS})
 endmacro()
 
-function(build_existing_realm_sync core_directory sync_directory)
+function(build_existing_realm_sync sync_directory)
     get_filename_component(sync_directory ${sync_directory} ABSOLUTE)
-    build_realm_sync(
-        ${core_directory}
-        URL ""
-        SOURCE_DIR ${sync_directory}
-        BUILD_ALWAYS 1
-        )
+    build_realm_sync(URL ""
+                     SOURCE_DIR ${sync_directory}
+                     BUILD_ALWAYS 1
+                     )
 
 endfunction()
 
 function(clone_and_build_realm_sync branch)
-    set(core_prefix_directory "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/realm-core/src/realm-core")
     set(cmake_files ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
-    build_realm_sync(
-        ${core_prefix_directory}
-        GIT_REPOSITORY "git@github.com:realm/realm-sync.git"
-        GIT_TAG ${branch}
-        CONFIGURE_COMMAND ${config_cmd}
-        )
+    if(REALM_PLATFORM STREQUAL "Android")
+        set(config_cmd test -f src/config.mk || REALM_CORE_PREFIX=${cmake_files}/realm-core/src/realm-core REALM_FORCE_OPENSSL=YES REALM_ENABLE_ASSERTIONS= sh build.sh config && echo "ENABLE_ENCRYPTION    = yes" >> src/config.mk)
+    else()
+        set(config_cmd test -f src/config.mk || REALM_CORE_PREFIX=${cmake_files}/realm-core/src/realm-core sh build.sh config)
+    endif()
+
+    build_realm_sync(GIT_REPOSITORY "git@github.com:realm/realm-sync.git"
+                     GIT_TAG ${branch}
+                     CONFIGURE_COMMAND ${config_cmd}
+                     )
 
 endfunction()

+ 0 - 3
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/Sanitizers.cmake

@@ -22,17 +22,14 @@ option(SANITIZE_UNDEFINED "build with UBSan")
 
 if(SANITIZE_ADDRESS)
     set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize=address")
-    set(CORE_SANITIZER_FLAGS ${CORE_SANITIZER_FLAGS};-D;REALM_ASAN=ON)
 endif()
 
 if(SANITIZE_THREAD)
     set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize=thread")
-    set(CORE_SANITIZER_FLAGS ${CORE_SANITIZER_FLAGS};-D;REALM_TSAN=ON)
 endif()
 
 if(SANITIZE_UNDEFINED)
     set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize=undefined")
-    set(CORE_SANITIZER_FLAGS ${CORE_SANITIZER_FLAGS};-D;REALM_USAN=ON)
 endif()
 
 if(SANITIZE_ADDRESS OR SANITIZE_THREAD OR SANITIZE_UNDEFINED)

+ 3 - 3
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Dockerfile

@@ -17,7 +17,7 @@ ENV ANDROID_NDK_PATH /opt/android-ndk
 
 # Ensure a new enough version of CMake is available.
 RUN cd /opt \
-    && wget https://cmake.org/files/v3.15/cmake-3.15.2-Linux-x86_64.tar.gz \
-        && tar zxvf cmake-3.15.2-Linux-x86_64.tar.gz
+    && wget https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz \
+        && tar zxvf cmake-3.7.2-Linux-x86_64.tar.gz
 
-ENV PATH "/opt/cmake-3.15.2-Linux-x86_64/bin:$PATH"
+ENV PATH "/opt/cmake-3.7.2-Linux-x86_64/bin:$PATH"

+ 6 - 6
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Jenkinsfile

@@ -46,7 +46,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 withCoverage, Boolean enableSync) {
   def sync = enableSync ? "sync" : ""
   def label = "${flavor}${enableSync ? '-sync' : ''}"
 
@@ -59,7 +59,7 @@ def doDockerBuild(String flavor, Boolean withCoverage, Boolean enableSync, Strin
           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}"
           }
         }
       }
@@ -82,7 +82,7 @@ def doAndroidDockerBuild() {
             sh '''rm -rf build
               mkdir build
               cd build
-              cmake -DREALM_PLATFORM=Android -DANDROID_NDK=/opt/android-ndk -GNinja -DCMAKE_MAKE_PROGRAM=ninja ..
+              cmake -DREALM_PLATFORM=Android -DANDROID_NDK=/opt/android-ndk -GNinja ..
               ninja
               adb connect emulator
               timeout 10m adb wait-for-device
@@ -168,10 +168,8 @@ stage('prepare') {
 
 stage('unit-tests') {
   parallel(
-    linux: doDockerBuild('linux', false, false),
+    linux: doDockerBuild('linux', true, 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'),
     android: doAndroidDockerBuild(),
     macos: doBuild('osx', 'macOS', false, ''),
     macos_sync: doBuild('osx', 'macOS', true, ''),
@@ -183,7 +181,9 @@ stage('unit-tests') {
 
 stage('publish') {
   node('docker') {
+    publishReport('linux')
     publishReport('linux-sync')
+    publishReport('macOS')
     publishReport('macOS-sync')
   }
 }

+ 2 - 2
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list

@@ -1,4 +1,4 @@
-REALM_CORE_VERSION=5.23.2
-REALM_SYNC_VERSION=4.7.4
+REALM_CORE_VERSION=5.22.0
+REALM_SYNC_VERSION=4.6.1
 ANDROID_OPENSSL_VERSION=1.0.2k
 REALM_CORE_PACKAGING=2

+ 3 - 2
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/CMakeLists.txt

@@ -67,13 +67,14 @@ set(HEADERS
     util/atomic_shared_ptr.hpp
     util/event_loop_dispatcher.hpp
     util/event_loop_signal.hpp
+    util/fifo.hpp
     util/tagged_bool.hpp
     util/uuid.hpp)
 
 if(APPLE)
-    list(APPEND SOURCES impl/apple/external_commit_helper.cpp impl/apple/keychain_helper.cpp)
+    list(APPEND SOURCES impl/apple/external_commit_helper.cpp impl/apple/keychain_helper.cpp util/fifo.cpp)
 elseif(REALM_HAVE_EPOLL)
-    list(APPEND SOURCES impl/epoll/external_commit_helper.cpp)
+    list(APPEND SOURCES impl/epoll/external_commit_helper.cpp util/fifo.cpp)
 elseif(CMAKE_SYSTEM_NAME MATCHES "^Windows")
     list(APPEND SOURCES impl/windows/external_commit_helper.cpp)
 else()

+ 4 - 4
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/apple/external_commit_helper.cpp

@@ -18,9 +18,9 @@
 
 #include "impl/external_commit_helper.hpp"
 #include "impl/realm_coordinator.hpp"
+#include "util/fifo.hpp"
 
 #include <realm/group_shared_options.hpp>
-#include <realm/util/fifo_helper.hpp>
 
 #include <asl.h>
 #include <assert.h>
@@ -122,14 +122,14 @@ ExternalCommitHelper::ExternalCommitHelper(RealmCoordinator& parent)
     std::string sys_temp_dir = util::normalize_dir(SharedGroupOptions::get_sys_tmp_dir());
 
     path = parent.get_path() + ".note";
-    bool fifo_created = realm::util::try_create_fifo(path);
+    bool fifo_created = util::try_create_fifo(path);
     if (!fifo_created && !temp_dir.empty()) {
         path = util::format("%1realm_%2.note", temp_dir, std::hash<std::string>()(parent.get_path()));
-        fifo_created = realm::util::try_create_fifo(path);
+        fifo_created = util::try_create_fifo(path);
     }
     if (!fifo_created && !sys_temp_dir.empty()) {
         path = util::format("%1realm_%2.note", sys_temp_dir, std::hash<std::string>()(parent.get_path()));
-        realm::util::create_fifo(path);
+        util::create_fifo(path);
     }
 
     m_notify_fd = open(path.c_str(), O_RDWR);

+ 1 - 1
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/epoll/external_commit_helper.cpp

@@ -18,7 +18,7 @@
 
 #include "impl/external_commit_helper.hpp"
 #include "impl/realm_coordinator.hpp"
-#include <realm/util/fifo_helper.hpp>
+#include "util/fifo.hpp"
 
 #include <realm/util/assert.hpp>
 #include <realm/group_shared_options.hpp>

+ 3 - 4
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.cpp

@@ -79,7 +79,7 @@ std::shared_ptr<RealmCoordinator> RealmCoordinator::get_existing_coordinator(Str
     return it == s_coordinators_per_path.end() ? nullptr : it->second.lock();
 }
 
-void RealmCoordinator::create_sync_session(bool force_client_resync, bool validate_sync_history)
+void RealmCoordinator::create_sync_session(bool force_client_reset, bool validate_sync_history)
 {
 #if REALM_ENABLE_SYNC
     if (m_sync_session)
@@ -97,7 +97,7 @@ void RealmCoordinator::create_sync_session(bool force_client_resync, bool valida
 
     auto sync_config = *m_config.sync_config;
     sync_config.validate_sync_history = validate_sync_history;
-    m_sync_session = SyncManager::shared().get_session(m_config.path, sync_config, force_client_resync);
+    m_sync_session = SyncManager::shared().get_session(m_config.path, sync_config, force_client_reset);
 
     std::weak_ptr<RealmCoordinator> weak_self = shared_from_this();
     SyncSession::Internal::set_sync_transact_callback(*m_sync_session,
@@ -110,8 +110,7 @@ void RealmCoordinator::create_sync_session(bool force_client_resync, bool valida
         }
     });
 #else
-    static_cast<void>(force_client_resync);
-    static_cast<void>(validate_sync_history);
+    static_cast<void>(force_client_reset);
 #endif
 }
 

+ 1 - 1
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.hpp

@@ -209,7 +209,7 @@ private:
     void pin_version(VersionID version);
 
     void set_config(const Realm::Config&);
-    void create_sync_session(bool force_client_resync, bool validate_sync_history);
+    void create_sync_session(bool force_client_reset, bool validate_sync_history);
     void do_get_realm(Realm::Config config, std::shared_ptr<Realm>& realm,
                       std::unique_lock<std::mutex>& realm_lock, bool bind_to_context=true);
 

+ 1 - 2
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/shared_realm.cpp

@@ -21,6 +21,7 @@
 #include "impl/collection_notifier.hpp"
 #include "impl/realm_coordinator.hpp"
 #include "impl/transact_log_handler.hpp"
+#include "util/fifo.hpp"
 
 #include "audit.hpp"
 #include "binding_context.hpp"
@@ -34,8 +35,6 @@
 
 #include <realm/history.hpp>
 #include <realm/util/scope_exit.hpp>
-#include <realm/util/fifo_helper.hpp>
-
 
 #if REALM_ENABLE_SYNC
 #include "sync/impl/sync_file.hpp"

+ 0 - 9
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/realm.cpp

@@ -477,19 +477,16 @@ TEST_CASE("Get Realm using Async Open", "[asyncOpen]") {
     config2.cache = false;
     config2.schema = config.schema;
 
-    std::mutex mutex;
     SECTION("can open synced Realms that don't already exist") {
         std::atomic<bool> called{false};
         auto task = Realm::get_synchronized_realm(config);
         task->start([&](auto ref, auto error) {
-            std::lock_guard<std::mutex> lock(mutex);
             REQUIRE(!error);
             called = true;
 
             REQUIRE(Realm::get_shared_realm(std::move(ref))->read_group().get_table("class_object"));
         });
         util::EventLoop::main().run_until([&]{ return called.load(); });
-        std::lock_guard<std::mutex> lock(mutex);
         REQUIRE(called);
     }
 
@@ -505,14 +502,12 @@ TEST_CASE("Get Realm using Async Open", "[asyncOpen]") {
         std::atomic<bool> called{false};
         auto task = Realm::get_synchronized_realm(config);
         task->start([&](auto ref, auto error) {
-            std::lock_guard<std::mutex> lock(mutex);
             REQUIRE(!error);
             called = true;
 
             REQUIRE(Realm::get_shared_realm(std::move(ref))->read_group().get_table("class_object"));
         });
         util::EventLoop::main().run_until([&]{ return called.load(); });
-        std::lock_guard<std::mutex> lock(mutex);
         REQUIRE(called);
     }
 
@@ -530,14 +525,12 @@ TEST_CASE("Get Realm using Async Open", "[asyncOpen]") {
         std::atomic<bool> called{false};
         auto task = Realm::get_synchronized_realm(config);
         task->start([&](auto ref, auto error) {
-            std::lock_guard<std::mutex> lock(mutex);
             REQUIRE(!error);
             called = true;
 
             REQUIRE(Realm::get_shared_realm(std::move(ref))->read_group().get_table("class_object")->size() == 1);
         });
         util::EventLoop::main().run_until([&]{ return called.load(); });
-        std::lock_guard<std::mutex> lock(mutex);
         REQUIRE(called);
     }
 
@@ -555,12 +548,10 @@ TEST_CASE("Get Realm using Async Open", "[asyncOpen]") {
         std::atomic<bool> called{false};
         auto task = Realm::get_synchronized_realm(config);
         task->start([&](auto, auto error) {
-            std::lock_guard<std::mutex> lock(mutex);
             REQUIRE(!error);
             called = true;
         });
         util::EventLoop::main().run_until([&]{ return called.load(); });
-        std::lock_guard<std::mutex> lock(mutex);
         REQUIRE(called);
 
         // No subscriptions, so no objects

+ 6 - 16
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.cpp

@@ -121,10 +121,7 @@ SyncTestFile::SyncTestFile(SyncServer& server, std::string name, bool is_partial
     schema_mode = SchemaMode::Additive;
 }
 
-SyncServer::SyncServer(StartImmediately start_immediately)
-: m_server(util::make_temp_dir(), util::none, ([&] {
-    using namespace std::literals::chrono_literals;
-
+sync::Server::Config TestLogger::server_config() {
     sync::Server::Config config;
 #if TEST_ENABLE_SYNC_LOGGING
     auto logger = new util::StderrLogger;
@@ -133,18 +130,11 @@ SyncServer::SyncServer(StartImmediately start_immediately)
 #else
     config.logger = new TestLogger;
 #endif
-    config.log_compaction_clock = this;
-#if REALM_SYNC_VER_MAJOR > 4 || (REALM_SYNC_VER_MAJOR == 4 && REALM_SYNC_VER_MINOR >= 7)
-    config.disable_history_compaction = false;
-#else
-    config.enable_log_compaction = true;
-#endif
-    config.history_ttl = 1s;
-    config.history_compaction_interval = 1s;
-    config.state_realm_dir = util::make_temp_dir();
-
     return config;
-})())
+}
+
+SyncServer::SyncServer(StartImmediately start_immediately)
+: m_server(util::make_temp_dir(), util::none, TestLogger::server_config())
 {
 #if TEST_ENABLE_SYNC_LOGGING
     SyncManager::shared().set_log_level(util::Logger::Level::all);
@@ -194,7 +184,7 @@ std::string SyncServer::url_for_realm(StringData realm_name) const
     return util::format("%1/%2", m_url, realm_name);
 }
 
-static void wait_for_session(Realm& realm, void (SyncSession::*fn)(std::function<void(std::error_code)>))
+static void wait_for_session(Realm& realm, bool (SyncSession::*fn)(std::function<void(std::error_code)>))
 {
     std::condition_variable cv;
     std::mutex wait_mutex;

+ 3 - 13
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp

@@ -82,11 +82,13 @@ struct TestLogger : realm::util::Logger::LevelThreshold, realm::util::Logger {
     void do_log(realm::util::Logger::Level, std::string) override {}
     Level get() const noexcept override { return Level::off; }
     TestLogger() : Logger::LevelThreshold(), Logger(static_cast<Logger::LevelThreshold&>(*this)) { }
+
+    static realm::sync::Server::Config server_config();
 };
 
 using StartImmediately = realm::util::TaggedBool<class StartImmediatelyTag>;
 
-class SyncServer : private realm::sync::Clock {
+class SyncServer {
 public:
     SyncServer(StartImmediately start_immediately=true);
     ~SyncServer();
@@ -97,22 +99,10 @@ public:
     std::string url_for_realm(realm::StringData realm_name) const;
     std::string base_url() const { return m_url; }
 
-    template <class R, class P>
-    void advance_clock(std::chrono::duration<R, P> duration = std::chrono::seconds(1)) noexcept
-    {
-        m_now += std::chrono::duration_cast<time_point::duration>(duration).count();
-    }
-
 private:
     realm::sync::Server m_server;
     std::thread m_thread;
     std::string m_url;
-    std::atomic<time_point::rep> m_now{0};
-
-    time_point now() const noexcept override
-    {
-        return time_point{time_point::duration{m_now}};
-    }
 };
 
 struct SyncTestFile : TestFile {

+ 2 - 5
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/build.sh

@@ -8,15 +8,12 @@
 
 flavor=${1:-linux}
 sync=${2}
-extra_flags=${3}
 
 nprocs=4
 if [ "$(uname)" = "Linux" ]; then
   nprocs=$(grep -c ^processor /proc/cpuinfo)
 fi
 
-: ${OPENSSL_ROOT_DIR:=/usr/local}
-
 set -e
 
 rm -rf ci.build
@@ -30,8 +27,8 @@ if [ "${flavor}" = "android" ]; then
 fi
 
 if [ "${sync}" = "sync" ]; then
-    cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_SERVER=1 -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}"
+    cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_SERVER=1"
 fi
 
-cmake ${cmake_flags} ${extra_flags} ..
+cmake ${cmake_flags} ..
 make VERBOSE=1 -j${nprocs}

+ 1 - 9
Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh

@@ -11,23 +11,15 @@ if [ "$(uname)" = "Linux" ]; then
   nprocs=$(grep -c ^processor /proc/cpuinfo)
 fi
 
-: ${OPENSSL_ROOT_DIR:=/usr/local}
-
 set -e
 
-if [ "${TMPDIR}" = "" ]; then
-  TMPDIR="/tmp"
-fi
-
-echo "TMPDIR: ${TMPDIR}"
-ls "${TMPDIR}/realm*" | while read filename; do rm -rf "$filename"; done
 rm -rf coverage.build
 mkdir -p coverage.build
 cd coverage.build
 
 cmake_flags=""
 if [ "${sync}" = "sync" ]; then
-    cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_SERVER=1 -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}"
+    cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1"
 fi
 
 cmake ${cmake_flags} -DCMAKE_BUILD_TYPE=Coverage -DDEPENDENCIES_FILE="dependencies${deps_suffix}.list" ..

+ 5 - 8
Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.h

@@ -173,15 +173,12 @@ typedef RLM_ERROR_ENUM(NSInteger, RLMError, RLMErrorDomain) {
 typedef NSString * RLMNotification RLM_EXTENSIBLE_STRING_ENUM;
 
 /**
- This notification is posted when a write transaction has been committed to a Realm on a different thread for
- the same file.
+ This notification is posted by a Realm when the data in that Realm has changed.
 
- It is not posted if `autorefresh` is enabled, or if the Realm is refreshed before the notification has a chance
- to run.
-
- Realms with autorefresh disabled should normally install a handler for this notification which calls
- `-[RLMRealm refresh]` after doing some work. Refreshing the Realm is optional, but not refreshing the Realm may lead to
- large Realm files. This is because an extra copy of the data must be kept for the stale Realm.
+ More specifically, this notification is posted after a Realm has been refreshed to
+ reflect a write transaction. This can happen when an autorefresh occurs, when
+ `-[RLMRealm refresh]` is called, after an implicit refresh from `-[RLMRealm beginWriteTransaction]`,
+ or after a local write transaction is completed.
  */
 extern RLMNotification const RLMRealmRefreshRequiredNotification
 RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmRefreshRequiredNotification, RefreshRequired);

+ 6 - 22
Carthage/Checkouts/realm-cocoa/Realm/RLMPlatform.h.in

@@ -16,32 +16,16 @@
 //
 ////////////////////////////////////////////////////////////////////////////
 
-#ifdef REALM_BUILDING_FOR_MACOSX
-#if !__is_target_os(macosx)
-#error Attempting to use Realm''s macOS framework in a non-macOS target.
-#endif
-#endif
+#if REALM_BUILDING_FOR_OS_X
 
-#ifdef REALM_BUILDING_FOR_MACCATALYST
-#if !__is_target_os(ios) || !__is_target_environment(macabi)
-#error Attempting to use Realm''s Catalyst framework in a non-Catalyst target.
-#endif
+#if TARGET_OS_IPHONE
+#error Attempting to use Realm''s OSX framework in an iOS project.
 #endif
 
-#ifdef REALM_BUILDING_FOR_IOS
-#if !__is_target_os(ios) || __is_target_environment(macabi)
-#error Attempting to use Realm''s iOS framework in a non-iOS target.
-#endif
-#endif
+#else
 
-#ifdef REALM_BUILDING_FOR_TVOS
-#if !__is_target_os(tvos)
-#error Attempting to use Realm''s tvOS framework in a non-tvOS target.
-#endif
+#if !TARGET_OS_IPHONE
+#error Attempting to use Realm''s iOS framework in an OSX project.
 #endif
 
-#ifdef REALM_BUILDING_FOR_WATCHOS
-#if !__is_target_os(watchos)
-#error Attempting to use Realm''s watchOS framework in a non-watchOS target.
-#endif
 #endif

+ 0 - 1
Carthage/Checkouts/realm-cocoa/Realm/RLMSyncConfiguration.mm

@@ -253,7 +253,6 @@ BOOL isValidRealmURL(NSURL *url) {
         _config->bind_session_handler = std::move(bindHandler);
         _config->error_handler = std::move(errorHandler);
         _config->is_partial = isPartial;
-        _config->client_resync_mode = realm::ClientResyncMode::Manual;
 
         if (NSString *authorizationHeaderName = [RLMSyncManager sharedManager].authorizationHeaderName) {
             _config->authorization_header_name.emplace(authorizationHeaderName.UTF8String);

+ 2 - 2
Carthage/Checkouts/realm-cocoa/Realm/RLMSyncCredentials.h

@@ -52,7 +52,7 @@ extern RLMIdentityProvider const RLMIdentityProviderJWT;
 extern RLMIdentityProvider const RLMIdentityProviderAnonymous;
 
 /// A Nickname account as an identity provider.
-extern RLMIdentityProvider const RLMIdentityProviderNickname __deprecated_msg("Use RLMIdentityProviderUsernamePassword instead");
+extern RLMIdentityProvider const RLMIdentityProviderNickname;
 
 /**
  Opaque credentials representing a specific Realm Object Server user.
@@ -103,7 +103,7 @@ extern RLMIdentityProvider const RLMIdentityProviderNickname __deprecated_msg("U
 /**
  Construct and return credentials from a nickname
  */
-+ (instancetype)credentialsWithNickname:(NSString *)nickname isAdmin:(BOOL)isAdmin __deprecated_msg("Use +credentialsWithUsername instead");
++ (instancetype)credentialsWithNickname:(NSString *)nickname isAdmin:(BOOL)isAdmin;
 
 /**
  Construct and return special credentials representing a token that can

+ 2 - 2
Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist

@@ -17,11 +17,11 @@
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
-	<string>3.18.0</string>
+	<string>3.17.3</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>3.18.0</string>
+	<string>3.17.3</string>
 	<key>NSHumanReadableCopyright</key>
 	<string>Copyright © 2014 Realm. All rights reserved.</string>
 	<key>NSPrincipalClass</key>

+ 28 - 0
Carthage/Checkouts/realm-cocoa/RealmSwift/RealmCollection.swift

@@ -32,9 +32,11 @@ public struct RLMIterator<Element: RealmCollectionValue>: IteratorProtocol {
     /// Advance to the next element and return it, or `nil` if no next element exists.
     public mutating func next() -> Element? {
         let next = generatorBase.next()
+        #if swift(>=3.4) && (swift(>=4.1.50) || !swift(>=4))
         if next is NSNull {
             return Element._nilValue()
         }
+        #endif
         if let next = next as? Object? {
             if next == nil {
                 return nil as Element?
@@ -132,6 +134,7 @@ private func forceCast<A, U>(_ from: A, to type: U.Type) -> U {
     return from as! U
 }
 
+#if swift(>=3.4) && (swift(>=4.1.50) || !swift(>=4))
 /// A type which can be stored in a Realm List or Results.
 ///
 /// Declaring additional types as conforming to this protocol will not make them
@@ -144,6 +147,18 @@ public protocol RealmCollectionValue: Equatable {
     /// :nodoc:
     static func _nilValue() -> Self
 }
+#else
+/// A type which can be stored in a Realm List or Results
+///
+/// Declaring additional types as conforming to this protocol will not make them
+/// actually work. Most of the logic for how to store values in Realm is not
+/// implemented in Swift and there is currently no extension mechanism for
+/// supporting more types.
+public protocol RealmCollectionValue {
+    /// :nodoc:
+    static func _rlmArray() -> RLMArray<AnyObject>
+}
+#endif
 
 extension RealmCollectionValue {
     /// :nodoc:
@@ -170,6 +185,7 @@ private func arrayType<T>(_ type: T.Type) -> RLMArray<AnyObject> {
     }
 }
 
+#if swift(>=3.4) && (swift(>=4.1.50) || !swift(>=4))
 extension Optional: RealmCollectionValue where Wrapped: RealmCollectionValue {
     /// :nodoc:
     public static func _rlmArray() -> RLMArray<AnyObject> {
@@ -180,6 +196,18 @@ extension Optional: RealmCollectionValue where Wrapped: RealmCollectionValue {
         return nil
     }
 }
+#else
+extension Optional: RealmCollectionValue {
+    /// :nodoc:
+    public static func _rlmArray() -> RLMArray<AnyObject> {
+        return arrayType(Wrapped.self)
+    }
+    /// :nodoc:
+    public static func _nilValue() -> Optional {
+        return nil
+    }
+}
+#endif
 
 extension Int: RealmCollectionValue {}
 extension Int8: RealmCollectionValue {}

+ 6 - 0
Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift

@@ -273,6 +273,7 @@ class KVOTests: TestCase {
         let date = Date(timeIntervalSince1970: 1)
         observeChange(obs, \.dateCol, Date(timeIntervalSince1970: 0), date) { obj.dateCol = date }
 
+#if swift(>=3.4) && (swift(>=4.1.50) || !swift(>=4))
         observeChange(obs, \.objectCol, nil, obj) { obj.objectCol = obj }
 
         observeChange(obs, \.optStringCol, nil, "abc") { obj.optStringCol = "abc" }
@@ -282,14 +283,19 @@ class KVOTests: TestCase {
         observeChange(obs, \.optStringCol, "abc", nil) { obj.optStringCol = nil }
         observeChange(obs, \.optBinaryCol, data, nil) { obj.optBinaryCol = nil }
         observeChange(obs, \.optDateCol, date, nil) { obj.optDateCol = nil }
+#endif
 
         if obs.realm == nil {
             return
         }
 
+        // FIXME: crashes xcode11b1 compiler even when disabled with #if
+        // FB6115674
+        /*
         observeChange(obs, \.isInvalidated, false, true) {
             self.realm.delete(obj)
         }
+         */
     }
 
     func testReadSharedSchemaFromObservedObject() {

+ 9 - 1
Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift

@@ -569,7 +569,11 @@ class ListTests: TestCase {
                 let objects = realm.objects(SwiftOptionalObject.self)
 
                 let properties = Array(objects.compactMap { $0.optInt8Col.value })
+#if swift(>=3.1)
                 let listsOfObjects = objects.value(forKeyPath: "optInt8Col") as! [Int8]
+#else
+                let listsOfObjects = (objects.value(forKeyPath: "optInt8Col") as! [NSNumber]).map { $0.int8Value }
+#endif
                 let kvcProperties = Array(listsOfObjects.compactMap { $0 })
 
                 XCTAssertEqual(properties, kvcProperties)
@@ -583,6 +587,9 @@ class ListTests: TestCase {
 
                 XCTAssertEqual(properties, kvcProperties)
             }
+#if swift(>=4)
+            // this test crashes xcode 9 beta 1's compiler
+#else
             do {
                 let objects = realm.objects(SwiftOptionalObject.self)
 
@@ -592,11 +599,12 @@ class ListTests: TestCase {
 
                 XCTAssertEqual(properties, kvcProperties)
             }
+#endif
             do {
                 let objects = realm.objects(SwiftOptionalObject.self)
 
                 let properties = Array(objects.compactMap { $0.optNSStringCol })
-                let listsOfObjects = objects.value(forKeyPath: "optNSStringCol") as! [NSString?]
+                let listsOfObjects = objects.value(forKeyPath: "optNSStringCol") as! [NSString]
                 let kvcProperties = Array(listsOfObjects.compactMap { $0 })
 
                 XCTAssertEqual(properties, kvcProperties)

+ 2 - 2
Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/MigrationTests.swift

@@ -575,7 +575,7 @@ class MigrationTests: TestCase {
                 XCTAssertEqual(list.count, 1)
                 XCTAssertEqual((list[0]["boolCol"] as! Bool), false)
 
-                self.assertMatches(newObj!.description, "SwiftObject \\{\n\tboolCol = 0;\n\tintCol = 1;\n\tfloatCol = 1;\n\tdoubleCol = 10;\n\tstringCol = a;\n\tbinaryCol = <.*62.*>;\n\tdateCol = 1970-01-01 00:00:02 \\+0000;\n\tobjectCol = SwiftBoolObject \\{\n\t\tboolCol = 0;\n\t\\};\n\tarrayCol = List<SwiftBoolObject> <0x[0-9a-f]+> \\(\n\t\t\\[0\\] SwiftBoolObject \\{\n\t\t\tboolCol = 0;\n\t\t\\}\n\t\\);\n\\}")
+                self.assertMatches(newObj!.description, "SwiftObject \\{\n\tboolCol = 0;\n\tintCol = 1;\n\tfloatCol = 1;\n\tdoubleCol = 10;\n\tstringCol = a;\n\tbinaryCol = <62 — 1 total bytes>;\n\tdateCol = 1970-01-01 00:00:02 \\+0000;\n\tobjectCol = SwiftBoolObject \\{\n\t\tboolCol = 0;\n\t\\};\n\tarrayCol = List<SwiftBoolObject> <0x[0-9a-f]+> \\(\n\t\t\\[0\\] SwiftBoolObject \\{\n\t\t\tboolCol = 0;\n\t\t\\}\n\t\\);\n\\}")
 
                 enumerated = true
             })
@@ -583,7 +583,7 @@ class MigrationTests: TestCase {
 
             let newObj = migration.create(SwiftObject.className())
             // swiftlint:next:disable line_length
-            self.assertMatches(newObj.description, "SwiftObject \\{\n\tboolCol = 0;\n\tintCol = 123;\n\tfloatCol = 1\\.23;\n\tdoubleCol = 12\\.3;\n\tstringCol = a;\n\tbinaryCol = <.*61.*>;\n\tdateCol = 1970-01-01 00:00:01 \\+0000;\n\tobjectCol = SwiftBoolObject \\{\n\t\tboolCol = 0;\n\t\\};\n\tarrayCol = List<SwiftBoolObject> <0x[0-9a-f]+> \\(\n\t\n\t\\);\n\\}")
+            self.assertMatches(newObj.description, "SwiftObject \\{\n\tboolCol = 0;\n\tintCol = 123;\n\tfloatCol = 1\\.23;\n\tdoubleCol = 12\\.3;\n\tstringCol = a;\n\tbinaryCol = <61 — 1 total bytes>;\n\tdateCol = 1970-01-01 00:00:01 \\+0000;\n\tobjectCol = SwiftBoolObject \\{\n\t\tboolCol = 0;\n\t\\};\n\tarrayCol = List<SwiftBoolObject> <0x[0-9a-f]+> \\(\n\t\n\t\\);\n\\}")
         }
 
         // refresh to update realm

+ 1 - 1
Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ObjectTests.swift

@@ -115,7 +115,7 @@ class ObjectTests: TestCase {
     func testDescription() {
         let object = SwiftObject()
         // swiftlint:disable line_length
-        assertMatches(object.description, "SwiftObject \\{\n\tboolCol = 0;\n\tintCol = 123;\n\tfloatCol = 1\\.23;\n\tdoubleCol = 12\\.3;\n\tstringCol = a;\n\tbinaryCol = <.*61.*>;\n\tdateCol = 1970-01-01 00:00:01 \\+0000;\n\tobjectCol = SwiftBoolObject \\{\n\t\tboolCol = 0;\n\t\\};\n\tarrayCol = List<SwiftBoolObject> <0x[0-9a-f]+> \\(\n\t\n\t\\);\n\\}")
+        assertMatches(object.description, "SwiftObject \\{\n\tboolCol = 0;\n\tintCol = 123;\n\tfloatCol = 1\\.23;\n\tdoubleCol = 12\\.3;\n\tstringCol = a;\n\tbinaryCol = <61 — 1 total bytes>;\n\tdateCol = 1970-01-01 00:00:01 \\+0000;\n\tobjectCol = SwiftBoolObject \\{\n\t\tboolCol = 0;\n\t\\};\n\tarrayCol = List<SwiftBoolObject> <0x[0-9a-f]+> \\(\n\t\n\t\\);\n\\}")
 
         let recursiveObject = SwiftRecursiveObject()
         recursiveObject.objects.append(recursiveObject)

+ 174 - 1
Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift

@@ -16,7 +16,7 @@
 //
 ////////////////////////////////////////////////////////////////////////////
 
-// swiftlint:disable type_name identifier_name cyclomatic_complexity
+// swiftlint:disable type_name identifier_name statement_position cyclomatic_complexity
 
 import XCTest
 import RealmSwift
@@ -259,11 +259,184 @@ final class OptionalDateFactory: ValueFactory {
     }
 }
 
+// Older versions of swift only support three version components in top-level
+// #if, so this check to be done outside the class...
+#if swift(>=3.4) && (swift(>=4.1.50) || !swift(>=4))
 class EquatableTestCase: TestCase {
     func assertEqualTo<T: Equatable>(_ expected: T, _ actual: T, fileName: StaticString = #file, lineNumber: UInt = #line) {
         XCTAssertEqual(expected, actual, file: fileName, line: lineNumber)
     }
 }
+#else
+class EquatableTestCase: TestCase {
+    // writing value as! Int? gives "cannot downcast from 'T' to a more optional type 'Optional<Int>'"
+    // but doing this nonsense works
+    func cast<T, U>(_ value: T) -> U {
+        return value as! U
+    }
+
+    // No conditional conformance means that Optional<T: Equatable> can't
+    // itself conform to Equatable
+    func assertEqualTo<T>(_ expected: T, _ actual: T, fileName: StaticString = #file, lineNumber: UInt = #line) {
+        if T.self is Int.Type {
+            XCTAssertEqual(expected as! Int, actual as! Int, file: fileName, line: lineNumber)
+        }
+        else if T.self is Float.Type {
+            XCTAssertEqual(expected as! Float, actual as! Float, file: fileName, line: lineNumber)
+        }
+        else if T.self is Double.Type {
+            XCTAssertEqual(expected as! Double, actual as! Double, file: fileName, line: lineNumber)
+        }
+        else if T.self is Bool.Type {
+            XCTAssertEqual(expected as! Bool, actual as! Bool, file: fileName, line: lineNumber)
+        }
+        else if T.self is Int8.Type {
+            XCTAssertEqual(expected as! Int8, actual as! Int8, file: fileName, line: lineNumber)
+        }
+        else if T.self is Int16.Type {
+            XCTAssertEqual(expected as! Int16, actual as! Int16, file: fileName, line: lineNumber)
+        }
+        else if T.self is Int32.Type {
+            XCTAssertEqual(expected as! Int32, actual as! Int32, file: fileName, line: lineNumber)
+        }
+        else if T.self is Int64.Type {
+            XCTAssertEqual(expected as! Int64, actual as! Int64, file: fileName, line: lineNumber)
+        }
+        else if T.self is String.Type {
+            XCTAssertEqual(expected as! String, actual as! String, file: fileName, line: lineNumber)
+        }
+        else if T.self is Data.Type {
+            XCTAssertEqual(expected as! Data, actual as! Data, file: fileName, line: lineNumber)
+        }
+        else if T.self is Date.Type {
+            XCTAssertEqual(expected as! Date, actual as! Date, file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int].Type {
+            XCTAssertEqual(expected as! [Int], actual as! [Int], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Float].Type {
+            XCTAssertEqual(expected as! [Float], actual as! [Float], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Double].Type {
+            XCTAssertEqual(expected as! [Double], actual as! [Double], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Bool].Type {
+            XCTAssertEqual(expected as! [Bool], actual as! [Bool], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int8].Type {
+            XCTAssertEqual(expected as! [Int8], actual as! [Int8], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int16].Type {
+            XCTAssertEqual(expected as! [Int16], actual as! [Int16], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int32].Type {
+            XCTAssertEqual(expected as! [Int32], actual as! [Int32], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int64].Type {
+            XCTAssertEqual(expected as! [Int64], actual as! [Int64], file: fileName, line: lineNumber)
+        }
+        else if T.self is [String].Type {
+            XCTAssertEqual(expected as! [String], actual as! [String], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Data].Type {
+            XCTAssertEqual(expected as! [Data], actual as! [Data], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Date].Type {
+            XCTAssertEqual(expected as! [Date], actual as! [Date], file: fileName, line: lineNumber)
+        }
+        else if T.self is Int?.Type {
+            XCTAssertEqual(cast(expected) as Int?, cast(actual) as Int?, file: fileName, line: lineNumber)
+        }
+        else if T.self is Float?.Type {
+            XCTAssertEqual(cast(expected) as Float?, cast(actual) as Float?, file: fileName, line: lineNumber)
+        }
+        else if T.self is Double?.Type {
+            XCTAssertEqual(cast(expected) as Double?, cast(actual) as Double?, file: fileName, line: lineNumber)
+        }
+        else if T.self is Bool?.Type {
+            XCTAssertEqual(cast(expected) as Bool?, cast(actual) as Bool?, file: fileName, line: lineNumber)
+        }
+        else if T.self is Int8?.Type {
+            XCTAssertEqual(cast(expected) as Int8?, cast(actual) as Int8?, file: fileName, line: lineNumber)
+        }
+        else if T.self is Int16?.Type {
+            XCTAssertEqual(cast(expected) as Int16?, cast(actual) as Int16?, file: fileName, line: lineNumber)
+        }
+        else if T.self is Int32?.Type {
+            XCTAssertEqual(cast(expected) as Int32?, cast(actual) as Int32?, file: fileName, line: lineNumber)
+        }
+        else if T.self is Int64?.Type {
+            XCTAssertEqual(cast(expected) as Int64?, cast(actual) as Int64?, file: fileName, line: lineNumber)
+        }
+        else if T.self is String?.Type {
+            XCTAssertEqual(cast(expected) as String?, cast(actual) as String?, file: fileName, line: lineNumber)
+        }
+        else if T.self is Data?.Type {
+            XCTAssertEqual(cast(expected) as Data?, cast(actual) as Data?, file: fileName, line: lineNumber)
+        }
+        else if T.self is Date?.Type {
+            XCTAssertEqual(cast(expected) as Date?, cast(actual) as Date?, file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int?].Type {
+            assertEqual(cast(expected) as [Int?], cast(actual) as [Int?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Float?].Type {
+            assertEqual(cast(expected) as [Float?], cast(actual) as [Float?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Double?].Type {
+            assertEqual(cast(expected) as [Double?], cast(actual) as [Double?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Bool?].Type {
+            assertEqual(cast(expected) as [Bool?], cast(actual) as [Bool?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int8?].Type {
+            assertEqual(cast(expected) as [Int8?], cast(actual) as [Int8?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int16?].Type {
+            assertEqual(cast(expected) as [Int16?], cast(actual) as [Int16?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int32?].Type {
+            assertEqual(cast(expected) as [Int32?], cast(actual) as [Int32?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Int64?].Type {
+            assertEqual(cast(expected) as [Int64?], cast(actual) as [Int64?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [String?].Type {
+            assertEqual(cast(expected) as [String?], cast(actual) as [String?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Data?].Type {
+            assertEqual(cast(expected) as [Data?], cast(actual) as [Data?], file: fileName, line: lineNumber)
+        }
+        else if T.self is [Date?].Type {
+            assertEqual(cast(expected) as [Date?], cast(actual) as [Date?], file: fileName, line: lineNumber)
+        }
+        else {
+            XCTFail("unsupported type \(T.self)", file: fileName, line: lineNumber)
+            fatalError("unsupported type \(T.self)")
+        }
+    }
+
+    func assertEqualTo<T>(_ expected: T?, _ actual: T?, fileName: StaticString = #file, lineNumber: UInt = #line) {
+        if expected == nil {
+            XCTAssertNil(actual, file: fileName, line: lineNumber)
+        }
+        else if actual == nil {
+            XCTFail("nil")
+        }
+        else {
+            assertEqualTo(expected!, actual!, fileName: fileName, lineNumber: lineNumber)
+        }
+    }
+
+    func assertEqualTo<T>(_ expected: T, _ actual: T?) {
+        guard let actual = actual else {
+            XCTFail("nil")
+            return
+        }
+        assertEqualTo(expected, actual)
+    }
+}
+#endif
 
 class PrimitiveListTestsBase<O: ObjectFactory, V: ValueFactory>: EquatableTestCase {
     var realm: Realm?

+ 209 - 259
Carthage/Checkouts/realm-cocoa/build.sh

@@ -45,7 +45,7 @@ command:
   clean:                clean up/remove all generated files
   download-core:        downloads core library (binary version)
   download-sync:        downloads sync library (binary version, core+sync)
-  build:                builds all iOS and macOS frameworks
+  build:                builds all iOS  and macOS frameworks
   ios-static:           builds fat iOS static framework
   ios-dynamic:          builds iOS dynamic frameworks
   ios-swift:            builds RealmSwift frameworks for iOS
@@ -55,7 +55,6 @@ command:
   tvos-swift:           builds RealmSwift framework for tvOS
   osx:                  builds macOS framework
   osx-swift:            builds RealmSwift framework for macOS
-  xcframework [plats]:  builds xcframeworks for Realm and RealmSwift for given platforms
   analyze-osx:          analyzes macOS framework
   test:                 tests all iOS and macOS frameworks
   test-all:             tests all iOS and macOS frameworks in both Debug and Release configurations
@@ -152,7 +151,11 @@ build_combined() {
         destination="iPhone 8"
     elif [[ "$os" == "watchos"  ]]; then
         os_name="$os"
-        destination="Apple Watch Series 3 - 42mm"
+        if (( $(xcode_version_major) >= 10 )); then
+            destination="Apple Watch Series 3 - 42mm"
+        else
+            destination="Apple Watch - 42mm"
+        fi
     elif [[ "$os" == "appletvos"  ]]; then
         os_name="tvos"
         destination="Apple TV"
@@ -171,46 +174,58 @@ build_combined() {
     xc "-scheme '$scheme' -configuration $config -sdk $os"
     xc "-scheme '$scheme' -configuration $config -sdk $simulator -destination 'name=$destination' ONLY_ACTIVE_ARCH=NO"
 
-    # Combine .swiftmodule
-    if [ -d $simulator_path/Modules/$module_name.swiftmodule ]; then
-      cp $simulator_path/Modules/$module_name.swiftmodule/* $os_path/Modules/$module_name.swiftmodule/
-    fi
+    if (( $(xcode_version_major) < 11 )); then
+        # Combine .swiftmodule
+        if [ -d $simulator_path/Modules/$module_name.swiftmodule ]; then
+          cp $simulator_path/Modules/$module_name.swiftmodule/* $os_path/Modules/$module_name.swiftmodule/
+        fi
 
-    # Xcode 10.2 merges the generated headers together with ifdef guards for
-    # each of the target platforms. This doesn't handle merging
-    # device/simulator builds, so we need to take care of that ourselves.
-    # Currently all platforms have identical headers, so we just pick one and
-    # use that rather than merging, but this may change in the future.
-    if [ -f $os_path/Headers/$module_name-Swift.h ]; then
-      unique_headers=$(find $build_intermediates_path -name $module_name-Swift.h -exec shasum {} \; | cut -d' ' -f 1 | uniq | grep -c '^')
-      if [ $unique_headers != "1" ]; then
-        echo "Platform-specific Swift generated headers are not identical. Merging them is required and is not yet implemented."
-        exit 1
-      fi
-      find $build_intermediates_path -name $module_name-Swift.h -exec cp {} $os_path/Headers \; -quit
-    fi
+        # Xcode 10.2 merges the generated headers together with ifdef guards for
+        # each of the target platforms. This doesn't handle merging
+        # device/simulator builds, so we need to take care of that ourselves.
+        # Currently all platforms have identical headers, so we just pick one and
+        # use that rather than merging, but this may change in the future.
+        if [ -f $os_path/Headers/$module_name-Swift.h ]; then
+          unique_headers=$(find $build_intermediates_path -name $module_name-Swift.h -exec shasum {} \; | cut -d' ' -f 1 | uniq | grep -c '^')
+          if [ $unique_headers != "1" ]; then
+            echo "Platform-specific Swift generated headers are not identical. Merging them is required and is not yet implemented."
+            exit 1
+          fi
+          find $build_intermediates_path -name $module_name-Swift.h -exec cp {} $os_path/Headers \; -quit
+        fi
 
-    # Copy *.bcsymbolmap to .framework for submitting app with bitcode
-    copy_bcsymbolmap "$build_products_path/$config-$os$scope_suffix" "$os_path"
+        # Copy *.bcsymbolmap to .framework for submitting app with bitcode
+        copy_bcsymbolmap "$build_products_path/$config-$os$scope_suffix" "$os_path"
 
-    # Retrieve build products
-    clean_retrieve $os_path $out_path $product_name
+        # Retrieve build products
+        clean_retrieve $os_path $out_path $product_name
 
-    # Combine ar archives
-    LIPO_OUTPUT="$out_path/$product_name/$module_name"
-    xcrun lipo -create "$simulator_path/$binary_path" "$os_path/$binary_path" -output "$LIPO_OUTPUT"
+        # Combine ar archives
+        LIPO_OUTPUT="$out_path/$product_name/$module_name"
+        xcrun lipo -create "$simulator_path/$binary_path" "$os_path/$binary_path" -output "$LIPO_OUTPUT"
 
-    # Verify that the combined library has bitcode and we didn't accidentally
-    # remove it somewhere along the line
-    if [[ "$destination" != "" && "$config" == "Release" ]]; then
-        sh build.sh binary-has-bitcode "$LIPO_OUTPUT"
+        # Verify that the combined library has bitcode and we didn't accidentally
+        # remove it somewhere along the line
+        if [[ "$destination" != "" && "$config" == "Release" ]]; then
+            sh build.sh binary-has-bitcode "$LIPO_OUTPUT"
+        fi
+    else
+        rm -rf "$out_path/$module_name.xcframework"
+        xcodebuild -create-xcframework \
+            -framework $simulator_path \
+            -framework $os_path \
+            -output "$out_path/$module_name.xcframework"
     fi
 }
 
 copy_realm_framework() {
     local platform="$1"
-    rm -rf build/$platform/swift-$REALM_XCODE_VERSION/Realm.framework
-    cp -R build/$platform/Realm.framework build/$platform/swift-$REALM_XCODE_VERSION
+    local extension="xcframework"
+    if (( $(xcode_version_major) < 11 )); then
+        extension="framework"
+    fi
+    rm -rf build/$platform/swift-$REALM_XCODE_VERSION/Realm.$extension
+    cp -R build/$platform/Realm.$extension build/$platform/swift-$REALM_XCODE_VERSION
 }
 
 clean_retrieve() {
@@ -231,10 +246,6 @@ test_ios_static() {
     xc "-scheme 'Realm iOS static' -configuration $CONFIGURATION -sdk iphonesimulator -destination '$destination' test"
 }
 
-plist_get() {
-    /usr/libexec/PlistBuddy -c "Print :$2" $1 2> /dev/null
-}
-
 ######################################
 # Device Test Helper
 ######################################
@@ -389,13 +400,18 @@ download_sync() {
 COMMAND="$1"
 
 # Use Debug config if command ends with -debug, otherwise default to Release
+# Set IS_RUNNING_PACKAGING when running packaging steps to avoid running iOS static tests with Xcode 8.3.3
 case "$COMMAND" in
     *-debug)
         COMMAND="${COMMAND%-debug}"
         CONFIGURATION="Debug"
         ;;
+    package-*)
+        IS_RUNNING_PACKAGING=1
+        ;;
 esac
 export CONFIGURATION=${CONFIGURATION:-Release}
+export IS_RUNNING_PACKAGING=${IS_RUNNING_PACKAGING:-0}
 
 # Pre-choose Xcode and Swift versions for those operations that do not set them
 REALM_XCODE_VERSION=${xcode_version:-$REALM_XCODE_VERSION}
@@ -503,6 +519,17 @@ case "$COMMAND" in
         sh build.sh tvos-swift
         sh build.sh osx
         sh build.sh osx-swift
+
+        if (( $(xcode_version_major) >= 11 )); then
+            rm -rf "build/*.xcframework"
+            find build/DerivedData -name 'Realm.framework' \
+                | grep -v '\-static' \
+                | sed 's/.*/-framework &/' \
+                | xargs xcodebuild -create-xcframework -output build/Realm.xcframework
+            find build/DerivedData -name 'RealmSwift.framework' \
+                | sed 's/.*/-framework &/' \
+                | xargs xcodebuild -create-xcframework -output build/RealmSwift.xcframework
+        fi
         exit 0
         ;;
 
@@ -563,176 +590,6 @@ case "$COMMAND" in
         exit 0
         ;;
 
-    "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'"
-        clean_retrieve "build/DerivedData/Realm/Build/Products/$CONFIGURATION/Realm.framework" "build/catalyst" "Realm.framework"
-        ;;
-
-    "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 \
-            REALM_CATALYST_FLAGS='-target x86_64-apple-ios13.0-macabi' \
-            REALM_PLATFORM_SUFFIX='maccatalyst' \
-            SWIFT_DEPLOYMENT_TARGET='13.0-macabi' \
-            SWIFT_PLATFORM_TARGET_PREFIX='ios'"
-        destination="build/catalyst/swift-$REALM_XCODE_VERSION"
-        clean_retrieve "build/DerivedData/Realm/Build/Products/$CONFIGURATION/RealmSwift.framework" "$destination" "RealmSwift.framework"
-        rm -rf "$destination/Realm.framework"
-        cp -R build/catalyst/Realm.framework "$destination"
-        ;;
-
-    "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
-        shift
-        PLATFORMS="${*:-osx ios watchos tvos catalyst}"
-        for platform in $PLATFORMS; do
-            sh build.sh $platform-swift
-        done
-
-        # Assemble them into xcframeworks
-        rm -rf build/*.xcframework
-        find build/DerivedData/Realm/Build/Products -name 'Realm.framework' \
-            | grep -v '\-static' \
-            | sed 's/.*/-framework &/' \
-            | xargs xcodebuild -create-xcframework -output build/Realm.xcframework
-        find build/DerivedData/Realm/Build/Products -name 'RealmSwift.framework' \
-            | sed 's/.*/-framework &/' \
-            | xargs xcodebuild -create-xcframework -output build/RealmSwift.xcframework
-
-        # strip-frameworks.sh isn't needed with xcframeworks since we don't
-        # lipo together device/simulator libs
-        find build/Realm.xcframework -name 'strip-frameworks.sh' -delete
-        find build/RealmSwift.xcframework -name 'strip-frameworks.sh' -delete
-
-        # swiftinterface files currently have incorrect name resolution which
-        # results in the RealmSwift.Realm class name clashing with the Realm
-        # module name. Work around this by renaming the Realm module to
-        # RealmObjc. This is safe to do with a pre-built library because the
-        # module name is unrelated to what symbols are exported by an obj-c
-        # library, and we're statically linking the obj-c library into the
-        # swift library so it doesn't need to be loaded at runtime.
-        cd build
-        cp -R Realm.xcframework RealmObjc.xcframework
-        find RealmObjc.xcframework -name 'Realm.framework' \
-            -execdir mv {} RealmObjc.framework \; || true 2> /dev/null
-        find RealmObjc.xcframework -name '*.h' \
-            -exec sed -i '' 's/Realm\//RealmObjc\//' {} \;
-        find RealmObjc.xcframework -name 'module.modulemap' \
-            -exec sed -i '' 's/module Realm/module RealmObjc/' {} \;
-        sed -i '' 's/Realm.framework/RealmObjc.framework/' RealmObjc.xcframework/Info.plist
-
-        find RealmSwift.xcframework -name '*.swiftinterface' \
-            -exec sed -i '' 's/import Realm/import RealmObjc/' {} \;
-        find RealmSwift.xcframework -name '*.swiftinterface' \
-            -exec sed -i '' 's/Realm.RLM/RealmObjc.RLM/g' {} \;
-
-        # Realm is statically linked into RealmSwift so we no longer actually
-        # need the obj-c static library, and just need the framework shell.
-        # Remove everything but placeholder.o so that there's still a library
-        # to link against that just doesn't define any symbols.
-        find RealmObjc.xcframework -name 'Realm' | while read file; do
-            (
-                cd $(dirname $file)
-                if readlink Realm > /dev/null; then
-                    ln -sf Versions/Current/RealmObjc Realm
-                elif lipo -info Realm | grep -q 'Non-fat'; then
-                    ar -t Realm | grep -v placeholder | tr '\n' '\0' | xargs -0 ar -d Realm >/dev/null 2>&1
-                    ranlib Realm >/dev/null 2>&1
-                else
-                    for arch in $(lipo -info Realm | cut -f3 -d':'); do
-                        lipo Realm -thin $arch -output tmp.a
-                        ar -t tmp.a | grep -v placeholder | tr '\n' '\0' | xargs -0 ar -d tmp.a >/dev/null 2>&1
-                        ranlib tmp.a >/dev/null 2>&1
-                        lipo Realm -replace $arch tmp.a -output Realm
-                        rm tmp.a
-                    done
-                fi
-                mv Realm RealmObjc
-            )
-        done
-
-        # We built Realm.framework as a static framework so that we could link
-        # it into RealmSwift.framework and not have to deal with the runtime
-        # implications of renaming the shared library, but we want the end
-        # result to be that Realm.xcframework is a dynamic framework. Our build
-        # system isn't really set up to build both static and dynamic versions
-        # of it, so instead just turn each of the static libraries in
-        # Realm.xcframework into a shared library.
-        cd Realm.xcframework
-        i=0
-        while plist_get Info.plist "AvailableLibraries:$i" > /dev/null; do
-            arch_dir_name="$(plist_get Info.plist "AvailableLibraries:$i:LibraryIdentifier")"
-            platform="$(plist_get Info.plist "AvailableLibraries:$i:SupportedPlatform")"
-            variant="$(plist_get Info.plist "AvailableLibraries:$i:SupportedPlatformVariant" 2> /dev/null || echo 'os')"
-            deployment_target_name="$platform"
-            install_name='@rpath/Realm.framework/Realm'
-            bitcode_flag='-fembed-bitcode'
-            if [ "$variant" = 'simulator' ]; then
-                bitcode_flag=''
-            fi
-            case "$platform" in
-              "macos")   sdk='macosx'; install_name='@rpath/Realm.framework/Versions/A/Realm'; bitcode_flag='';;
-              "ios")     sdk="iphone$variant"; deployment_target_name='iphoneos';;
-              "watchos") sdk="watch$variant";;
-              "tvos")    sdk="appletv$variant";;
-            esac
-            deployment_target=$(grep -i "$deployment_target_name.*_DEPLOYMENT_TARGET" ../../Configuration/Base.xcconfig \
-                                | sed 's/.*= \(.*\);/\1/')
-            architectures=""
-            j=0
-            while plist_get Info.plist "AvailableLibraries:$i:SupportedArchitectures:$j" > /dev/null; do
-                architectures="${architectures} -arch $(plist_get Info.plist "AvailableLibraries:$i:SupportedArchitectures:$j")"
-                j=$(($j + 1))
-            done
-
-            (
-                cd $arch_dir_name/Realm.framework
-                realm_lib=$(readlink Realm || echo 'Realm')
-                # feature_token.cpp.o depends on PKey, which isn't actually
-                # present in the macOS build of the sync library. This normally
-                # works fine because we never reference any symbols from
-                # feature_token.cpp.o so it doesn't get pulled in at all, but
-                # -all_load makes every object file in the input get linked
-                # into the shared library.
-                ar -d $realm_lib feature_token.cpp.o 2> /dev/null || true
-                clang++ -shared $architectures \
-                    -target ${platform}${deployment_target} \
-                    -isysroot $(xcrun --sdk ${sdk} --show-sdk-path) \
-                    -install_name "$install_name" \
-                    -compatibility_version 1 -current_version 1 \
-                    -fapplication-extension \
-                    $bitcode_flag \
-                    -Wl,-all_load \
-                    -Wl,-unexported_symbol,'__Z*' \
-                    -o realm.dylib \
-                    Realm -lz
-                mv realm.dylib $realm_lib
-            )
-
-            i=$(($i + 1))
-        done
-
-        exit 0
-        ;;
-
     ######################################
     # Analysis
     ######################################
@@ -976,12 +833,8 @@ case "$COMMAND" in
 
     "verify-tvos")
         sh build.sh test-tvos
-        sh build.sh examples-tvos
-        exit 0
-        ;;
-
-    "verify-tvos-swift")
         sh build.sh test-tvos-swift
+        sh build.sh examples-tvos
         sh build.sh examples-tvos-swift
         exit 0
         ;;
@@ -997,7 +850,9 @@ case "$COMMAND" in
         ;;
 
     "verify-swiftpm")
-        sh build.sh test-swiftpm
+        if (( $(xcode_version_major) >= 10 )); then
+            sh build.sh test-swiftpm
+        fi
         exit 0
         ;;
 
@@ -1093,7 +948,8 @@ case "$COMMAND" in
     # Versioning
     ######################################
     "get-version")
-        echo "$(plist_get 'Realm/Realm-Info.plist' 'CFBundleShortVersionString')"
+        version_file="Realm/Realm-Info.plist"
+        echo "$(PlistBuddy -c "Print :CFBundleShortVersionString" "$version_file")"
         exit 0
         ;;
 
@@ -1294,11 +1150,12 @@ EOM
         zip --symlinks -r realm-examples.zip examples -x "examples/installation/*"
         ;;
 
-    "package-test-examples-objc")
+    "package-test-examples")
         if ! VERSION=$(echo realm-objc-*.zip | egrep -o '\d*\.\d*\.\d*-[a-z]*(\.\d*)?'); then
             VERSION=$(echo realm-objc-*.zip | egrep -o '\d*\.\d*\.\d*')
         fi
         OBJC="realm-objc-${VERSION}"
+        SWIFT="realm-swift-${VERSION}"
         unzip ${OBJC}.zip
 
         cp $0 ${OBJC}
@@ -1309,13 +1166,7 @@ EOM
         sh build.sh examples-osx
         cd ..
         rm -rf ${OBJC}
-        ;;
 
-    "package-test-examples-swift")
-        if ! VERSION=$(echo realm-swift-*.zip | egrep -o '\d*\.\d*\.\d*-[a-z]*(\.\d*)?'); then
-            VERSION=$(echo realm-swift-*.zip | egrep -o '\d*\.\d*\.\d*')
-        fi
-        SWIFT="realm-swift-${VERSION}"
         unzip ${SWIFT}.zip
 
         cp $0 ${SWIFT}
@@ -1335,21 +1186,79 @@ EOM
         zip --symlinks -r realm-framework-ios-static.zip Realm.framework
         ;;
 
-    "package")
-        PLATFORM="$2"
-        REALM_SWIFT_VERSION=
+    "package-ios")
+        sh build.sh prelaunch-simulator
+        sh build.sh ios-dynamic
+        cd build/ios
+        zip --symlinks -r realm-framework-ios.zip Realm.framework
+        ;;
 
-        set_xcode_and_swift_versions
+    "package-osx")
+        sh build.sh osx
 
-        if [[ "$PLATFORM" = "catalyst" ]] && (( $(xcode_version_major) < 11 )); then
-            mkdir -p build/catalyst/swift-$REALM_XCODE_VERSION
-        else
+        cd build/DerivedData/Realm/Build/Products/Release
+        zip --symlinks -r realm-framework-osx.zip Realm.framework
+        ;;
+
+    "package-watchos")
+        sh build.sh prelaunch-simulator
+        sh build.sh watchos
+
+        # If we're building the obj-c library with an Xcode version older than
+        # 10, we need to also build the arm64_32 slice with Xcode 10 and lipo
+        # it in
+        if (( $(xcode_version_major) < 10 )); then
+            (
+                REALM_XCODE_VERSION=10.0
+                REALM_SWIFT_VERSION=
+                set_xcode_and_swift_versions
+                sh build.sh prelaunch-simulator
+                xc "-scheme Realm -configuration $CONFIGURATION -sdk watchos ARCHS='arm64_32'"
+                cp build/DerivedData/Realm/Build/Products/Release-watchos/Realm.framework/*.bcsymbolmap build/watchos/Realm.framework
+                xcrun lipo \
+                  -create build/watchos/Realm.framework/Realm build/DerivedData/Realm/Build/Products/Release-watchos/Realm.framework/Realm \
+                  -output build/watchos-tmp
+                mv build/watchos-tmp build/watchos/Realm.framework/Realm
+            )
+        fi
+
+        cd build/watchos
+        zip --symlinks -r realm-framework-watchos.zip Realm.framework
+        ;;
+
+    "package-tvos")
+        sh build.sh prelaunch-simulator
+        sh build.sh tvos
+
+        cd build/tvos
+        zip --symlinks -r realm-framework-tvos.zip Realm.framework
+        ;;
+
+    package-*-swift)
+        PLATFORM=$(echo $COMMAND | cut -d - -f 2)
+        for version in 9.4 10.0 10.1 10.2.1 10.3; do
+            REALM_XCODE_VERSION=$version
+            REALM_SWIFT_VERSION=
+            set_xcode_and_swift_versions
             sh build.sh prelaunch-simulator
             sh build.sh $PLATFORM-swift
-        fi
+        done
 
         cd build/$PLATFORM
-        zip --symlinks -r realm-framework-$PLATFORM-$REALM_XCODE_VERSION.zip swift-$REALM_XCODE_VERSION
+        zip --symlinks -r realm-swift-framework-$PLATFORM.zip swift-9.4 swift-10.0 swift-10.1 swift-10.2.1 swift-10.3
+        ;;
+
+    package-*-swift-*)
+        PLATFORM=$(echo $COMMAND | cut -d - -f 2)
+        REALM_XCODE_VERSION=$(echo $COMMAND | cut -d - -f 4)
+        REALM_SWIFT_VERSION=
+
+        set_xcode_and_swift_versions
+        sh build.sh prelaunch-simulator
+        sh build.sh $PLATFORM-swift
+
+        cd build/$PLATFORM
+        zip --symlinks -r realm-swift-framework-$PLATFORM-swift-$REALM_XCODE_VERSION.zip swift-$REALM_XCODE_VERSION
         ;;
 
     "package-release")
@@ -1367,20 +1276,58 @@ EOM
             mkdir -p ${FOLDER}/ios/dynamic
             mkdir -p ${FOLDER}/Swift
 
-            unzip ${WORKSPACE}/realm-framework-ios-static.zip -d ${FOLDER}/ios/static
-            for platform in osx ios watchos tvos catalyst; do
-                unzip ${WORKSPACE}/realm-framework-${platform}-${REALM_XCODE_VERSION}.zip -d ${FOLDER}/${platform}
-                mv ${FOLDER}/${platform}/swift-*/Realm.framework ${FOLDER}/${platform}
-                rm -r ${FOLDER}/${platform}/swift-*
-            done
+            (
+                cd ${FOLDER}/osx
+                unzip ${WORKSPACE}/realm-framework-osx.zip
+            )
+
+            (
+                cd ${FOLDER}/ios/static
+                unzip ${WORKSPACE}/realm-framework-ios-static.zip
+            )
+
+            (
+                cd ${FOLDER}/ios/dynamic
+                unzip ${WORKSPACE}/realm-framework-ios.zip
+            )
+
+            (
+                cd ${FOLDER}/watchos
+                unzip ${WORKSPACE}/realm-framework-watchos.zip
+            )
 
-            mv ${FOLDER}/ios/Realm.framework ${FOLDER}/ios/dynamic
+            (
+                cd ${FOLDER}/tvos
+                unzip ${WORKSPACE}/realm-framework-tvos.zip
+            )
         else
-            for platform in osx ios watchos tvos catalyst; do
-                find ${WORKSPACE} -name "realm-framework-$platform-*.zip" \
-                                  -maxdepth 1 \
-                                  -exec unzip {} -d ${FOLDER}/${platform} \;
-            done
+            (
+                cd ${FOLDER}/osx
+                for f in ${WORKSPACE}/realm-swift-framework-osx-swift-*.zip; do
+                    unzip "$f"
+                done
+            )
+
+            (
+                cd ${FOLDER}/ios
+                for f in ${WORKSPACE}/realm-swift-framework-ios-swift-*.zip; do
+                    unzip "$f"
+                done
+            )
+
+            (
+                cd ${FOLDER}/watchos
+                for f in ${WORKSPACE}/realm-swift-framework-watchos-swift-*.zip; do
+                    unzip "$f"
+                done
+            )
+
+            (
+                cd ${FOLDER}/tvos
+                for f in ${WORKSPACE}/realm-swift-framework-tvos-swift-*.zip; do
+                    unzip "$f"
+                done
+            )
         fi
 
         (
@@ -1443,37 +1390,40 @@ EOF
 
         echo 'Packaging iOS'
         sh build.sh package-ios-static
-        cp build/ios-static/realm-framework-ios-static.zip .
-        sh build.sh package ios
-        cp build/ios/realm-framework-ios-$REALM_XCODE_VERSION.zip .
+        cp build/ios-static/realm-framework-ios-static.zip ..
+        sh build.sh package-ios
+        cp build/ios/realm-framework-ios.zip ..
+        sh build.sh package-ios-swift
+        cp build/ios/realm-swift-framework-ios.zip ..
 
         echo 'Packaging macOS'
-        sh build.sh package osx
-        cp build/osx/realm-framework-osx-$REALM_XCODE_VERSION.zip .
+        sh build.sh package-osx
+        cp build/DerivedData/Realm/Build/Products/Release/realm-framework-osx.zip ..
+        sh build.sh package-osx-swift
+        cp build/osx/realm-swift-framework-osx.zip ..
 
         echo 'Packaging watchOS'
-        sh build.sh package watchos
-        cp build/watchos/realm-framework-watchos-$REALM_XCODE_VERSION.zip .
+        sh build.sh package-watchos
+        cp build/watchos/realm-framework-watchos.zip ..
+        sh build.sh package-watchos-swift
+        cp build/watchos/realm-swift-framework-watchos.zip ..
 
         echo 'Packaging tvOS'
-        sh build.sh package tvos
-        cp build/tvos/realm-framework-tvos-$REALM_XCODE_VERSION.zip .
-
-        echo 'Packaging Catalyst'
-        sh build.sh package catalyst
-        cp build/catalyst/realm-framework-catalyst-$REALM_XCODE_VERSION.zip .
+        sh build.sh package-tvos
+        cp build/tvos/realm-framework-tvos.zip ..
+        sh build.sh package-tvos-swift
+        cp build/tvos/realm-swift-framework-tvos.zip ..
 
         echo 'Packaging examples'
         sh build.sh package-examples
+        cp realm-examples.zip ..
 
         echo 'Building final release packages'
-        export WORKSPACE="${WORKSPACE}/realm-cocoa"
         sh build.sh package-release objc
         sh build.sh package-release swift
 
         echo 'Testing packaged examples'
-        sh build.sh package-test-examples-objc
-        sh build.sh package-test-examples-swift
+        sh build.sh package-test-examples
         ;;
 
     "github-release")
@@ -1501,7 +1451,7 @@ x.y.z Release notes (yyyy-MM-dd)
 * File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
 * Realm Object Server: 3.21.0 or later.
 * APIs are backwards compatible with all previous releases in the 3.x.y series.
-* Carthage release for Swift is built with Xcode 11.0.
+* Carthage release for Swift is built with Xcode 10.3.
 EOS)
         changelog=$(cat CHANGELOG.md)
         echo "$empty_section" > CHANGELOG.md

+ 3 - 3
Carthage/Checkouts/realm-cocoa/dependencies.list

@@ -1,4 +1,4 @@
-VERSION=3.18.0
-REALM_CORE_VERSION=5.23.4
-REALM_SYNC_VERSION=4.7.5-catalyst.3
+VERSION=3.17.3
+REALM_CORE_VERSION=5.23.1
+REALM_SYNC_VERSION=4.6.3
 REALM_OBJECT_SERVER_VERSION=3.21.1

+ 1 - 13
Carthage/Checkouts/realm-cocoa/examples/installation/build.sh

@@ -12,32 +12,26 @@ command:
 
   test-ios-objc-static:            tests iOS Objective-C static example.
   test-ios-objc-dynamic:           tests iOS Objective-C dynamic example.
-  test-ios-objc-xcframework:       tests iOS Objective-C xcframework example.
   test-ios-objc-cocoapods:         tests iOS Objective-C CocoaPods example.
   test-ios-objc-cocoapods-dynamic: tests iOS Objective-C CocoaPods Dynamic example.
   test-ios-objc-carthage:          tests iOS Objective-C Carthage example.
   test-ios-swift-dynamic:          tests iOS Swift dynamic example.
-  test-ios-swift-xcframework:      tests iOS Swift xcframework example.
   test-ios-swift-cocoapods:        tests iOS Swift CocoaPods example.
   test-ios-swift-carthage:         tests iOS Swift Carthage example.
   test-ios-spm:                    tests iOS Swift Package Manager example.
 
   test-osx-objc-dynamic:           tests macOS Objective-C dynamic example.
-  test-osx-objc-xcframework:       tests macOS Objective-C xcframework example.
   test-osx-objc-cocoapods:         tests macOS Objective-C CocoaPods example.
   test-osx-objc-carthage:          tests macOS Objective-C Carthage example.
   test-osx-swift-dynamic:          tests macOS Swift dynamic example.
-  test-osx-swift-xcframework:      tests macOS Swift xcframework example.
   test-osx-swift-cocoapods:        tests macOS Swift CocoaPods example.
   test-osx-swift-carthage:         tests macOS Swift Carthage example.
   test-osx-spm:                    tests macOS Swift Package Manager example.
 
   test-watchos-objc-dynamic:       tests watchOS Objective-C dynamic example.
-  test-watchos-objc-xcframework:   tests watchOS Objective-C xcframework example.
   test-watchos-objc-cocoapods:     tests watchOS Objective-C CocoaPods example.
   test-watchos-objc-carthage:      tests watchOS Objective-C Carthage example.
   test-watchos-swift-dynamic:      tests watchOS Swift dynamic example.
-  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.
@@ -108,9 +102,7 @@ xctest() {
         xcrun simctl boot $simulator_id
         DESTINATION="-destination id=$simulator_id"
     elif [[ $PLATFORM == watchos ]]; then
-        if xcrun simctl list devicetypes | grep -q 'iPhone 11 Pro Max'; then
-            DESTINATION="-destination id=$(xcrun simctl list devices | grep -v unavailable | grep 'iPhone 11 Pro Max' | grep -m 1 -o '[0-9A-F\-]\{36\}')"
-        elif xcrun simctl list devicetypes | grep -q 'iPhone Xs'; then
+        if xcrun simctl list devicetypes | grep -q 'iPhone Xs'; then
             DESTINATION="-destination id=$(xcrun simctl list devices | grep -v unavailable | grep 'iPhone Xs' | grep -m 1 -o '[0-9A-F\-]\{36\}')"
         fi
     fi
@@ -163,10 +155,6 @@ case "$COMMAND" in
         xctest $PLATFORM $LANGUAGE DynamicExample
         ;;
 
-    test-*-*-xcframework)
-        xctest $PLATFORM $LANGUAGE XCFrameworkExample
-        ;;
-
     test-*-*-cocoapods)
         xctest $PLATFORM $LANGUAGE CocoaPodsExample
         ;;

+ 2 - 2
Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/AppDelegate.swift

@@ -26,11 +26,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
 
 #if swift(>=4.2)
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #else
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #endif

+ 1 - 0
Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/ViewController.swift

@@ -32,3 +32,4 @@ class ViewController: UIViewController {
 
 
 }
+

+ 2 - 2
Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/AppDelegate.swift

@@ -26,11 +26,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
 
 #if swift(>=4.2)
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #else
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #endif

+ 1 - 0
Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/ViewController.swift

@@ -32,3 +32,4 @@ class ViewController: UIViewController {
 
 
 }
+

+ 2 - 2
Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/AppDelegate.swift

@@ -26,11 +26,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
 
 #if swift(>=4.2)
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #else
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #endif

+ 1 - 0
Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/ViewController.swift

@@ -32,3 +32,4 @@ class ViewController: UIViewController {
 
 
 }
+

+ 1 - 0
Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/AppDelegate.swift

@@ -31,3 +31,4 @@ class AppDelegate: NSObject, NSApplicationDelegate {
         // Insert code here to tear down your application
     }
 }
+

+ 1 - 0
Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/ViewController.swift

@@ -34,3 +34,4 @@ class ViewController: NSViewController {
 
 
 }
+

+ 1 - 0
Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/AppDelegate.swift

@@ -36,3 +36,4 @@ class AppDelegate: NSObject, NSApplicationDelegate {
 
 
 }
+

+ 1 - 0
Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/ViewController.swift

@@ -34,3 +34,4 @@ class ViewController: NSViewController {
 
 
 }
+

+ 1 - 1
Carthage/Checkouts/realm-cocoa/examples/ios/swift/Backlink/AppDelegate.swift

@@ -43,7 +43,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
     var window: UIWindow?
 
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         window = UIWindow(frame: UIScreen.main.bounds)
         window?.rootViewController = UIViewController()
         window?.makeKeyAndVisible()

+ 1 - 1
Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/AppDelegate.swift

@@ -28,7 +28,7 @@ extension UIApplication {
 class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
 
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         window = UIWindow(frame: UIScreen.main.bounds)
         window?.rootViewController = ViewController()
         window?.makeKeyAndVisible()

+ 1 - 1
Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/ViewController.swift

@@ -82,7 +82,7 @@ class ViewController: UIViewController {
     }
 
     func log(text: String) {
-        textView.text += "\(text)\n\n"
+        textView.text = textView.text + text + "\n\n"
     }
 
     func getKey() -> NSData {

+ 1 - 1
Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/AppDelegate.swift

@@ -29,7 +29,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
     var window: UIWindow?
 
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         window = UIWindow(frame: UIScreen.main.bounds)
         window?.rootViewController = UINavigationController(rootViewController: TableViewController(style: .plain))
         window?.makeKeyAndVisible()

+ 1 - 1
Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/TableViewController.swift

@@ -57,7 +57,7 @@ class TableViewController: UITableViewController {
         realm = try! Realm()
 
         // Set realm notification block
-        notificationToken = realm.observe { [unowned self] _, _ in
+        notificationToken = realm.observe { [unowned self] note, realm in
             self.tableView.reloadData()
         }
         for section in sectionTitles {

+ 2 - 2
Carthage/Checkouts/realm-cocoa/examples/ios/swift/Migration/AppDelegate.swift

@@ -62,7 +62,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
     var window: UIWindow?
 
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         window = UIWindow(frame: UIScreen.main.bounds)
         window?.rootViewController = UIViewController()
         window?.makeKeyAndVisible()
@@ -93,7 +93,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
                 }
             }
             if oldSchemaVersion < 2 {
-                migration.enumerateObjects(ofType: Person.className()) { _, newObject in
+                migration.enumerateObjects(ofType: Person.className()) { oldObject, newObject in
                     // give JP a dog
                     if newObject?["fullName"] as? String == "JP McDonald" {
                         let jpsDog = migration.create(Pet.className(), value: ["Jimbo", "dog"])

+ 1 - 1
Carthage/Checkouts/realm-cocoa/examples/ios/swift/Simple/AppDelegate.swift

@@ -40,7 +40,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
     var window: UIWindow?
 
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         window = UIWindow(frame: UIScreen.main.bounds)
         window?.rootViewController = UIViewController()
         window?.makeKeyAndVisible()

+ 1 - 1
Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/AppDelegate.swift

@@ -29,7 +29,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
     var window: UIWindow?
 
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         window = UIWindow(frame: UIScreen.main.bounds)
         window?.rootViewController = UINavigationController(rootViewController: TableViewController(style: .plain))
         window?.makeKeyAndVisible()

+ 3 - 0
Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/TableViewController.swift

@@ -58,6 +58,7 @@ class TableViewController: UITableViewController {
             case .initial:
                 // Results are now populated and can be accessed without blocking the UI
                 self.tableView.reloadData()
+                break
             case .update(_, let deletions, let insertions, let modifications):
                 // Query results have changed, so apply them to the TableView
                 self.tableView.beginUpdates()
@@ -65,9 +66,11 @@ class TableViewController: UITableViewController {
                 self.tableView.deleteRows(at: deletions.map { IndexPath(row: $0, section: 0) }, with: .automatic)
                 self.tableView.reloadRows(at: modifications.map { IndexPath(row: $0, section: 0) }, with: .automatic)
                 self.tableView.endUpdates()
+                break
             case .error(let err):
                 // An error occurred while opening the Realm file on the background worker thread
                 fatalError("\(err)")
+                break
             }
         }
     }

+ 2 - 2
Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/AppDelegate.swift

@@ -23,11 +23,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
 
 #if swift(>=4.2)
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #else
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #endif

+ 5 - 5
Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/RepositoriesViewController.swift

@@ -34,7 +34,7 @@ class RepositoriesViewController: UICollectionViewController, UITextFieldDelegat
         super.viewDidLoad()
 
         let realm = try! Realm()
-        token = realm.observe { [weak self] _, _ in
+        token = realm.observe { [weak self] notification, realm in
             self?.reloadData()
         }
 
@@ -44,7 +44,7 @@ class RepositoriesViewController: UICollectionViewController, UITextFieldDelegat
             URLQueryItem(name: "sort", value: "stars"),
             URLQueryItem(name: "order", value: "desc")
         ]
-        URLSession.shared.dataTask(with: URLRequest(url: components.url!)) { data, _, error in
+        URLSession.shared.dataTask(with: URLRequest(url: components.url!)) { data, response, error in
             if let error = error {
                 print(error)
                 return
@@ -60,7 +60,7 @@ class RepositoriesViewController: UICollectionViewController, UITextFieldDelegat
                         let repository = Repository()
                         repository.identifier = String(item["id"] as! Int)
                         repository.name = item["name"] as? String
-                        repository.avatarURL = item["owner"]!["avatar_url"] as? String
+                        repository.avatarURL = item["owner"]!["avatar_url"] as? String;
 
                         realm.add(repository, update: .modified)
                     }
@@ -77,10 +77,10 @@ class RepositoriesViewController: UICollectionViewController, UITextFieldDelegat
 
     override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! RepositoryCell
-        let repository = results![indexPath.item]
+        let repository = results![indexPath.item];
         cell.titleLabel.text = repository.name
 
-        URLSession.shared.dataTask(with: URLRequest(url: URL(string: repository.avatarURL!)!)) { (data, _, error) -> Void in
+        URLSession.shared.dataTask(with: URLRequest(url: URL(string: repository.avatarURL!)!)) { (data, response, error) -> Void in
             if let error = error {
                 print(error.localizedDescription)
                 return

+ 2 - 2
Carthage/Checkouts/realm-cocoa/examples/tvos/swift/PreloadedData/AppDelegate.swift

@@ -23,11 +23,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
 
 #if swift(>=4.2)
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #else
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
         return true
     }
 #endif

+ 5 - 3
Carthage/Checkouts/realm-cocoa/scripts/generate-rlmplatform.sh

@@ -6,11 +6,13 @@ SOURCE_FILE="${SRCROOT}/Realm/RLMPlatform.h.in"
 DESTINATION_FILE="${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}/RLMPlatform.h"
 TEMPORARY_FILE="${TARGET_TEMP_DIR}/RLMPlatform.h"
 
-if [ -n "${REALM_PLATFORM_SUFFIX}" ]; then
-  PLATFORM_NAME="${REALM_PLATFORM_SUFFIX}"
+if [[ "${PLATFORM_NAME}" == "macosx" ]]; then
+  FLAG="-D"
+else
+  FLAG="-U"
 fi
 
-unifdef -B -DREALM_BUILDING_FOR_$(echo ${PLATFORM_NAME} | tr "[:lower:]" "[:upper:]") < "${SOURCE_FILE}" | sed -e "s/''/'/" > "${TEMPORARY_FILE}"
+unifdef -B "${FLAG}"REALM_BUILDING_FOR_OS_X < "${SOURCE_FILE}" | sed -e "s/''/'/" > "${TEMPORARY_FILE}"
 
 if ! cmp -s "${TEMPORARY_FILE}" "${DESTINATION_FILE}"; then
   echo "Updating ${DESTINATION_FILE}"

+ 1 - 1
Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb

@@ -41,7 +41,7 @@ base_examples = [
   "examples/tvos/swift",
 ]
 
-xcode_versions = %w(10.0 10.1 10.2.1 10.3 11.0)
+xcode_versions = %w(9.4 10.0 10.1 10.2.1 10.3)
 
 # Remove reference to Realm.xcodeproj from all example workspaces.
 base_examples.each do |example|

+ 8 - 23
Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb

@@ -1,7 +1,6 @@
 #!/usr/bin/ruby
 
 require 'json'
-require 'open3'
 
 def platform_for_runtime(runtime)
   runtime['identifier'].gsub(/com.apple.CoreSimulator.SimRuntime.([^-]+)-.*/, '\1')
@@ -18,23 +17,9 @@ def platform_for_device_type(device_type)
   end
 end
 
-def simctl(args)
-  # When running on a machine with Xcode 11 installed, Xcode 10 sometimes
-  # incorrectly thinks that it has not completed its first-run installation.
-  # This results in it printing errors related to that to stdout in front of
-  # the actual JSON output that we want.
-  Open3.popen3('xcrun simctl ' + args) do |stdin, stdout, strerr, wait_thr|
-    while line = stdout.gets
-      if not line.start_with? 'Install'
-        return line + stdout.read, wait_thr.value.exitstatus
-      end
-    end
-  end
-end
-
 def wait_for_core_simulator_service
   # Run until we get a result since switching simulator versions often causes CoreSimulatorService to throw an exception.
-  while simctl('list devices')[0].empty?
+  while `xcrun simctl list devices`.empty?
   end
 end
 
@@ -68,7 +53,7 @@ begin
   all_available_devices = []
   (0..5).each do |shutdown_attempt|
     begin
-      devices_json = simctl('list devices -j')[0]
+      devices_json = `xcrun simctl list devices -j`
       all_devices = JSON.parse(devices_json)['devices'].flat_map { |_, devices| devices }
     rescue JSON::ParserError
       sleep shutdown_attempt if shutdown_attempt > 0
@@ -93,8 +78,8 @@ begin
   puts ' done!'
 
   # Recreate all simulators.
-  runtimes = JSON.parse(simctl('list runtimes -j')[0])['runtimes']
-  device_types = JSON.parse(simctl('list devicetypes -j')[0])['devicetypes']
+  runtimes = JSON.parse(`xcrun simctl list runtimes -j`)['runtimes']
+  device_types = JSON.parse(`xcrun simctl list devicetypes -j`)['devicetypes']
 
   runtimes_by_platform = Hash.new { |hash, key| hash[key] = [] }
   runtimes.each do |runtime|
@@ -106,12 +91,12 @@ begin
   device_types.each do |device_type|
     platform = platform_for_device_type(device_type)
     runtimes_by_platform[platform].each do |runtime|
-      output, ec = simctl("create '#{device_type['name']}' '#{device_type['identifier']}' '#{runtime['identifier']}' 2>&1")
-      next if ec == 0
+      output = `xcrun simctl create '#{device_type['name']}' '#{device_type['identifier']}' '#{runtime['identifier']}' 2>&1`
+      next if $? == 0
 
-      # Error code 161-163 indicate that the given device is not supported by the runtime, such as the iPad 2 and
+      # Error code 161 and 162 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])/
+      next if output =~ /(domain=com.apple.CoreSimulator.SimError, code=16[12])/
 
       puts "Failed to create device of type #{device_type['identifier']} with runtime #{runtime['identifier']}:"
       output.each_line do |line|

+ 2 - 2
iOSClient/BrowserWeb/NCBrowserWeb.storyboard

@@ -17,7 +17,7 @@
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lht-2f-Ep4">
-                                <rect key="frame" x="10" y="54" width="30" height="30"/>
+                                <rect key="frame" x="374" y="54" width="30" height="30"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="30" id="ckh-Eb-Ze8"/>
                                     <constraint firstAttribute="width" constant="30" id="oHS-Ba-9eq"/>
@@ -30,8 +30,8 @@
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
-                            <constraint firstItem="Lht-2f-Ep4" firstAttribute="leading" secondItem="fTU-bd-6qR" secondAttribute="leading" constant="10" id="Qwe-7V-aCa"/>
                             <constraint firstItem="Lht-2f-Ep4" firstAttribute="top" secondItem="fTU-bd-6qR" secondAttribute="top" constant="10" id="Qy7-ho-gnO"/>
+                            <constraint firstItem="fTU-bd-6qR" firstAttribute="trailing" secondItem="Lht-2f-Ep4" secondAttribute="trailing" constant="10" id="brR-Ag-YH0"/>
                         </constraints>
                         <viewLayoutGuide key="safeArea" id="fTU-bd-6qR"/>
                     </view>

+ 2 - 2
iOSClient/Login/CCLogin.storyboard

@@ -197,7 +197,7 @@
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cu2-5h-AYD">
-                                <rect key="frame" x="10" y="54" width="30" height="30"/>
+                                <rect key="frame" x="374" y="54" width="30" height="30"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="30" id="YkC-Vc-Xvs"/>
                                     <constraint firstAttribute="width" constant="30" id="cFS-ia-6uF"/>
@@ -210,8 +210,8 @@
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
+                            <constraint firstItem="vqz-4v-cZu" firstAttribute="trailing" secondItem="cu2-5h-AYD" secondAttribute="trailing" constant="10" id="e12-jJ-irn"/>
                             <constraint firstItem="cu2-5h-AYD" firstAttribute="top" secondItem="vqz-4v-cZu" secondAttribute="top" constant="10" id="w2J-N0-HHq"/>
-                            <constraint firstItem="cu2-5h-AYD" firstAttribute="leading" secondItem="vqz-4v-cZu" secondAttribute="leading" constant="10" id="xs0-TU-o0W"/>
                         </constraints>
                         <viewLayoutGuide key="safeArea" id="vqz-4v-cZu"/>
                     </view>