Skip to content

Commit

Permalink
Upgrade to core 14
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed Feb 27, 2024
1 parent aea16af commit 0b875df
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 31 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ x.y.z Release notes (yyyy-MM-dd)
* None.

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-swift/issues/????), since v?.?.?)
* None.
* Sorting on binary Data was done by comparing bytes as signed char rather than unsigned char, resulting in very strange orders (since sorting on Data was enabled in v6.0.4)
* Sorting on AnyRealmValue did not use a valid total ordering, and certain combinations of values could result in values not being sorted or potentially even crashes. The resolution for this will result in some previously-valid combinations of values of different types being sorted in different orders than previously (since the introduction of AnyRealmValue in 10.8.0).
* RLMSet/MutableSet was inconsistent about if it considered a String and a Data containing the utf-8 encoded bytes of that String to be equivalent. They are now always considered distinct. (since the introduction of sets in v10.8.0).

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

Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import PackageDescription
import Foundation

let coreVersion = Version("13.26.0")
let coreVersion = Version("14.0.0")
let cocoaVersion = Version("10.47.0")

let cxxSettings: [CXXSetting] = [
Expand Down Expand Up @@ -153,7 +153,7 @@ let package = Package(
targets: ["Realm", "RealmSwift"]),
],
dependencies: [
.package(url: "https://github.com/realm/realm-core.git", exact: coreVersion)
.package(url: "https://github.com/realm/realm-core.git", revision: "c55b609f0cdcbafc7d680812f2808402c140ed65")
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion Realm/ObjectServerTests/RLMSyncTestCase.mm
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ - (RLMMongoCollection *)collectionForType:(Class)type app:(RLMApp *)app {
@end

int64_t RLMGetClientFileIdent(RLMRealm *realm) {
return realm::SyncSession::OnlyForTesting::get_file_ident(*realm->_realm->sync_session()).ident;
return realm->_realm->sync_session()->get_file_ident().ident;
}

#endif // TARGET_OS_OSX
3 changes: 1 addition & 2 deletions Realm/RLMBSON_Private.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

namespace realm::bson {
class Bson;
template <typename> class IndexedMap;
using BsonDocument = IndexedMap<Bson>;
class BsonDocument;

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

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

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | tvos_15.2 | Test - tvOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

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

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | ios-static_15.2 | Test - iOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | swiftui_15.2 | Test - iOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | tvos-static_15.2 | Test - tvOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

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

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | ios-swift_15.2 | Test - iOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | tvos-swift_15.2 | Test - tvOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | osx-swift-evolution_15.2 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | ios-swift-evolution_15.2 | Test - iOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | ios_15.2 | Test - iOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | ios-swift_14.2 | Test - iOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | sync_15.2 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | tvos-static_14.2 | Test - tvOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | watchos_15.2 | Build - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | osx_15.2 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | osx_14.2 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

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

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | tvos_14.2 | Test - tvOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | catalyst-swift_14.2 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | catalyst_15.2 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | swiftui-sync_15.2 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | tvos-swift-evolution_15.2 | Test - tvOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | ios_14.2 | Test - iOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | tvos-swift_14.2 | Test - tvOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | ios-static_14.2 | Test - iOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | sync_14.2 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | watchos_14.2 | Build - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | catalyst_14.2 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | osx-swift_14.3.1 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | osx_14.3.1 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

Xcode Cloud / RealmSwift | osx_15.1 | Test - macOS

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name

Check failure on line 24 in Realm/RLMBSON_Private.hpp

View check run for this annotation

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

Realm/RLMBSON_Private.hpp#L24

Definition of type 'BsonDocument' conflicts with type alias of the same name
}

realm::bson::Bson RLMConvertRLMBSONToBson(id<RLMBSON> b);
Expand Down
4 changes: 2 additions & 2 deletions Realm/RLMLogger.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ static RLMLogLevel logLevelForLevel(Level logLevel) {
}

struct CocoaLogger : public Logger {
void do_log(Level level, const std::string& message) override {
void do_log(const realm::util::LogCategory&, Level level, const std::string& message) override {
NSLog(@"%@: %@", levelPrefix(level), RLMStringDataToNSString(message));
}
};

class CustomLogger : public Logger {
public:
RLMLoggerFunction function;
void do_log(Level level, const std::string& message) override {
void do_log(const realm::util::LogCategory&, Level level, const std::string& message) override {
@autoreleasepool {
if (function) {
function(logLevelForLevel(level), RLMStringDataToNSString(message));
Expand Down
2 changes: 1 addition & 1 deletion Realm/RLMMongoCollection.mm
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ - (void)insertOneDocument:(NSDictionary<NSString *, id<RLMBSON>> *)document
- (void)insertManyDocuments:(NSArray<NSDictionary<NSString *, id<RLMBSON>> *> *)documents
completion:(RLMMongoInsertManyBlock)completion {
self.collection.insert_many(toBsonArray(documents),
[completion](std::vector<realm::bson::Bson> insertedIds,
[completion](realm::bson::BsonArray insertedIds,
std::optional<realm::app::AppError> error) {
if (error) {
return completion(nil, makeError(*error));
Expand Down
2 changes: 1 addition & 1 deletion Realm/RLMObservation.mm
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ void RLMClearTable(RLMClassInfo &objectSchema) {
}

NSString *name = observer->columnName(link.origin_col_key);
if (observer->getRow().get_table()->get_column_type(link.origin_col_key) != type_LinkList) {
if (!link.origin_col_key.is_list()) {
_changes.push_back({observer, name});
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion Realm/RLMQueryUtil.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ bool is_self_value_for_key_path_function_expression(NSExpression *expression)
ColumnReference collectionColumn = column_reference_from_key_path(key_path_from_string(m_schema, objectSchema, keyPath), true);
RLMPrecondition(collectionColumn.property().dictionary, @"Invalid predicate",
@"Invalid keypath '%@': only dictionaries support subscript predicates.", functionExpression);
add_mixed_constraint(operatorType, options, collectionColumn.resolve<Dictionary>().key(mapKey.UTF8String), right.constantValue);
add_mixed_constraint(operatorType, options, std::move(collectionColumn.resolve<Dictionary>().key(mapKey.UTF8String)), right.constantValue);
}

void QueryBuilder::apply_function_expression(RLMObjectSchema *objectSchema, NSExpression *functionExpression,
Expand Down
2 changes: 1 addition & 1 deletion Realm/RLMSyncConfiguration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void RLMSetConfigInfoForClientResetCallbacks(realm::SyncConfig& syncConfig, RLMR

- (id<RLMBSON>)partitionValue {
if (!_config->partition_value.empty()) {
return RLMConvertBsonToRLMBSON(realm::bson::parse(_config->partition_value.c_str()));
return RLMConvertBsonToRLMBSON(realm::bson::parse(_config->partition_value));
}
return nil;
}
Expand Down
6 changes: 3 additions & 3 deletions Realm/RLMSyncManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ RLMSyncLogLevel logLevelForLevel(Level logLevel) {
#pragma mark - Loggers

struct CocoaSyncLogger : public realm::util::Logger {
void do_log(Level, const std::string& message) override {
void do_log(const realm::util::LogCategory&, Level, const std::string& message) override {
NSLog(@"Sync: %@", RLMStringDataToNSString(message));
}
};
Expand All @@ -86,7 +86,7 @@ void do_log(Level, const std::string& message) override {

struct CallbackLogger : public realm::util::Logger {
RLMSyncLogFunction logFn;
void do_log(Level level, const std::string& message) override {
void do_log(const realm::util::LogCategory&, Level level, const std::string& message) override {
@autoreleasepool {
logFn(logLevelForLevel(level), RLMStringDataToNSString(message));
}
Expand Down Expand Up @@ -202,7 +202,7 @@ - (void)resetForTesting {
_logger = nil;
_authorizationHeaderName = nil;
_customRequestHeaders = nil;
_syncManager->reset_for_testing();
_syncManager->tear_down_for_testing();
}

- (std::shared_ptr<realm::SyncManager>)syncManager {
Expand Down
2 changes: 0 additions & 2 deletions Realm/RLMUtil.mm
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,6 @@ id RLMMixedToObjc(realm::Mixed const& mixed,
}
case realm::type_UUID:
return [[NSUUID alloc] initWithRealmUUID:mixed.get<realm::UUID>()];
case realm::type_LinkList:
REALM_UNREACHABLE();
default:
@throw RLMException(@"Invalid data type for RLMPropertyTypeAny property.");
}
Expand Down
6 changes: 2 additions & 4 deletions Realm/TestUtils/TestUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,8 @@ bool RLMHasCachedRealmForPath(NSString *path) {
std::string encoded_prefix, encoded_body;
encoded_prefix.resize(realm::util::base64_encoded_size(unencoded_prefix.size()));
encoded_body.resize(realm::util::base64_encoded_size(unencoded_body.size()));
realm::util::base64_encode(unencoded_prefix.data(), unencoded_prefix.size(),
&encoded_prefix[0], encoded_prefix.size());
realm::util::base64_encode(unencoded_body.data(), unencoded_body.size(),
&encoded_body[0], encoded_body.size());
realm::util::base64_encode(unencoded_prefix, encoded_prefix);
realm::util::base64_encode(unencoded_body, encoded_body);
std::string suffix = "Et9HFtf9R3GEMA0IICOfFMVXY7kkTX1wr4qCyhIf58U";
return encoded_prefix + "." + encoded_body + "." + suffix;
}
Expand Down
1 change: 0 additions & 1 deletion Realm/Tests/QueryTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -3739,7 +3739,6 @@ - (void)testDictionaryQueryKeySubscript {
RLMAssertCount(AllDictionariesObject, 0U, @"%K['aKey'] <[c] %@", property, values[0]);
RLMAssertCount(AllDictionariesObject, 0U, @"%K['aKey'] <[cd] %@", property, values[0]);
} else {

RLMAssertCount(AllDictionariesObject, 1U, @"%K['aKey'] = %@", property, values[0]);
RLMAssertCount(AllDictionariesObject, 2U, @"%K['aKey'] != %@", property, values[0]);
RLMAssertCount(AllDictionariesObject, 1U, @"%K['aKey'] =[c] %@", property, values[0]);
Expand Down
15 changes: 7 additions & 8 deletions RealmSwift/Tests/SectionedResultsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,6 @@ extension OptionalSectionedResultsTestData {
}

struct SectionedResultsTestDataInt: SectionedResultsTestData {

static var values: [Int] {
[5, 4, 3, 2, 1]
}
Expand Down Expand Up @@ -1557,7 +1556,7 @@ struct SectionedResultsTestDataAnyRealmValue: SectionedResultsTestData {
}

static func orderedKeys(ascending: Bool) -> [String] {
return ["alphanumeric", "data"]
return ascending ? ["alphanumeric", "data"] : ["data", "alphanumeric"]
}

static func setupObject() -> ModernAllTypesObject {
Expand Down Expand Up @@ -1604,14 +1603,14 @@ struct SectionedResultsTestDataBinary: SectionedResultsTestData {
Data(base64Encoded: "abstract")!]
}
static var expectedSectionedValues: [String: [Data]] {
["short": [Data(base64Encoded: "more")!,
Data(base64Encoded: "door")!],
["short": [Data(base64Encoded: "door")!,
Data(base64Encoded: "more")!],
"long": [Data(base64Encoded: "absolute")!,
Data(base64Encoded: "abstract")!]]
Data(base64Encoded: "abstract")!]]
}

static func orderedKeys(ascending: Bool) -> [String] {
return ["short", "long"]
ascending ? ["long", "short"] : ["short", "long"]
}

static func setupObject() -> ModernAllTypesObject {
Expand Down Expand Up @@ -1644,13 +1643,13 @@ struct SectionedResultsTestDataOptionalBinary: OptionalSectionedResultsTestData
Data(base64Encoded: "abstract")!]
}
static var expectedSectionedValuesOpt: [String?: [Data??]] {
["short": [Data(base64Encoded: "more")!, Data(base64Encoded: "door")!],
["short": [Data(base64Encoded: "door")!, Data(base64Encoded: "more")!],
"long": [Data(base64Encoded: "absolute")!, Data(base64Encoded: "abstract")!],
nil: [.some(.none)]]
}

static func orderedKeysOpt(ascending: Bool) -> [String?] {
return ascending ? [nil, "short", "long"] : ["short", "long", nil]
ascending ? [nil, "long", "short"] : ["short", "long", nil]
}

static func setupObject() -> ModernAllTypesObject {
Expand Down

0 comments on commit 0b875df

Please sign in to comment.