diff options
author | marinofaggiana <marino@marinofaggiana.com> | 2019-09-21 13:52:16 +0300 |
---|---|---|
committer | marinofaggiana <marino@marinofaggiana.com> | 2019-09-21 13:52:16 +0300 |
commit | 0f12b46e730ba640e07c53a7ee8ae7c2fdb14a4b (patch) | |
tree | 2c8e1f594e12763f37965b83c1cf389e790280a5 /Carthage | |
parent | 0d22c135f1c0945d37033e5fcee0ac6858798ae7 (diff) |
Xcode 11 - compatibility
Diffstat (limited to 'Carthage')
71 files changed, 1161 insertions, 1079 deletions
diff --git a/Carthage/Checkouts/Sheeeeeeeeet/.gitignore b/Carthage/Checkouts/Sheeeeeeeeet/.gitignore index a89a9d324..41155908a 100644 --- a/Carthage/Checkouts/Sheeeeeeeeet/.gitignore +++ b/Carthage/Checkouts/Sheeeeeeeeet/.gitignore @@ -1,9 +1,9 @@ -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -# OS X +# SPM defaults .DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ ## Build generated build/ diff --git a/Carthage/Checkouts/Sheeeeeeeeet/.swiftlint.yml b/Carthage/Checkouts/Sheeeeeeeeet/.swiftlint.yml index bd5ab0c4e..a7c638d84 100644 --- a/Carthage/Checkouts/Sheeeeeeeeet/.swiftlint.yml +++ b/Carthage/Checkouts/Sheeeeeeeeet/.swiftlint.yml @@ -13,7 +13,7 @@ disabled_rules: excluded: - Pods - - Carthage + - Packages # This is a strange one, since it also includes init functions function_parameter_count: diff --git a/Carthage/Checkouts/Sheeeeeeeeet/Fastlane/Fastfile b/Carthage/Checkouts/Sheeeeeeeeet/Fastlane/Fastfile index 9b7dc2adf..fd4ffeb99 100644 --- a/Carthage/Checkouts/Sheeeeeeeeet/Fastlane/Fastfile +++ b/Carthage/Checkouts/Sheeeeeeeeet/Fastlane/Fastfile @@ -1,43 +1,40 @@ -fastlane_version "2.30.2" +fastlane_version "2.129.0" default_platform :ios platform :ios do + # Test ======================= + + desc "Run unit tests" + lane :test do + spm(command: "test") + end + + # Version ================ desc "Create a new version" lane :version do |options| ensure_git_status_clean ensure_git_branch(branch: 'master') - test + # test TODO: This doesn't work since SPM can't find UIKit in terminal version = version_bump_podspec(path: "Sheeeeeeeeet.podspec", version_number: options[:name]) increment_version_number(version_number: version) git_commit( path: [ "Sheeeeeeeeet.podspec", - "*/Info.plist", - "*/*.pbxproj", - "Fastlane/"], + "Fastlane/" + ], message: "Bump to #{version}" ) add_git_tag(tag: version) push_git_tags() push_to_git_remote() -#pod_push() + pod_push() end - - # Test ======================= - - desc "Run unit tests" - lane :test do - scan( - project: "Sheeeeeeeeet.xcodeproj", - scheme: "Sheeeeeeeeet" - ) - end end diff --git a/Carthage/Checkouts/Sheeeeeeeeet/RELEASE_NOTES.md b/Carthage/Checkouts/Sheeeeeeeeet/RELEASE_NOTES.md index 03a21992d..9836785c1 100644 --- a/Carthage/Checkouts/Sheeeeeeeeet/RELEASE_NOTES.md +++ b/Carthage/Checkouts/Sheeeeeeeeet/RELEASE_NOTES.md @@ -1,10 +1,92 @@ # Release Notes +## 2.1.0 + +This version adds Xcode 11 and iOS 13 support, including support for dark mode and high contrast color variants. + +There is a new `ActionSheetColor` enum with sheet-specific semantic colors. It uses the new, adaptive system colors in iOS 13 and falls back to older, non-adaptive colors in iOS 12 and below. You can either use the enum directly or use the static `UIColor` extension `.sheetColor(...)`. + +The appearance model has been extended with new a appearance type, which you can use to style your sheets. There is an `ActionSheetAppearance` base class as well as a standard `StandardActionSheetAppearance` appearance which applies a standard look, including dark mode support, high contrast color variants and SFSymbol icons on iOS 13. + +There are adjustments to how sheets can be dismissed. The `isDismissableWithTapOnBackground` has been renamed to `isDismissable`, since it also affects if the system can dismiss the action sheet. + + +## 2.0.2 + +This version makes table view footer view sizes smaller to avoid a scroll offset issue that could occur when rotating devices that displayed sheets with a single custom item. + + +## 2.0.1 + +This version adjusts accessibility traits for selected select items and improves the overall accessibility experience when working with selectable items. + + +## 2.0.0 + +This version upgrades Sheeeeeeeeet and its unit test dependencies to Swift 5. It contains no breaking changes. + + +## 1.4.1 + +This version makes `currentContext` the default presentation mode for the default presenter. This is due to accessibility issues with using `keyWindow` while being ina modal presentation. I will change how the default presenteras presents action sheets, but that is a future improvement. + + +## 1.4.0 + +This version removes the old deprecated appearance model, so if your app uses it, it's time to start using the appearance proxy model. Just follow the readme, and you'll be done in no time. + +This version also change which presenter to use, so that apps behaves correct on iPads in split screen. We still have to come up with a way to switch between the default and popover presenters when the split screen size changes, but that is a future improvement. + + +## 1.3.3 + +This version adds a new `headerViewLandscapeMode` property to `ActionSheet`. You can set it to `.hidden` to let action sheets hide their header view in landscape orientation. This will free up more screen estate for the action sheet's options. + + +## 1.3.3 + +This version adds a new `headerViewLandscapeMode` property to `ActionSheet`. You can set it to `.hidden` to let action sheets hide their header view in landscape orientation. This will free up more screen estate for the action sheet's options. + + +## 1.3.2 + +This version makes the `ActionSheet` `backgroundView` outlet public, so that you can add your own custom effects to it. The other outlets are still internal. + +The version also fixes a bug that caused action sheets to be misplaced when they were presented from a custom presentation controller. This fix also adds a brand new `presentationStyle` property to `StandardActionSheetPresenter`, which can be either `keyWindow` (default) or `currentContext`. Setting it to `keyWindow` will present the action sheet in the app's key window (full screen), while setting it to `currentContext` will present it in the presenting view controller's view (it looks straaange, but perhaps you can find a nice use case for it). + + +## 1.3.1 + +This version fixes an iOS 9 bug that caused the popover to become square with no arrow. It was caused by the popover presenter, that set the background color for the popover after it had been presented, which is not supported in iOS 9. It now sets the bg color for all iOS versions before it presents the popover, then only refreshes it for iOS 10 and later. + +This version fixes another iOS 9 bug that caused the item cell separator line to behave strangely and not honor the insets set using the appearance proxy. I have added a fix to the item cell class, that only runs for iOS 9. + + +## 1.3.0 + +This version removes the last separator line from the item and button table view. + +This version also changes the default behavior of the popover presenter. It used to keep the popover presented as the device orientation changed, but this can be wrong in many cases. For instance, in collection or table views, the orientation change may cause cells to shuffle around as they are reused. If a reused cell is used as the popover source view, and the popover is still presented, the popover will point to the cell, but the cell model will have changed. In this case, your action sheet will appear to point to a specific object, but will be contextually bound to another one. + +Another way that orientation changes may mess with popovers are if a source view is removed from the view hierarchy when the orientation changes. If your popover is still presented, but the source view is removed, the popover arrow will point to a random point, e.g. the top-left part of the screen. + +To solve these bugs, I have added new orientation change handling in the popover presenter. It has a new `isListeningToOrientationChanges` property, as well as a `handleOrientationChange` and `setupOrientationChangeDetection` function. If you want to, you can override these functions to customize their behavior, otherwise just set `isListeningToOrientationChanges` to `false` to make the popover behave like before. + + +## 1.2.4 + +This version fixes the https://github.com/danielsaidi/Sheeeeeeeeet/issues/64 bug, which caused an iPad popover to become a bottom action sheet on black background, if the idiom changes from pad to phone while the action sheet is open. I now let the popover remain as long as the action sheet is open. + + +## 1.2.3 + +This version reloads data when scrolling to row to solve a bug that could happen on some iPad devices. + + ## 1.2.2 -This hotfix adds two new properties to `ActionSheetSelectItem`, that can be used -to style the selected fonts: `selectedTitleFont` and `selectedSubtitleFont`. +This hotfix adds two new properties to `ActionSheetSelectItem`, that can be used to style the selected fonts: `selectedTitleFont` and `selectedSubtitleFont`. ## 1.2.1 @@ -14,27 +96,17 @@ This hotfix fixes a font bug in the title item and color bugs in the select item ## 1.2.0 -This is a huge update, that completely rewrites how action sheet appearances are -handled. Instead of the old appearance model, Sheeeeeeeeet now relies on the iOS -appearance proxy model as much as possible. +This is a huge update, that completely rewrites how action sheet appearances are handled. Instead of the old appearance model, Sheeeeeeeeet now relies on the iOS appearance proxy model as much as possible. -The old appearance model is still around, but has been marked as deprecated, and -will be removed in `1.4.0`. Make sure that you switch over to the new appearance -model as soon as possible. Have a look at the example app and [here][Appearance] -to see how you should customize the action sheet appearance from now on. +The old appearance model is still around, but has been marked as deprecated, and will be removed in `1.4.0`. Make sure that you switch over to the new appearance model as soon as possible. Have a look at the example app and [here][Appearance] to see how you should customize the action sheet appearance from now on. In short, item appearance customizations are handled in three different ways now: -* Item appearances such as colors and fonts, are customized with cell properties, -for instance: `ActionSheetSelectItemCell.appearance().titleColor = .green`. -* Item heights are now customized by setting the `height` property of every item -type you want to customize, for instance: `ActionSheetTitle.height = 22`. -* Action sheet margins, insets etc. are now customized by setting the properties -of each `ActionSheet` instance. If you want to change the default values for all -action sheets in your app, you have to subclass `ActionSheet`. +* Item appearances such as colors and fonts, are customized with cell properties, for instance: `ActionSheetSelectItemCell.appearance().titleColor = .green`. +* Item heights are now customized by setting the `height` property of every item type you want to customize, for instance: `ActionSheetTitle.height = 22`. +* Action sheet margins, insets etc. are now customized by setting the properties of each `ActionSheet` instance. If you want to change the default values for all action sheets in your app, you have to subclass `ActionSheet`. -All built-in action sheet items now have their own cells. Your custom items only -have to use custom cells if you want to apply custom item appearances to them. +All built-in action sheet items now have their own cells. Your custom items only have to use custom cells if you want to apply custom item appearances to them. Sheeeeeeeeet now contains several new views, which are used by the action sheets: @@ -44,75 +116,54 @@ Sheeeeeeeeet now contains several new views, which are used by the action sheets * `ActionSheetBackgroundView` * `ActionSheetStackView` -The new classes make it easy to modify the appearance of these views, since they -have appearance properties as well. For instance, to change the corner radius of -the table views, just type: `ActionSheetTableView.appearance().cornerRadius = 8`. +The new classes make it easy to modify the appearance of these views, since they have appearance properties as well. For instance, to change the corner radius of the table views, just type: `ActionSheetTableView.appearance().cornerRadius = 8`. `ActionSheet` has two new extensions: * `items<T>(ofType:)` * `scrollToFirstSelectedItem(at:)` -This new version has also rebuilt all unit tests from scratch. They are now more -robust and easier to maintain. +This new version has also rebuilt all unit tests from scratch. They are now more robust and easier to maintain. ## 1.1.0 -This version increases the action sheet integrity by restricting what you can do -with it. This involves some breaking changes, but they should not affect you. If -you think any new rule is bad or affect you, please let me know. +This version increases the action sheet integrity by restricting what you can do with it. This involves some breaking changes, but they should not affect you. If you think any new rule is bad or affect you, please let me know. **New Features** -@sebbo176 has added support for subtitles in the various select items, which now -also changes the cell style of an item if the subtitle is set. He has also added -an unselected icon to the select items, which means that you can now have images -for unselected items as well (e.g. an unchecked checkbox). +@sebbo176 has added support for subtitles in the various select items, which now also changes the cell style of an item if the subtitle is set. He has also added an unselected icon to the select items, which means that you can now have images for unselected items as well (e.g. an unchecked checkbox). **Breaking Changes - ActionSheet:** -* The `items` and `buttons` properties are now `internal(set)`, which means that -they can only be set with `init(...)` or with `setup(items:)`. This protects the -integrity of the item and button separation logic. - -* The code no longer contains any `didSet` events, since these events called the -same functionality many times. Call `refresh` if you change any outlets manually -from now on. - -* Since the `didSet` events have been removed, `refreshHeaderVisibility` is only -called once and has therefore been moved into `refreshHeader`. - -* Since the `didSet` events have been removed, `refreshButtonsVisibility` is now -only called once and has therefore been moved into `refreshButtons`. - +* The `items` and `buttons` properties are now `internal(set)`, which means that they can only be set with `init(...)` or with `setup(items:)`. This protects the integrity of the item and button separation logic. +* The code no longer contains any `didSet` events, since these events called the same functionality many times. Call `refresh` if you change any outlets manually from now on. +* Since the `didSet` events have been removed, `refreshHeaderVisibility` is only called once and has therefore been moved into `refreshHeader`. +* Since the `didSet` events have been removed, `refreshButtonsVisibility` is now only called once and has therefore been moved into `refreshButtons`. * A small delay in `handleTap(on:)`, that should not be needed, has been removed. + Let me know if it causes any side-effects. ## 1.0.3 -This version removes a debug print that I used to ensure that action sheets were -properly deinitialized after being dismissed. +This version removes a debug print that I used to ensure that action sheets were properly deinitialized after being dismissed. ## 1.0.2 -This version adds new background color properties to the action sheet appearance -class. They can be used to set the background color of an entire sheet. +This version adds new background color properties to the action sheet appearance class. They can be used to set the background color of an entire sheet. -This version fixes a bug, where the background color behind an action sheet went -black when the action sheet was presented in a split view. +This version fixes a bug, where the background color behind an action sheet went black when the action sheet was presented in a split view. ## 1.0.1 -This version fixes a bug, where the presenters incorrectly updated the scrolling -behavior of the action sheet when rotating the device. +This version fixes a bug, where the presenters incorrectly updated the scrolling behavior of the action sheet when rotating the device. @@ -120,28 +171,15 @@ behavior of the action sheet when rotating the device. Sheeeeeeeeet 1.0.0 is finally here, with many internal changes and some external. -This version decouples action sheets from their presentation to great extent. An -action sheet still styles its items and components, but the presenters now takes -care of a lot more than before. The sheet setup is now also based on constraints -instead of manual calculations, which means that popover scrolling etc. works by -how the constraints are setup, instead of relying on manual calculations. +This version decouples action sheets from their presentation to great extent. An action sheet still styles its items and components, but the presenters now takes care of a lot more than before. The sheet setup is now also based on constraints instead of manual calculations, which means that popover scrolling etc. works by how the constraints are setup, instead of relying on manual calculations. -This should result in much more robust action sheets, but it requires testing on -a wide range of devices and orientations, so please let me know if there are any -issues with this approach. +This should result in much more robust action sheets, but it requires testing on a wide range of devices and orientations, so please let me know if there are any issues with this approach. -`IMPORTANT` The button item values have changed. Insted of `true` and `nil` they -now have a strong `ButtonType` value. You can still create custom buttons with a -custom value, though. You can also use the new `isOkButton` and `isCancelButton` -extensions to quickly see if a user tapped "OK" or "Cancel". +`IMPORTANT` The button item values have changed. Insted of `true` and `nil` they now have a strong `ButtonType` value. You can still create custom buttons with a custom value, though. You can also use the new `isOkButton` and `isCancelButton` extensions to quickly see if a user tapped "OK" or "Cancel". ### Breaking changes -Since the presentation logic has been rewritten from scratch, you have to adjust -your code to fit the new structure, if you have subclassed any presenter or made -presentation tweaks in your sheets. The changes are too many and extensive to be -listed here, so please have a look at the new structure. There is much less code, -so changing your code to the new standard should be easy. +Since the presentation logic has been rewritten from scratch, you have to adjust your code to fit the new structure, if you have subclassed any presenter or made presentation tweaks in your sheets. The changes are too many and extensive to be listed here, so please have a look at the new structure. There is much less code, so changing your code to the new standard should be easy. * `ActionSheetButton` and its sublasses has new values. * `ActionSheet.itemTapAction` has been removed @@ -154,30 +192,25 @@ so changing your code to the new standard should be easy. ### New features * `ActionSheetAppearance` has new properties, which adds new way to style sheets. -* `ActionSheetButton` adds `isOkButton` and `isCancelButton` extension functions -to `ActionSheetItem`. They can be used to quickly check if a cancel or ok button -was tapped, instead of having to check if the item can be cast to a button type. +* `ActionSheetButton` adds `isOkButton` and `isCancelButton` extension functions to `ActionSheetItem`. They can be used to quickly check if a cancel or ok button was tapped, instead of having to check if the item can be cast to a button type. ### Bug fixes -* The big presentation adjustments solves the scrolling issues that occured with -popovers and many items. -* The `hideSeparator()` function is adjusted to behave correctly when the device -is rotated. +* The big presentation adjustments solves the scrolling issues that occured with popovers and many items. +* The `hideSeparator()` function is adjusted to behave correctly when the device is rotated. ### Deprecated logic -Instead of deprecating presentation-related properties and functions that are no -longer used or available, I removed them completely. Let me know if you used any -properties that are no longer available. +Instead of deprecating presentation-related properties and functions that are no longer used or available, I removed them completely. Let me know if you used any properties that are no longer available. * `ActionSheetItem.setupItemsAndButtons(with:)` is renamed to `setup(items:)` * `ActionSheetItem.itemSelectAction` is renamed to `selectAction` -Perform the deprecation warnings, and you should be all good. Deprecated members -will be removed in the next minor version. +Perform the deprecation warnings, and you should be all good. Deprecated members will be removed in the next minor version. + +# Legacy versions ## 0.11.0 diff --git a/Carthage/Checkouts/Sheeeeeeeeet/Sheeeeeeeeet.podspec b/Carthage/Checkouts/Sheeeeeeeeet/Sheeeeeeeeet.podspec index f8e7363d7..18e539db8 100644 --- a/Carthage/Checkouts/Sheeeeeeeeet/Sheeeeeeeeet.podspec +++ b/Carthage/Checkouts/Sheeeeeeeeet/Sheeeeeeeeet.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'Sheeeeeeeeet' - s.version = '1.2.2' + s.version = '2.1.1' s.summary = 'Sheeeeeeeeet is a Swift library for custom iOS action sheets.' s.description = <<-DESC @@ -17,8 +17,7 @@ custom types are more specific to your app or domain. s.source = { :git => 'https://github.com/danielsaidi/Sheeeeeeeeet.git', :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/danielsaidi' + s.swift_version = '5.1' s.ios.deployment_target = '9.0' - - s.source_files = 'Sheeeeeeeeet/**/*.swift' - s.resources = 'Sheeeeeeeeet/**/*.xib' + s.source_files = 'Sources/Sheeeeeeeeet/**/*.swift' end diff --git a/Carthage/Checkouts/Sheeeeeeeeet/Sheeeeeeeeet/Info.plist b/Carthage/Checkouts/Sheeeeeeeeet/Sheeeeeeeeet/Info.plist index adace22ba..c0701a3d7 100644 --- a/Carthage/Checkouts/Sheeeeeeeeet/Sheeeeeeeeet/Info.plist +++ b/Carthage/Checkouts/Sheeeeeeeeet/Sheeeeeeeeet/Info.plist @@ -15,7 +15,7 @@ <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> - <string>1.2.2</string> + <string>$(MARKETING_VERSION)</string> <key>CFBundleVersion</key> <string>1</string> <key>NSPrincipalClass</key> diff --git a/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker.podspec b/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker.podspec index 44d7ff5eb..74e696d0d 100644 --- a/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker.podspec +++ b/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'TLPhotoPicker' - s.version = '1.9.3' + s.version = '1.9.7' s.summary = 'multiple phassets picker for iOS lib. like facebook' # This description is used to generate tags and improve search results. diff --git a/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLAssetsCollection.swift b/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLAssetsCollection.swift index c2a040dd7..8acab06bb 100644 --- a/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLAssetsCollection.swift +++ b/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLAssetsCollection.swift @@ -71,7 +71,7 @@ public struct TLPHAsset { } public func photoSize(options: PHImageRequestOptions? = nil ,completion: @escaping ((Int)->Void), livePhotoVideoSize: Bool = false) { - guard let phAsset = self.phAsset, self.type == .photo else { completion(-1); return } + guard let phAsset = self.phAsset, self.type == .photo || self.type == .livePhoto else { completion(-1); return } var resource: PHAssetResource? = nil if phAsset.mediaSubtypes.contains(.photoLive) == true, livePhotoVideoSize { resource = PHAssetResource.assetResources(for: phAsset).filter { $0.type == .pairedVideo }.first @@ -219,55 +219,57 @@ public struct TLPHAsset { } } - //Apparently, this method is not be safety to export a video. - //There is many way that export a video. - //This method was one of them. - public func exportVideoFile(options: PHVideoRequestOptions? = nil, progressBlock:((Float) -> Void)? = nil, completionBlock:@escaping ((URL,String) -> Void)) { - guard let phAsset = self.phAsset, phAsset.mediaType == .video else { return } - var type = PHAssetResourceType.video - guard let resource = (PHAssetResource.assetResources(for: phAsset).filter{ $0.type == type }).first else { return } + private func videoFilename(phAsset: PHAsset) -> URL? { + guard let resource = (PHAssetResource.assetResources(for: phAsset).filter{ $0.type == .video }).first else { + return nil + } + var writeURL: URL? let fileName = resource.originalFilename - var writeURL: URL? = nil if #available(iOS 10.0, *) { writeURL = FileManager.default.temporaryDirectory.appendingPathComponent("\(fileName)") } else { writeURL = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true).appendingPathComponent("\(fileName)") } - guard let localURL = writeURL,let mimetype = MIMEType(writeURL) else { return } + return writeURL + } + + //Apparently, This is not the only way to export video. + //There is many way that export a video. + //This method was one of them. + public func exportVideoFile(options: PHVideoRequestOptions? = nil, + outputURL: URL? = nil, + outputFileType: AVFileType = .mov, + progressBlock:((Double) -> Void)? = nil, + completionBlock:@escaping ((URL,String) -> Void)) { + guard + let phAsset = self.phAsset, + phAsset.mediaType == .video, + let writeURL = outputURL ?? videoFilename(phAsset: phAsset), + let mimetype = MIMEType(writeURL) + else { + return + } var requestOptions = PHVideoRequestOptions() if let options = options { requestOptions = options }else { requestOptions.isNetworkAccessAllowed = true } - //iCloud download progress - //options.progressHandler = { (progress, error, stop, info) in - - //} - PHImageManager.default().requestAVAsset(forVideo: phAsset, options: options) { (avasset, avaudioMix, infoDict) in - guard let avasset = avasset else { return } + requestOptions.progressHandler = { (progress, error, stop, info) in + DispatchQueue.main.async { + progressBlock?(progress) + } + } + PHImageManager.default().requestAVAsset(forVideo: phAsset, options: requestOptions) { (avasset, avaudioMix, infoDict) in + guard let avasset = avasset else { + return + } let exportSession = AVAssetExportSession.init(asset: avasset, presetName: AVAssetExportPresetHighestQuality) - exportSession?.outputURL = localURL - exportSession?.outputFileType = AVFileType.mov + exportSession?.outputURL = writeURL + exportSession?.outputFileType = outputFileType exportSession?.exportAsynchronously(completionHandler: { - completionBlock(localURL,mimetype) + completionBlock(writeURL, mimetype) }) - func checkExportSession() { - DispatchQueue.global().async { [weak exportSession] in - guard let exportSession = exportSession else { return } - switch exportSession.status { - case .waiting,.exporting: - DispatchQueue.main.async { - progressBlock?(exportSession.progress) - } - Thread.sleep(forTimeInterval: 1) - checkExportSession() - default: - break - } - } - } - checkExportSession() } } diff --git a/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLPhotoLibrary.swift b/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLPhotoLibrary.swift index 3911cf5b6..b437e2734 100644 --- a/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLPhotoLibrary.swift +++ b/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLPhotoLibrary.swift @@ -162,9 +162,13 @@ extension TLPhotoLibrary { func fetchCollection(configure: TLPhotosPickerConfigure) { let useCameraButton = configure.usedCameraButton let options = getOption(configure: configure) + let fetchCollectionOption = configure.fetchCollectionOption func getAlbum(subType: PHAssetCollectionSubtype, result: inout [TLAssetsCollection]) { - let fetchCollection = PHAssetCollection.fetchAssetCollections(with: .album, subtype: subType, options: nil) + let collectionOption = fetchCollectionOption[.assetCollections(.album)] + let fetchCollection = PHAssetCollection.fetchAssetCollections(with: .album, + subtype: subType, + options: collectionOption) var collections = [PHAssetCollection]() fetchCollection.enumerateObjects { (collection, index, _) in if configure.allowedAlbumCloudShared == false && collection.assetCollectionSubtype == .albumCloudShared { @@ -184,9 +188,19 @@ extension TLPhotoLibrary { } @discardableResult - func getSmartAlbum(subType: PHAssetCollectionSubtype, useCameraButton: Bool = false, result: inout [TLAssetsCollection]) -> TLAssetsCollection? { - let fetchCollection = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: subType, options: nil) - if let collection = fetchCollection.firstObject, !result.contains(where: { $0.localIdentifier == collection.localIdentifier }) { + func getSmartAlbum(subType: PHAssetCollectionSubtype, + useCameraButton: Bool = false, + result: inout [TLAssetsCollection]) + -> TLAssetsCollection? + { + let collectionOption = fetchCollectionOption[.assetCollections(.smartAlbum)] + let fetchCollection = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, + subtype: subType, + options: collectionOption) + if + let collection = fetchCollection.firstObject, + result.contains(where: { $0.localIdentifier == collection.localIdentifier }) == false + { var assetsCollection = TLAssetsCollection(collection: collection) assetsCollection.fetchResult = PHAsset.fetchAssets(in: collection, options: options) if assetsCollection.count > 0 || useCameraButton { @@ -196,7 +210,7 @@ extension TLPhotoLibrary { } return nil } - if let fetchCollectionTypes: [(PHAssetCollectionType,PHAssetCollectionSubtype)] = configure.fetchCollectionTypes { + if let fetchCollectionTypes = configure.fetchCollectionTypes { DispatchQueue.global(qos: .userInteractive).async { [weak self] in var assetCollections = [TLAssetsCollection]() for (type,subType) in fetchCollectionTypes { @@ -214,8 +228,11 @@ extension TLPhotoLibrary { DispatchQueue.global(qos: .userInteractive).async { [weak self] in var assetCollections = [TLAssetsCollection]() //Camera Roll - let camerarollCollection = getSmartAlbum(subType: .smartAlbumUserLibrary, useCameraButton: useCameraButton, result: &assetCollections) + let camerarollCollection = getSmartAlbum(subType: .smartAlbumUserLibrary, + useCameraButton: useCameraButton, + result: &assetCollections) if var cameraRoll = camerarollCollection { + cameraRoll.title = configure.customLoclizedTitle[cameraRoll.title] ?? cameraRoll.title cameraRoll.useCameraButton = useCameraButton assetCollections[0] = cameraRoll DispatchQueue.main.async { @@ -237,7 +254,8 @@ extension TLPhotoLibrary { getSmartAlbum(subType: .smartAlbumVideos, result: &assetCollections) } //Album - let albumsResult = PHCollectionList.fetchTopLevelUserCollections(with: nil) + let collectionOption = fetchCollectionOption[.topLevelUserCollections] + let albumsResult = PHCollectionList.fetchTopLevelUserCollections(with: collectionOption) albumsResult.enumerateObjects({ (collection, index, stop) -> Void in guard let collection = collection as? PHAssetCollection else { return } var assetsCollection = TLAssetsCollection(collection: collection) diff --git a/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift b/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift index 07b209484..5ff0cc10b 100644 --- a/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift +++ b/Carthage/Checkouts/TLPhotoPicker/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift @@ -49,9 +49,8 @@ extension TLPhotosPickerLogDelegate { func selectedAlbum(picker: TLPhotosPickerViewController, collections: [TLAssetsCollection], at: Int) { } } - public struct TLPhotosPickerConfigure { - public var defaultCameraRollTitle = "Camera Roll" + public var customLoclizedTitle: [String: String] = ["Camera Roll": "Camera Roll"] public var tapHereToChange = "Tap here to change" public var cancelTitle = "Cancel" public var doneTitle = "Done" @@ -72,6 +71,7 @@ public struct TLPhotosPickerConfigure { public var singleSelectedMode = false public var maxSelectedAssets: Int? = nil public var fetchOption: PHFetchOptions? = nil + public var fetchCollectionOption: [FetchCollectionType: PHFetchOptions] = [:] public var selectedColor = UIColor(red: 88/255, green: 144/255, blue: 255/255, alpha: 1.0) public var cameraBgColor = UIColor(red: 221/255, green: 223/255, blue: 226/255, alpha: 1) public var cameraIcon = TLBundle.podBundleImage(named: "camera") @@ -82,18 +82,40 @@ public struct TLPhotosPickerConfigure { public var fetchCollectionTypes: [(PHAssetCollectionType,PHAssetCollectionSubtype)]? = nil public var groupByFetch: PHFetchedResultGroupedBy? = nil public var supportedInterfaceOrientations: UIInterfaceOrientationMask = .portrait + public var popup: [PopupConfigure] = [] public init() { } } +public enum FetchCollectionType { + case assetCollections(PHAssetCollectionType) + case topLevelUserCollections +} -public struct Platform { +extension FetchCollectionType: Hashable { + private var identifier: String { + switch self { + case let .assetCollections(collectionType): + return "assetCollections\(collectionType.rawValue)" + case .topLevelUserCollections: + return "topLevelUserCollections" + } + } + public func hash(into hasher: inout Hasher) { + hasher.combine(self.identifier) + } +} + +public enum PopupConfigure { + case animation(TimeInterval) +} + +public struct Platform { public static var isSimulator: Bool { return TARGET_OS_SIMULATOR != 0 // Use this line in Xcode 7 or newer } - } @@ -320,7 +342,7 @@ extension TLPhotosPickerViewController { self.indicator.startAnimating() let tapGesture = UITapGestureRecognizer(target: self, action: #selector(titleTap)) self.titleView.addGestureRecognizer(tapGesture) - self.titleLabel.text = self.configure.defaultCameraRollTitle + self.titleLabel.text = self.configure.customLoclizedTitle["Camera Roll"] self.subTitleLabel.text = self.configure.tapHereToChange self.cancelButton.title = self.configure.cancelTitle self.doneButton.title = self.configure.doneTitle @@ -415,7 +437,7 @@ extension TLPhotosPickerViewController { self.focusedCollection?.fetchResult = self.photoLibrary.fetchResult(collection: collection, configure: self.configure) reloadIndexPaths.append(IndexPath(row: getfocusedIndex(), section: 0)) self.albumPopView.tableView.reloadRows(at: reloadIndexPaths, with: .none) - self.albumPopView.show(false, duration: 0.2) + self.albumPopView.show(false, duration: self.configure.popup.duration) self.updateTitle() self.reloadCollectionView() self.collectionView.contentOffset = collection.recentPosition @@ -431,7 +453,7 @@ extension TLPhotosPickerViewController { // User Action @objc func titleTap() { guard collections.count > 0 else { return } - self.albumPopView.show(self.albumPopView.isHidden) + self.albumPopView.show(self.albumPopView.isHidden, duration: self.configure.popup.duration) } @IBAction open func cancelButtonTap() { @@ -1084,3 +1106,15 @@ extension TLPhotosPickerViewController: UITableViewDelegate,UITableViewDataSourc return cell } } + +extension Array where Element == PopupConfigure { + var duration: TimeInterval { + var result: TimeInterval = 0.1 + self.compactMap{ $0 as? PopupConfigure }.forEach{ + if case let .animation(duration) = $0 { + result = duration + } + } + return result + } +} diff --git a/Carthage/Checkouts/realm-cocoa/.jenkins.yml b/Carthage/Checkouts/realm-cocoa/.jenkins.yml index 666b73245..3def02e0e 100644 --- a/Carthage/Checkouts/realm-cocoa/.jenkins.yml +++ b/Carthage/Checkouts/realm-cocoa/.jenkins.yml @@ -1,350 +1,373 @@ + # 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: - - 9.2 - - 9.3 - - 9.4 - - 10.0 - - 10.1 - - 10.2.1 -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.2 | Debug | X | | X | | | | | | | | | | | | | | | | | | -# | 9.2 | Release | X | | X | X | X | X | X | X | X | X | | | X | X | X | X | | X | | | -# | -------------------- | --- | ---- | ---------- | ----------- | --------- | --------- | ------- | ------------- | ------------- | ----------------- | --------- | ------- | ---- | -------------- | ----------------- | -------------------- | --------------------- | --------------------- | ---------------------- | ----------- | -# | 9.3 | Debug | X | | | | | | | | | | | | | | | | | | | | -# | 9.3 | Release | X | | X | X | X | X | X | X | X | X | | | X | | | | | | | | -# | -------------------- | --- | ---- | ---------- | ----------- | --------- | --------- | ------- | ------------- | ------------- | ----------------- | --------- | ------- | ---- | -------------- | ----------------- | -------------------- | --------------------- | --------------------- | ---------------------- | ----------- | -# | 9.4 | Debug | X | | | | | | | | | | | | | | | | | | | | -# | 9.4 | Release | 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 | | | X | X | X | X | | | | | | X | | | | | | | | -# | 10.2.1| Release | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | | | X | | X | -# +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +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 exclude: - ################ - # docs - ################ - # Just run on 10.2 Release - - xcode_version: 9.2 - target: docs - - xcode_version: 9.3 - target: docs - - xcode_version: 9.4 + + - xcode_version: 10.0 target: docs + configuration: Debug + - xcode_version: 10.0 target: docs + configuration: Release + - xcode_version: 10.1 target: docs - - target: docs configuration: Debug - ################ - # ios-static - ################ - # Skip Debug on everything but 9.2 - - xcode_version: 9.3 - target: ios-static + - xcode_version: 10.1 + target: docs + configuration: Release + + - xcode_version: 10.2.1 + target: docs configuration: Debug - - xcode_version: 9.4 - target: ios-static + + - 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 + configuration: Debug + - xcode_version: 10.0 - target: ios-static + target: swiftlint configuration: Debug + + - xcode_version: 10.0 + target: swiftlint + configuration: Release + - xcode_version: 10.1 - target: ios-static + target: swiftlint configuration: Debug + + - xcode_version: 10.1 + target: swiftlint + configuration: Release + - xcode_version: 10.2.1 - target: ios-static + target: swiftlint configuration: Debug - ################ - # ios-dynamic - ################ - # Skip Debug on everything but 10.2 - - xcode_version: 9.2 - target: ios-dynamic - configuration: Debug - - xcode_version: 9.3 - target: ios-dynamic + - xcode_version: 10.2.1 + target: swiftlint + configuration: Release + + - xcode_version: 10.3 + target: swiftlint configuration: Debug - - xcode_version: 9.4 - target: ios-dynamic + + - xcode_version: 10.3 + target: swiftlint + configuration: Release + + - xcode_version: 11.0 + target: swiftlint configuration: Debug + - xcode_version: 10.0 - target: ios-dynamic + target: osx-encryption configuration: Debug + - xcode_version: 10.1 - target: ios-dynamic + target: osx-encryption configuration: Debug - ################ - # ios-swift - ################ - # Skip Debug on everything but 10.2 - - xcode_version: 9.2 - target: ios-swift + - xcode_version: 10.1 + target: osx-encryption + configuration: Release + + - xcode_version: 10.2.1 + target: osx-encryption configuration: Debug - - xcode_version: 9.3 - target: ios-swift + + - xcode_version: 10.2.1 + target: osx-encryption + configuration: Release + + - xcode_version: 10.3 + target: osx-encryption configuration: Debug - - xcode_version: 9.4 - target: ios-swift + + - xcode_version: 10.3 + target: osx-encryption + configuration: Release + + - xcode_version: 11.0 + target: osx-encryption configuration: Debug + - xcode_version: 10.0 - target: ios-swift + target: osx-object-server configuration: Debug + - xcode_version: 10.1 - target: ios-swift + target: osx-object-server configuration: Debug - ################ - # osx-swift - ################ - # Skip Debug on everything but 10.2 - - xcode_version: 9.2 - target: osx-swift + - xcode_version: 10.1 + target: osx-object-server + configuration: Release + + - xcode_version: 10.2.1 + target: osx-object-server configuration: Debug - - xcode_version: 9.3 - target: osx-swift + + - xcode_version: 10.2.1 + target: osx-object-server + configuration: Release + + - xcode_version: 10.3 + target: osx-object-server configuration: Debug - - xcode_version: 9.4 - target: osx-swift + + - xcode_version: 10.3 + target: osx-object-server + configuration: Release + + - xcode_version: 11.0 + target: osx-object-server configuration: Debug + - xcode_version: 10.0 - target: osx-swift + target: ios-static configuration: Debug + - xcode_version: 10.1 - target: osx-swift + target: ios-static configuration: Debug - ################ - # watchos - ################ - # Skip Debug on everything but 10.2 - - xcode_version: 9.2 - target: watchos - configuration: Debug - - xcode_version: 9.3 - target: watchos + - xcode_version: 10.2.1 + target: ios-static configuration: Debug - - xcode_version: 9.4 - target: watchos + + - xcode_version: 10.3 + target: ios-static configuration: Debug + - xcode_version: 10.0 - target: watchos + target: ios-dynamic configuration: Debug + - xcode_version: 10.1 - target: watchos + target: ios-dynamic configuration: Debug - ################ - # cocoapods - ################ - # Skip Debug - - target: cocoapods-ios - configuration: Debug - - target: cocoapods-osx + - xcode_version: 10.2.1 + target: ios-dynamic configuration: Debug - - target: cocoapods-watchos + + - xcode_version: 10.3 + target: ios-dynamic configuration: Debug - ################ - # swiftlint - ################ - # Just run on 10.2 Release - - xcode_version: 9.2 - target: swiftlint - - xcode_version: 9.3 - target: swiftlint - - xcode_version: 9.4 - target: swiftlint - xcode_version: 10.0 - target: swiftlint + target: watchos + configuration: Debug + - xcode_version: 10.1 - target: swiftlint - - target: swiftlint + target: watchos + configuration: Debug + + - xcode_version: 10.2.1 + target: watchos + configuration: Debug + + - xcode_version: 10.3 + target: watchos configuration: Debug - ################ - # swiftpm - ################ - # Just run on 10.2 Release - - xcode_version: 9.2 - target: swiftpm - - xcode_version: 9.3 - target: swiftpm - - xcode_version: 9.4 - target: swiftpm - xcode_version: 10.0 - target: swiftpm - - xcode_version: 10.1 - target: swiftpm - - target: swiftpm + target: tvos configuration: Debug - ################ - # tvos - ################ - # Skip Debug on everything but 10.2 - - xcode_version: 9.2 + - xcode_version: 10.1 target: tvos configuration: Debug - - xcode_version: 9.3 + + - xcode_version: 10.2.1 target: tvos configuration: Debug - - xcode_version: 9.4 + + - xcode_version: 10.3 target: tvos configuration: Debug + - xcode_version: 10.0 - target: tvos + target: ios-swift configuration: Debug + - xcode_version: 10.1 - target: tvos + target: ios-swift + configuration: Debug + + - xcode_version: 10.2.1 + target: ios-swift + configuration: Debug + + - xcode_version: 10.3 + target: ios-swift configuration: Debug - ################ - # osx-encryption - ################ - # Just run on 9.2/10.2 Release - - xcode_version: 9.3 - target: osx-encryption - - xcode_version: 9.4 - target: osx-encryption - xcode_version: 10.0 - target: osx-encryption + target: osx-swift + configuration: Debug + - xcode_version: 10.1 - target: osx-encryption - - target: osx-encryption + target: osx-swift + configuration: Debug + + - xcode_version: 10.2.1 + target: osx-swift + configuration: Debug + + - xcode_version: 10.3 + target: osx-swift configuration: Debug - ################ - # osx-object-server - ################ - # Just run on 9.2/10.2 Release - - xcode_version: 9.3 - target: osx-object-server - - xcode_version: 9.4 - target: osx-object-server - xcode_version: 10.0 - target: osx-object-server + target: tvos-swift + configuration: Debug + - xcode_version: 10.1 - target: osx-object-server - - target: osx-object-server + target: tvos-swift + configuration: Debug + + - xcode_version: 10.2.1 + target: tvos-swift + configuration: Debug + + - xcode_version: 10.3 + target: tvos-swift configuration: Debug - ################ - # ios-device-objc-ios8 - ################ - # Just run on 9.2/10.2 Release - - xcode_version: 9.3 - target: ios-device-objc-ios8 - xcode_version: 10.0 - target: ios-device-objc-ios8 + target: cocoapods-osx + configuration: Debug + - xcode_version: 10.1 - target: ios-device-objc-ios8 - - target: ios-device-objc-ios8 - configuration: Debug - - ################ - # ios-device-swift-ios8 - ################ - # Just run on 9.2/10.2 Release - - xcode_version: 9.3 - target: ios-device-swift-ios8 - - xcode_version: 9.4 - target: ios-device-swift-ios8 + target: cocoapods-osx + configuration: Debug + + - 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 + configuration: Debug + - xcode_version: 10.0 - target: ios-device-swift-ios8 + target: cocoapods-ios + configuration: Debug + - xcode_version: 10.1 - target: ios-device-swift-ios8 - - target: ios-device-swift-ios8 - configuration: Debug - - ################ - # ios-device-objc-ios10 - ################ - # Just run on 9.2/10.2 Release - - xcode_version: 9.3 - target: ios-device-objc-ios10 - - xcode_version: 9.4 - target: ios-device-objc-ios10 + target: cocoapods-ios + configuration: Debug + + - 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 + configuration: Debug + - xcode_version: 10.0 - target: ios-device-objc-ios10 + target: cocoapods-watchos + configuration: Debug + - xcode_version: 10.1 - target: ios-device-objc-ios10 - - target: ios-device-objc-ios10 - configuration: Debug - - ################ - # ios-device-swift-ios10 - ################ - # Just run on 9.2/10.2 Release - - xcode_version: 9.3 - target: ios-device-swift-ios10 - - xcode_version: 9.4 - target: ios-device-swift-ios10 + target: cocoapods-watchos + configuration: Debug + + - 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 + configuration: Debug + - xcode_version: 10.0 - target: ios-device-swift-ios10 - - xcode_version: 10.1 - target: ios-device-swift-ios10 - - target: ios-device-swift-ios10 - configuration: Debug - - ################ - # tvos-device - ################ - # Just run on 10.2 Release - - xcode_version: 9.2 - target: tvos-device - - xcode_version: 9.3 - target: tvos-device - - xcode_version: 9.4 - target: tvos-device + target: swiftpm + configuration: Debug + - xcode_version: 10.0 - target: tvos-device + target: swiftpm + configuration: Release + + - xcode_version: 10.1 + target: swiftpm + configuration: Debug + - xcode_version: 10.1 - target: tvos-device - - target: tvos-device + target: swiftpm + configuration: Release + + - xcode_version: 10.2.1 + target: swiftpm + configuration: Debug + + - xcode_version: 10.2.1 + target: swiftpm + configuration: Release + + - xcode_version: 10.3 + target: swiftpm + configuration: Debug + + - xcode_version: 11.0 + target: swiftpm configuration: Debug diff --git a/Carthage/Checkouts/realm-cocoa/.swiftlint.yml b/Carthage/Checkouts/realm-cocoa/.swiftlint.yml index a842626b3..b42172ae4 100644 --- a/Carthage/Checkouts/realm-cocoa/.swiftlint.yml +++ b/Carthage/Checkouts/realm-cocoa/.swiftlint.yml @@ -2,6 +2,11 @@ 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 diff --git a/Carthage/Checkouts/realm-cocoa/CHANGELOG.md b/Carthage/Checkouts/realm-cocoa/CHANGELOG.md index d1d5c5cea..b3b76f9a9 100644 --- a/Carthage/Checkouts/realm-cocoa/CHANGELOG.md +++ b/Carthage/Checkouts/realm-cocoa/CHANGELOG.md @@ -1,3 +1,62 @@ +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) +============================================================= + +### Enhancements + +* Add Xcode 10.3 binaries to the release package. Remove the Xcode 9.2 and 9.3 binaries. + +### 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 10.3. + 3.17.1 Release notes (2019-07-10) ============================================================= diff --git a/Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig b/Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig index 823afb1d9..f4266e6b7 100644 --- a/Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig +++ b/Carthage/Checkouts/realm-cocoa/Configuration/Base.xcconfig @@ -45,7 +45,9 @@ 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; +OTHER_CFLAGS = -fvisibility-inlines-hidden $(REALM_CATALYST_FLAGS); +OTHER_LDFLAGS = $(REALM_CATALYST_FLAGS); +OTHER_SWIFT_FLAGS = $(REALM_CATALYST_FLAGS); OTHER_CPLUSPLUSFLAGS = $(inherited) -isystem core/include; HEADER_SEARCH_PATHS = $(inherited) Realm/ObjectStore/src; diff --git a/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm.xcconfig b/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm.xcconfig index 52012b203..e293c34d2 100644 --- a/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm.xcconfig +++ b/Carthage/Checkouts/realm-cocoa/Configuration/Realm/Realm.xcconfig @@ -11,7 +11,8 @@ DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = @rpath; -MACH_O_TYPE = mh_dylib; +REALM_OBJC_MACH_O_TYPE = mh_dylib; +MACH_O_TYPE = $(REALM_OBJC_MACH_O_TYPE); FRAMEWORK_VERSION = A; APPLICATION_EXTENSION_API_ONLY = YES; @@ -27,8 +28,9 @@ 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; -OTHER_LDFLAGS[sdk=macosx*] = -lrealm$(REALM_LIBRARY_SUFFIX); -OTHER_LIBTOOLFLAGS[sdk=macosx*] = -lrealm$(REALM_LIBRARY_SUFFIX); +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=iphone*] = -lrealm-ios$(REALM_LIBRARY_SUFFIX); OTHER_LIBTOOLFLAGS[sdk=iphone*] = -lrealm-ios$(REALM_LIBRARY_SUFFIX); OTHER_LDFLAGS[sdk=watch*] = -lrealm-watchos$(REALM_LIBRARY_SUFFIX); diff --git a/Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability b/Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability index 6d73b2c82..135c192b9 100644 --- a/Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability +++ b/Carthage/Checkouts/realm-cocoa/Jenkinsfile.releasability @@ -1,8 +1,10 @@ -xcodeVersions = ['9.2', '9.3', '9.4', '10.0', '10.1', '10.2.1'] -platforms = ['osx', 'ios', 'watchos', 'tvos'] -platformNames = ['osx': 'macOS', 'ios': 'iOS', 'watchos': 'watchOS', 'tvos': 'tvOS'] -carthageXcodeVersion = '10.2.1' -docsSwiftVersion = '5.0.1' +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' def installationTest(platform, test, language) { return { @@ -20,8 +22,9 @@ def installationTest(platform, test, language) { if [[ -f \$archive ]]; then mv \$archive . - unzip realm-${language}-*zip - find . -name 'realm-${language}-*' -print0 | xargs -J% mv % realm-${language}-latest + unzip realm-${language}-*.zip + rm realm-${language}-*.zip + mv realm-${language}-* realm-${language}-latest fi export REALM_XCODE_VERSION=${carthageXcodeVersion} @@ -31,20 +34,6 @@ 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') { @@ -94,14 +83,19 @@ def doBuild() { } }, - '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'), + '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" + } + } + } ] - for (def p in platforms) { + for (def p in carthagePlatforms) { def platform = p def platformName = platformNames[platform] parallelBuilds["${platformName} Carthage"] = { @@ -113,6 +107,10 @@ 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 """ @@ -127,14 +125,14 @@ def doBuild() { def platformName = platformNames[platform] for (def v in xcodeVersions) { def xcodeVersion = v - parallelBuilds["${platformName} Swift ${xcodeVersion}"] = { + parallelBuilds["${platformName} ${xcodeVersion}"] = { node('osx') { deleteDir() unstash 'source' - sh "XCMODE=xcpretty ./build.sh package-${platform}-swift-${xcodeVersion}" + sh "XCMODE=xcpretty REALM_XCODE_VERSION=${xcodeVersion} ./build.sh package ${platform}" dir("build/${platform}") { - stash includes: "realm-swift-framework-${platform}-swift-${xcodeVersion}.zip", - name: "${platform}-swift-${xcodeVersion}" + stash includes: "realm-framework-${platform}-${xcodeVersion}.zip", + name: "${platform}-${xcodeVersion}" } } } @@ -151,14 +149,19 @@ def doBuild() { deleteDir() for (def platform in platforms) { - unstash "${platform}-objc" + unstash "${platform}-${objcXcodeVersion}" } - unstash 'ios-static-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 'examples' unstash 'source' - sh './build.sh package-release objc' + sh "REALM_XCODE_VERSION=${objcXcodeVersion} ./build.sh package-release objc" stash include: 'realm-objc-*.zip', name: 'objc-packaged' archiveArtifacts artifacts: 'realm-objc-*.zip' } @@ -169,7 +172,7 @@ def doBuild() { for (def platform in platforms) { for (def xcodeVersion in xcodeVersions) { - unstash "${platform}-swift-${xcodeVersion}" + unstash "${platform}-${xcodeVersion}" } } @@ -177,7 +180,6 @@ 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' } @@ -186,7 +188,7 @@ def doBuild() { node('osx') { deleteDir() - for (def platform in platforms) { + for (def platform in carthagePlatforms) { unstash "${platform}-carthage" } @@ -206,12 +208,30 @@ def doBuild() { stage('test') { def parallelBuilds = [ - 'Test Examples': { + 'Test Obj-C 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 @@ -223,7 +243,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 + XCMODE=xcpretty sh build.sh package-test-examples-swift """ } }, @@ -233,7 +253,8 @@ def doBuild() { deleteDir() unstash 'source' - sh 'XCMODE=xcpretty IS_RUNNING_PACKAGING=1 sh build.sh test-ios-static' + sh './scripts/reset-simulators.rb' + sh 'XCMODE=xcpretty sh build.sh test-ios-static' } }, @@ -247,7 +268,7 @@ def doBuild() { } ] - for (def platform in ["osx", "ios"]) { + for (def platform in ["osx", "ios", "watchos"]) { def platformName = platformNames[platform] for (def test in ["dynamic", "cocoapods", "carthage"]) { parallelBuilds["Installation - ${platformName} Obj-C ${test}"] = installationTest(platform, test, 'objc') @@ -257,7 +278,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"]) { + for (def platform in ["osx", "ios", "watchos"]) { def platformName = platformNames[platform] for (def test in ["cocoapods", "carthage"]) { parallelBuilds["Installation - ${platformName} Swift ${test}"] = installationTest(platform, test, 'swift') diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake index 28ca6fe68..d2e18a7ac 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/RealmCore.cmake @@ -53,18 +53,6 @@ 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() @@ -73,7 +61,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(${sync_prefix}) + build_existing_realm_sync(${core_prefix} ${sync_prefix}) endif() elseif(enable_sync) # FIXME: Support building against prebuilt sync binaries. @@ -233,6 +221,7 @@ 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 @@ -240,11 +229,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 -DREALM_BUILD_LIB_ONLY=YES -G Ninja .. + && cmake -D CMAKE_BUILD_TYPE=Debug ${core_cfg_args} .. && cd .. && ${CMAKE_COMMAND} -E make_directory build.release && cd build.release - && cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -DREALM_BUILD_LIB_ONLY=YES -G Ninja .. + && cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo ${core_cfg_args} .. BUILD_COMMAND cd build.debug && cmake --build . @@ -314,57 +303,52 @@ function(build_existing_realm_core core_directory) ) endfunction() -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() +macro(build_realm_sync core_directory) + set(sync_prefix_directory "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/realm-sync") + 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 - DEPENDS realm-core - PREFIX ${cmake_files}/realm-sync + PREFIX ${sync_prefix_directory} 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) - 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() + add_dependencies(realm-sync-lib realm-core) - 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}) + 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}") 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}) @@ -374,52 +358,41 @@ macro(build_realm_sync) # 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_directory}/src) - set_property(TARGET realm-sync PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${sync_directory}/src) - - # 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}) + file(MAKE_DIRECTORY "${sync_generated_headers_dir_debug}" "${sync_generated_headers_dir_release}" "${SOURCE_DIR}/src") - ExternalProject_Add_Step(realm-sync-lib ensure-server-libraries - BYPRODUCTS ${sync_server_libraries} - DEPENDEES build - ) + 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}> + ) add_library(realm-sync-server STATIC IMPORTED) - add_dependencies(realm-sync-server realm-sync-lib) - + add_dependencies(realm realm-sync) 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 sync_directory) +function(build_existing_realm_sync core_directory sync_directory) get_filename_component(sync_directory ${sync_directory} ABSOLUTE) - build_realm_sync(URL "" - SOURCE_DIR ${sync_directory} - BUILD_ALWAYS 1 - ) + build_realm_sync( + ${core_directory} + 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}) - 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} - ) + build_realm_sync( + ${core_prefix_directory} + GIT_REPOSITORY "git@github.com:realm/realm-sync.git" + GIT_TAG ${branch} + CONFIGURE_COMMAND ${config_cmd} + ) endfunction() diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/Sanitizers.cmake b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/Sanitizers.cmake index 0b5752c03..89cea81f3 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/Sanitizers.cmake +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/CMake/Sanitizers.cmake @@ -22,14 +22,17 @@ 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) diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Dockerfile b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Dockerfile index 44f0f3f87..696c91239 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Dockerfile +++ b/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.7/cmake-3.7.2-Linux-x86_64.tar.gz \ - && tar zxvf cmake-3.7.2-Linux-x86_64.tar.gz + && 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 -ENV PATH "/opt/cmake-3.7.2-Linux-x86_64/bin:$PATH" +ENV PATH "/opt/cmake-3.15.2-Linux-x86_64/bin:$PATH" diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Jenkinsfile b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Jenkinsfile index 83c7d2695..de2feed0c 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/Jenkinsfile +++ b/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) { +def doDockerBuild(String flavor, Boolean withCoverage, Boolean enableSync, String sanitizerFlags = "") { def sync = enableSync ? "sync" : "" def label = "${flavor}${enableSync ? '-sync' : ''}" @@ -59,7 +59,7 @@ def doDockerBuild(String flavor, Boolean withCoverage, Boolean enableSync) { 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}" + sh "./workflow/build.sh ${flavor} ${sync} ${sanitizerFlags}" } } } @@ -82,7 +82,7 @@ def doAndroidDockerBuild() { sh '''rm -rf build mkdir build cd build - cmake -DREALM_PLATFORM=Android -DANDROID_NDK=/opt/android-ndk -GNinja .. + cmake -DREALM_PLATFORM=Android -DANDROID_NDK=/opt/android-ndk -GNinja -DCMAKE_MAKE_PROGRAM=ninja .. ninja adb connect emulator timeout 10m adb wait-for-device @@ -168,8 +168,10 @@ stage('prepare') { stage('unit-tests') { parallel( - linux: doDockerBuild('linux', true, false), + linux: doDockerBuild('linux', false, false), linux_sync: doDockerBuild('linux', true, true), + linux_asan: doDockerBuild('linux', false, true, '-DSANITIZE_ADDRESS=1'), + linux_tsan: doDockerBuild('linux', false, true, '-DSANITIZE_THREAD=1'), android: doAndroidDockerBuild(), macos: doBuild('osx', 'macOS', false, ''), macos_sync: doBuild('osx', 'macOS', true, ''), @@ -181,9 +183,7 @@ stage('unit-tests') { stage('publish') { node('docker') { - publishReport('linux') publishReport('linux-sync') - publishReport('macOS') publishReport('macOS-sync') } } diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list index 8468ff98d..12bb46e48 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/dependencies.list @@ -1,4 +1,4 @@ -REALM_CORE_VERSION=5.22.0 -REALM_SYNC_VERSION=4.6.1 +REALM_CORE_VERSION=5.23.2 +REALM_SYNC_VERSION=4.7.4 ANDROID_OPENSSL_VERSION=1.0.2k REALM_CORE_PACKAGING=2 diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/CMakeLists.txt b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/CMakeLists.txt index 736f7b445..3bb3adb94 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/CMakeLists.txt +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/CMakeLists.txt @@ -67,14 +67,13 @@ 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 util/fifo.cpp) + list(APPEND SOURCES impl/apple/external_commit_helper.cpp impl/apple/keychain_helper.cpp) elseif(REALM_HAVE_EPOLL) - list(APPEND SOURCES impl/epoll/external_commit_helper.cpp util/fifo.cpp) + list(APPEND SOURCES impl/epoll/external_commit_helper.cpp) elseif(CMAKE_SYSTEM_NAME MATCHES "^Windows") list(APPEND SOURCES impl/windows/external_commit_helper.cpp) else() diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/apple/external_commit_helper.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/apple/external_commit_helper.cpp index 5c4618926..fd56c9e0e 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/apple/external_commit_helper.cpp +++ b/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 = util::try_create_fifo(path); + bool fifo_created = realm::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 = util::try_create_fifo(path); + fifo_created = realm::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())); - util::create_fifo(path); + realm::util::create_fifo(path); } m_notify_fd = open(path.c_str(), O_RDWR); diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/epoll/external_commit_helper.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/epoll/external_commit_helper.cpp index fa65c3e7d..f7c904c6b 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/epoll/external_commit_helper.cpp +++ b/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 "util/fifo.hpp" +#include <realm/util/fifo_helper.hpp> #include <realm/util/assert.hpp> #include <realm/group_shared_options.hpp> diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.cpp index f16f69a7b..fb1ce4024 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.cpp +++ b/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_reset, bool validate_sync_history) +void RealmCoordinator::create_sync_session(bool force_client_resync, bool validate_sync_history) { #if REALM_ENABLE_SYNC if (m_sync_session) @@ -97,7 +97,7 @@ void RealmCoordinator::create_sync_session(bool force_client_reset, bool validat 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_reset); + m_sync_session = SyncManager::shared().get_session(m_config.path, sync_config, force_client_resync); std::weak_ptr<RealmCoordinator> weak_self = shared_from_this(); SyncSession::Internal::set_sync_transact_callback(*m_sync_session, @@ -110,7 +110,8 @@ void RealmCoordinator::create_sync_session(bool force_client_reset, bool validat } }); #else - static_cast<void>(force_client_reset); + static_cast<void>(force_client_resync); + static_cast<void>(validate_sync_history); #endif } diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.hpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.hpp index 948d040ea..2edc482cf 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/realm_coordinator.hpp +++ b/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_reset, bool validate_sync_history); + void create_sync_session(bool force_client_resync, 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); diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/shared_realm.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/shared_realm.cpp index 53c2ea3a8..a3f266558 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/shared_realm.cpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/shared_realm.cpp @@ -21,7 +21,6 @@ #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" @@ -35,6 +34,8 @@ #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" diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/realm.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/realm.cpp index c199aa04b..8a6a837cd 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/realm.cpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/realm.cpp @@ -477,16 +477,19 @@ 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); } @@ -502,12 +505,14 @@ 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); } @@ -525,12 +530,14 @@ 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); } @@ -548,10 +555,12 @@ 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 diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.cpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.cpp index 58273f4ac..29d0d3ee3 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.cpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.cpp @@ -121,7 +121,10 @@ SyncTestFile::SyncTestFile(SyncServer& server, std::string name, bool is_partial schema_mode = SchemaMode::Additive; } -sync::Server::Config TestLogger::server_config() { +SyncServer::SyncServer(StartImmediately start_immediately) +: m_server(util::make_temp_dir(), util::none, ([&] { + using namespace std::literals::chrono_literals; + sync::Server::Config config; #if TEST_ENABLE_SYNC_LOGGING auto logger = new util::StderrLogger; @@ -130,11 +133,18 @@ sync::Server::Config TestLogger::server_config() { #else config.logger = new TestLogger; #endif - return config; -} + 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(); -SyncServer::SyncServer(StartImmediately start_immediately) -: m_server(util::make_temp_dir(), util::none, TestLogger::server_config()) + return config; +})()) { #if TEST_ENABLE_SYNC_LOGGING SyncManager::shared().set_log_level(util::Logger::Level::all); @@ -184,7 +194,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, bool (SyncSession::*fn)(std::function<void(std::error_code)>)) +static void wait_for_session(Realm& realm, void (SyncSession::*fn)(std::function<void(std::error_code)>)) { std::condition_variable cv; std::mutex wait_mutex; diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp index ae5a1a6c6..463e199f4 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/tests/util/test_file.hpp @@ -82,13 +82,11 @@ 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 { +class SyncServer : private realm::sync::Clock { public: SyncServer(StartImmediately start_immediately=true); ~SyncServer(); @@ -99,10 +97,22 @@ 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 { diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/build.sh b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/build.sh index 401bac3ab..928f24304 100755 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/build.sh +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/build.sh @@ -8,12 +8,15 @@ 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 @@ -27,8 +30,8 @@ if [ "${flavor}" = "android" ]; then fi if [ "${sync}" = "sync" ]; then - cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_SERVER=1" + cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_SERVER=1 -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}" fi -cmake ${cmake_flags} .. +cmake ${cmake_flags} ${extra_flags} .. make VERBOSE=1 -j${nprocs} diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh index 7cd51f4dc..7a42e543a 100755 --- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh +++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/workflow/test_coverage.sh @@ -11,15 +11,23 @@ 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" + cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_SERVER=1 -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}" fi cmake ${cmake_flags} -DCMAKE_BUILD_TYPE=Coverage -DDEPENDENCIES_FILE="dependencies${deps_suffix}.list" .. diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.h index aa7cd41a9..b96dacbfa 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.h +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMConstants.h @@ -173,12 +173,15 @@ typedef RLM_ERROR_ENUM(NSInteger, RLMError, RLMErrorDomain) { typedef NSString * RLMNotification RLM_EXTENSIBLE_STRING_ENUM; /** - This notification is posted by a Realm when the data in that Realm has changed. + This notification is posted when a write transaction has been committed to a Realm on a different thread for + the same file. - 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. + 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. */ extern RLMNotification const RLMRealmRefreshRequiredNotification RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmRefreshRequiredNotification, RefreshRequired); diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMPlatform.h.in b/Carthage/Checkouts/realm-cocoa/Realm/RLMPlatform.h.in index 0e429241a..249173393 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMPlatform.h.in +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMPlatform.h.in @@ -16,16 +16,32 @@ // //////////////////////////////////////////////////////////////////////////// -#if REALM_BUILDING_FOR_OS_X +#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 TARGET_OS_IPHONE -#error Attempting to use Realm''s OSX framework in an iOS project. +#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 #endif -#else +#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 -#if !TARGET_OS_IPHONE -#error Attempting to use Realm''s iOS framework in an OSX project. +#ifdef REALM_BUILDING_FOR_TVOS +#if !__is_target_os(tvos) +#error Attempting to use Realm''s tvOS framework in a non-tvOS target. +#endif #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 diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncConfiguration.mm b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncConfiguration.mm index fa4829108..aaa75b30f 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncConfiguration.mm +++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncConfiguration.mm @@ -253,6 +253,7 @@ 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); diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncCredentials.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncCredentials.h index c90fb4c94..b221cc8ae 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncCredentials.h +++ b/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; +extern RLMIdentityProvider const RLMIdentityProviderNickname __deprecated_msg("Use RLMIdentityProviderUsernamePassword instead"); /** Opaque credentials representing a specific Realm Object Server user. @@ -103,7 +103,7 @@ extern RLMIdentityProvider const RLMIdentityProviderNickname; /** Construct and return credentials from a nickname */ -+ (instancetype)credentialsWithNickname:(NSString *)nickname isAdmin:(BOOL)isAdmin; ++ (instancetype)credentialsWithNickname:(NSString *)nickname isAdmin:(BOOL)isAdmin __deprecated_msg("Use +credentialsWithUsername instead"); /** Construct and return special credentials representing a token that can diff --git a/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist b/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist index 270ffda8d..2d2ca1ce2 100644 --- a/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist +++ b/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist @@ -17,11 +17,11 @@ <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> - <string>3.17.1</string> + <string>3.18.0</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>3.17.1</string> + <string>3.18.0</string> <key>NSHumanReadableCopyright</key> <string>Copyright © 2014 Realm. All rights reserved.</string> <key>NSPrincipalClass</key> diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmCollection.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmCollection.swift index c4ca1d9d3..44f83b31f 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmCollection.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmCollection.swift @@ -32,11 +32,9 @@ 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? @@ -134,7 +132,6 @@ 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 @@ -147,18 +144,6 @@ 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: @@ -185,7 +170,6 @@ 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> { @@ -196,18 +180,6 @@ 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 {} diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift index cd0aea293..35ca79f77 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/KVOTests.swift @@ -273,7 +273,6 @@ 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" } @@ -283,19 +282,14 @@ 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() { diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift index e03f88182..99c30d2dd 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ListTests.swift @@ -569,11 +569,7 @@ 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) @@ -587,9 +583,6 @@ 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) @@ -599,12 +592,11 @@ 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) diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/MigrationTests.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/MigrationTests.swift index d6ff7f1d5..095abb947 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/MigrationTests.swift +++ b/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 — 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\\}") + 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\\}") 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 — 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\\}") + 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\\}") } // refresh to update realm diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ObjectTests.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ObjectTests.swift index e40094867..32773a274 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/ObjectTests.swift +++ b/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 — 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\\}") + 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\\}") let recursiveObject = SwiftRecursiveObject() recursiveObject.objects.append(recursiveObject) diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift index a72c963cc..582107712 100644 --- a/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift +++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/Tests/PrimitiveListTests.swift @@ -16,7 +16,7 @@ // //////////////////////////////////////////////////////////////////////////// -// swiftlint:disable type_name identifier_name statement_position cyclomatic_complexity +// swiftlint:disable type_name identifier_name cyclomatic_complexity import XCTest import RealmSwift @@ -259,184 +259,11 @@ 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? diff --git a/Carthage/Checkouts/realm-cocoa/build.sh b/Carthage/Checkouts/realm-cocoa/build.sh index 931bcf7ec..6fa5542ff 100755 --- a/Carthage/Checkouts/realm-cocoa/build.sh +++ b/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,6 +55,7 @@ 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 @@ -151,11 +152,7 @@ build_combined() { destination="iPhone 8" elif [[ "$os" == "watchos" ]]; then os_name="$os" - if (( $(xcode_version_major) >= 10 )); then - destination="Apple Watch Series 3 - 42mm" - else - destination="Apple Watch - 42mm" - fi + destination="Apple Watch Series 3 - 42mm" elif [[ "$os" == "appletvos" ]]; then os_name="tvos" destination="Apple TV" @@ -174,58 +171,46 @@ build_combined() { xc "-scheme '$scheme' -configuration $config -sdk $os" xc "-scheme '$scheme' -configuration $config -sdk $simulator -destination 'name=$destination' ONLY_ACTIVE_ARCH=NO" - 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 + # 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" - fi - else - rm -rf "$out_path/$module_name.xcframework" - xcodebuild -create-xcframework \ - -framework $simulator_path \ - -framework $os_path \ - -output "$out_path/$module_name.xcframework" + # 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 } copy_realm_framework() { local platform="$1" - 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 + rm -rf build/$platform/swift-$REALM_XCODE_VERSION/Realm.framework + cp -R build/$platform/Realm.framework build/$platform/swift-$REALM_XCODE_VERSION } clean_retrieve() { @@ -246,6 +231,10 @@ 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 ###################################### @@ -400,18 +389,13 @@ 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} @@ -519,17 +503,6 @@ 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 ;; @@ -590,6 +563,176 @@ 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 ###################################### @@ -833,8 +976,12 @@ case "$COMMAND" in "verify-tvos") sh build.sh test-tvos - sh build.sh test-tvos-swift sh build.sh examples-tvos + exit 0 + ;; + + "verify-tvos-swift") + sh build.sh test-tvos-swift sh build.sh examples-tvos-swift exit 0 ;; @@ -850,9 +997,7 @@ case "$COMMAND" in ;; "verify-swiftpm") - if (( $(xcode_version_major) >= 10 )); then - sh build.sh test-swiftpm - fi + sh build.sh test-swiftpm exit 0 ;; @@ -948,8 +1093,7 @@ case "$COMMAND" in # Versioning ###################################### "get-version") - version_file="Realm/Realm-Info.plist" - echo "$(PlistBuddy -c "Print :CFBundleShortVersionString" "$version_file")" + echo "$(plist_get 'Realm/Realm-Info.plist' 'CFBundleShortVersionString')" exit 0 ;; @@ -1150,12 +1294,11 @@ EOM zip --symlinks -r realm-examples.zip examples -x "examples/installation/*" ;; - "package-test-examples") + "package-test-examples-objc") 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} @@ -1166,7 +1309,13 @@ 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} @@ -1186,79 +1335,21 @@ EOM zip --symlinks -r realm-framework-ios-static.zip Realm.framework ;; - "package-ios") - sh build.sh prelaunch-simulator - sh build.sh ios-dynamic - cd build/ios - zip --symlinks -r realm-framework-ios.zip Realm.framework - ;; - - "package-osx") - sh build.sh osx - - 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 + "package") + PLATFORM="$2" + REALM_SWIFT_VERSION= - cd build/tvos - zip --symlinks -r realm-framework-tvos.zip Realm.framework - ;; + set_xcode_and_swift_versions - package-*-swift) - PLATFORM=$(echo $COMMAND | cut -d - -f 2) - for version in 9.2 9.3 9.4 10.0 10.1 10.2.1; do - REALM_XCODE_VERSION=$version - REALM_SWIFT_VERSION= - set_xcode_and_swift_versions + if [[ "$PLATFORM" = "catalyst" ]] && (( $(xcode_version_major) < 11 )); then + mkdir -p build/catalyst/swift-$REALM_XCODE_VERSION + else sh build.sh prelaunch-simulator sh build.sh $PLATFORM-swift - done - - cd build/$PLATFORM - zip --symlinks -r realm-swift-framework-$PLATFORM.zip swift-9.2 swift-9.2 swift-9.4 swift-10.0 swift-10.1 swift-10.2.1 - ;; - - 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 + fi cd build/$PLATFORM - zip --symlinks -r realm-swift-framework-$PLATFORM-swift-$REALM_XCODE_VERSION.zip swift-$REALM_XCODE_VERSION + zip --symlinks -r realm-framework-$PLATFORM-$REALM_XCODE_VERSION.zip swift-$REALM_XCODE_VERSION ;; "package-release") @@ -1276,58 +1367,20 @@ EOM mkdir -p ${FOLDER}/ios/dynamic mkdir -p ${FOLDER}/Swift - ( - 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 - ) + 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}/tvos - unzip ${WORKSPACE}/realm-framework-tvos.zip - ) + mv ${FOLDER}/ios/Realm.framework ${FOLDER}/ios/dynamic else - ( - 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 - ) + for platform in osx ios watchos tvos catalyst; do + find ${WORKSPACE} -name "realm-framework-$platform-*.zip" \ + -maxdepth 1 \ + -exec unzip {} -d ${FOLDER}/${platform} \; + done fi ( @@ -1390,40 +1443,37 @@ 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.zip .. - sh build.sh package-ios-swift - cp build/ios/realm-swift-framework-ios.zip .. + cp build/ios-static/realm-framework-ios-static.zip . + sh build.sh package ios + cp build/ios/realm-framework-ios-$REALM_XCODE_VERSION.zip . echo 'Packaging macOS' - 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 .. + sh build.sh package osx + cp build/osx/realm-framework-osx-$REALM_XCODE_VERSION.zip . echo 'Packaging watchOS' - 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 .. + sh build.sh package watchos + cp build/watchos/realm-framework-watchos-$REALM_XCODE_VERSION.zip . echo 'Packaging tvOS' - 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 .. + 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 . 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 + sh build.sh package-test-examples-objc + sh build.sh package-test-examples-swift ;; "github-release") @@ -1451,7 +1501,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 10.2.1. +* Carthage release for Swift is built with Xcode 11.0. EOS) changelog=$(cat CHANGELOG.md) echo "$empty_section" > CHANGELOG.md diff --git a/Carthage/Checkouts/realm-cocoa/dependencies.list b/Carthage/Checkouts/realm-cocoa/dependencies.list index 619c09a57..f57839d93 100644 --- a/Carthage/Checkouts/realm-cocoa/dependencies.list +++ b/Carthage/Checkouts/realm-cocoa/dependencies.list @@ -1,4 +1,4 @@ -VERSION=3.17.1 -REALM_CORE_VERSION=5.23.1 -REALM_SYNC_VERSION=4.6.3 +VERSION=3.18.0 +REALM_CORE_VERSION=5.23.4 +REALM_SYNC_VERSION=4.7.5-catalyst.3 REALM_OBJECT_SERVER_VERSION=3.21.1 diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/build.sh b/Carthage/Checkouts/realm-cocoa/examples/installation/build.sh index b53f5b0d1..61d467c14 100755 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/build.sh +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/build.sh @@ -12,26 +12,32 @@ 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. @@ -102,7 +108,9 @@ xctest() { xcrun simctl boot $simulator_id DESTINATION="-destination id=$simulator_id" elif [[ $PLATFORM == watchos ]]; then - if xcrun simctl list devicetypes | grep -q 'iPhone Xs'; 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 DESTINATION="-destination id=$(xcrun simctl list devices | grep -v unavailable | grep 'iPhone Xs' | grep -m 1 -o '[0-9A-F\-]\{36\}')" fi fi @@ -155,6 +163,10 @@ case "$COMMAND" in xctest $PLATFORM $LANGUAGE DynamicExample ;; + test-*-*-xcframework) + xctest $PLATFORM $LANGUAGE XCFrameworkExample + ;; + test-*-*-cocoapods) xctest $PLATFORM $LANGUAGE CocoaPodsExample ;; diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/AppDelegate.swift index e617caa58..248eab498 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/AppDelegate.swift +++ b/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 diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/ViewController.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/ViewController.swift index 5fa2fc6b9..036f973ff 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/ViewController.swift +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CarthageExample/CarthageExample/ViewController.swift @@ -32,4 +32,3 @@ class ViewController: UIViewController { } - diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/AppDelegate.swift index 63fc560c8..e4c9e72d0 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/AppDelegate.swift +++ b/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 diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/ViewController.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/ViewController.swift index 5fa2fc6b9..036f973ff 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/ViewController.swift +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/CocoaPodsExample/CocoaPodsExample/ViewController.swift @@ -32,4 +32,3 @@ class ViewController: UIViewController { } - diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/AppDelegate.swift index f743e332f..9a6be1056 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/AppDelegate.swift +++ b/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 diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/ViewController.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/ViewController.swift index 5fa2fc6b9..036f973ff 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/ViewController.swift +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/ios/swift/DynamicExample/DynamicExample/ViewController.swift @@ -32,4 +32,3 @@ class ViewController: UIViewController { } - diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/AppDelegate.swift index 3053be947..3d912b8ec 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/AppDelegate.swift +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/AppDelegate.swift @@ -31,4 +31,3 @@ class AppDelegate: NSObject, NSApplicationDelegate { // Insert code here to tear down your application } } - diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/ViewController.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/ViewController.swift index 1e39fbeb2..a8715f492 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/ViewController.swift +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/CarthageExample/CarthageExample/ViewController.swift @@ -34,4 +34,3 @@ class ViewController: NSViewController { } - diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/AppDelegate.swift index 7ee34706e..888b2d2cc 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/AppDelegate.swift +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/AppDelegate.swift @@ -36,4 +36,3 @@ class AppDelegate: NSObject, NSApplicationDelegate { } - diff --git a/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/ViewController.swift b/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/ViewController.swift index 1e39fbeb2..a8715f492 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/ViewController.swift +++ b/Carthage/Checkouts/realm-cocoa/examples/installation/osx/swift/DynamicExample/DynamicExample/ViewController.swift @@ -34,4 +34,3 @@ class ViewController: NSViewController { } - diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Backlink/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Backlink/AppDelegate.swift index a87b51300..0d44e9906 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Backlink/AppDelegate.swift +++ b/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() diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/AppDelegate.swift index 8634a68a8..5788ff519 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/AppDelegate.swift +++ b/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() diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/ViewController.swift b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/ViewController.swift index b4af40cc3..7cfadebfe 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/ViewController.swift +++ b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Encryption/ViewController.swift @@ -82,7 +82,7 @@ class ViewController: UIViewController { } func log(text: String) { - textView.text = textView.text + text + "\n\n" + textView.text += "\(text)\n\n" } func getKey() -> NSData { diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/AppDelegate.swift index d56ab8c47..8de205d2b 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/AppDelegate.swift +++ b/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() diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/TableViewController.swift b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/TableViewController.swift index 8e4c6c389..44f15d757 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/GroupedTableView/TableViewController.swift +++ b/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] note, realm in + notificationToken = realm.observe { [unowned self] _, _ in self.tableView.reloadData() } for section in sectionTitles { diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Migration/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Migration/AppDelegate.swift index 950663e4d..ccaea619f 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Migration/AppDelegate.swift +++ b/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()) { oldObject, newObject in + migration.enumerateObjects(ofType: Person.className()) { _, newObject in // give JP a dog if newObject?["fullName"] as? String == "JP McDonald" { let jpsDog = migration.create(Pet.className(), value: ["Jimbo", "dog"]) diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Simple/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Simple/AppDelegate.swift index b4c9e413d..ce6eb1c4d 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/Simple/AppDelegate.swift +++ b/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() diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/AppDelegate.swift index d56ab8c47..8de205d2b 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/AppDelegate.swift +++ b/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() diff --git a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/TableViewController.swift b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/TableViewController.swift index aa28e73fa..d00306ef0 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/TableViewController.swift +++ b/Carthage/Checkouts/realm-cocoa/examples/ios/swift/TableView/TableViewController.swift @@ -58,7 +58,6 @@ 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() @@ -66,11 +65,9 @@ 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 } } } diff --git a/Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/AppDelegate.swift index 412332f85..7aefa7fe2 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/AppDelegate.swift +++ b/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 diff --git a/Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/RepositoriesViewController.swift b/Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/RepositoriesViewController.swift index 89a9eaefd..306c22cc1 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/tvos/swift/DownloadCache/RepositoriesViewController.swift +++ b/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] notification, realm in + token = realm.observe { [weak self] _, _ 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, response, error in + URLSession.shared.dataTask(with: URLRequest(url: components.url!)) { data, _, error in if let error = error { print(error) return @@ -60,9 +60,9 @@ 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: true) + realm.add(repository, update: .modified) } } } catch { @@ -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, response, error) -> Void in + URLSession.shared.dataTask(with: URLRequest(url: URL(string: repository.avatarURL!)!)) { (data, _, error) -> Void in if let error = error { print(error.localizedDescription) return diff --git a/Carthage/Checkouts/realm-cocoa/examples/tvos/swift/PreloadedData/AppDelegate.swift b/Carthage/Checkouts/realm-cocoa/examples/tvos/swift/PreloadedData/AppDelegate.swift index 412332f85..7aefa7fe2 100644 --- a/Carthage/Checkouts/realm-cocoa/examples/tvos/swift/PreloadedData/AppDelegate.swift +++ b/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 diff --git a/Carthage/Checkouts/realm-cocoa/scripts/generate-rlmplatform.sh b/Carthage/Checkouts/realm-cocoa/scripts/generate-rlmplatform.sh index ddef9f67d..9949212c5 100755 --- a/Carthage/Checkouts/realm-cocoa/scripts/generate-rlmplatform.sh +++ b/Carthage/Checkouts/realm-cocoa/scripts/generate-rlmplatform.sh @@ -6,13 +6,11 @@ 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 [[ "${PLATFORM_NAME}" == "macosx" ]]; then - FLAG="-D" -else - FLAG="-U" +if [ -n "${REALM_PLATFORM_SUFFIX}" ]; then + PLATFORM_NAME="${REALM_PLATFORM_SUFFIX}" fi -unifdef -B "${FLAG}"REALM_BUILDING_FOR_OS_X < "${SOURCE_FILE}" | sed -e "s/''/'/" > "${TEMPORARY_FILE}" +unifdef -B -DREALM_BUILDING_FOR_$(echo ${PLATFORM_NAME} | tr "[:lower:]" "[:upper:]") < "${SOURCE_FILE}" | sed -e "s/''/'/" > "${TEMPORARY_FILE}" if ! cmp -s "${TEMPORARY_FILE}" "${DESTINATION_FILE}"; then echo "Updating ${DESTINATION_FILE}" diff --git a/Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb b/Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb index 2793093c0..bf8f01949 100755 --- a/Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb +++ b/Carthage/Checkouts/realm-cocoa/scripts/package_examples.rb @@ -41,7 +41,7 @@ base_examples = [ "examples/tvos/swift", ] -xcode_versions = %w(9.2 9.3 9.4 10.0 10.1) +xcode_versions = %w(10.0 10.1 10.2.1 10.3 11.0) # Remove reference to Realm.xcodeproj from all example workspaces. base_examples.each do |example| diff --git a/Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb b/Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb index 731e7f3a2..2b1e31e2b 100755 --- a/Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb +++ b/Carthage/Checkouts/realm-cocoa/scripts/reset-simulators.rb @@ -1,6 +1,7 @@ #!/usr/bin/ruby require 'json' +require 'open3' def platform_for_runtime(runtime) runtime['identifier'].gsub(/com.apple.CoreSimulator.SimRuntime.([^-]+)-.*/, '\1') @@ -17,9 +18,23 @@ 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 `xcrun simctl list devices`.empty? + while simctl('list devices')[0].empty? end end @@ -53,7 +68,7 @@ begin all_available_devices = [] (0..5).each do |shutdown_attempt| begin - devices_json = `xcrun simctl list devices -j` + devices_json = simctl('list devices -j')[0] all_devices = JSON.parse(devices_json)['devices'].flat_map { |_, devices| devices } rescue JSON::ParserError sleep shutdown_attempt if shutdown_attempt > 0 @@ -78,8 +93,8 @@ begin puts ' done!' # Recreate all simulators. - runtimes = JSON.parse(`xcrun simctl list runtimes -j`)['runtimes'] - device_types = JSON.parse(`xcrun simctl list devicetypes -j`)['devicetypes'] + runtimes = JSON.parse(simctl('list runtimes -j')[0])['runtimes'] + device_types = JSON.parse(simctl('list devicetypes -j')[0])['devicetypes'] runtimes_by_platform = Hash.new { |hash, key| hash[key] = [] } runtimes.each do |runtime| @@ -91,12 +106,12 @@ begin device_types.each do |device_type| platform = platform_for_device_type(device_type) runtimes_by_platform[platform].each do |runtime| - output = `xcrun simctl create '#{device_type['name']}' '#{device_type['identifier']}' '#{runtime['identifier']}' 2>&1` - next if $? == 0 + output, ec = simctl("create '#{device_type['name']}' '#{device_type['identifier']}' '#{runtime['identifier']}' 2>&1") + next if ec == 0 - # Error code 161 and 162 indicate that the given device is not supported by the runtime, such as the iPad 2 and + # Error code 161-163 indicate that the given device is not supported by the runtime, such as the iPad 2 and # iPhone 4s not being supported by the iOS 10 simulator runtime. - next if output =~ /(domain=com.apple.CoreSimulator.SimError, code=16[12])/ + next if output =~ /(domain=com.apple.CoreSimulator.SimError, code=16[123])/ puts "Failed to create device of type #{device_type['identifier']} with runtime #{runtime['identifier']}:" output.each_line do |line| |