Skip to content

Commit

Permalink
Merge pull request #8598 from realm/tg/xcode-15.4
Browse files Browse the repository at this point in the history
RCOCOA-2365 Update release packaging for Xcode 15.4
  • Loading branch information
tgoyne authored May 20, 2024
2 parents a478ed8 + af67f0a commit 8cf26e0
Show file tree
Hide file tree
Showing 35 changed files with 120 additions and 151 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/master-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
- "master"
- "release/**"
env:
XCODE_VERSION: "['15.1', '15.2', '15.3']"
XCODE_TEST_VERSIONS: "['15.1', '15.2', '15.3']"
XCODE_VERSION: "['15.1', '15.2', '15.3', '15.4']"
XCODE_TEST_VERSIONS: "['15.1', '15.2', '15.3', '15.4']"
PLATFORM: "['ios', 'osx', 'watchos', 'tvos', 'catalyst', 'visionos']"
BUILD_PLATFORM: "['ios', 'iossimulator', 'osx', 'watchos', 'watchossimulator', 'tvos', 'tvossimulator', 'catalyst', 'visionos', 'visionossimulator']"
DOC_VERSION: '15.3'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish release
on: workflow_dispatch
env:
XCODE_VERSION: "['15.1', '15.2', '15.3']"
XCODE_VERSION: "['15.1', '15.2', '15.3', '15.4']"
TEST_XCODE_VERSION: '15.3'
jobs:
prepare:
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
x.y.z Release notes (yyyy-MM-dd)
=============================================================
### Enhancements
* None.
* Update release packaging for Xcode 15.4.

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-swift/issues/????), since v?.?.?)
Expand All @@ -13,9 +13,9 @@ x.y.z Release notes (yyyy-MM-dd)
### Compatibility
* Realm Studio: 15.0.0 or later.
* APIs are backwards compatible with all previous releases in the 10.x.y series.
* Carthage release for Swift is built with Xcode 15.3.0.
* Carthage release for Swift is built with Xcode 15.4.0.
* CocoaPods: 1.10 or later.
* Xcode: 15.1.0-15.3.0.
* Xcode: 15.1.0-15.4.0.

### Internal
* Upgraded realm-core from ? to ?
Expand Down
22 changes: 11 additions & 11 deletions Realm/ObjectServerTests/AsyncSyncTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class AsyncAwaitSyncTests: SwiftSyncTestCase {
try await write { realm in
let object = SwiftCustomColumnObject()
object.id = objectId
object.binaryCol = "string".data(using: String.Encoding.utf8)!
object.binaryCol = Data("string".utf8)
let linkedObject = SwiftCustomColumnObject()
linkedObject.id = linkedObjectId
object.objectCol = linkedObject
Expand All @@ -207,7 +207,7 @@ class AsyncAwaitSyncTests: SwiftSyncTestCase {
XCTAssertEqual(object.intCol, 1)
XCTAssertEqual(object.doubleCol, 1.1)
XCTAssertEqual(object.stringCol, "string")
XCTAssertEqual(object.binaryCol, "string".data(using: String.Encoding.utf8)!)
XCTAssertEqual(object.binaryCol, Data("string".utf8))
XCTAssertEqual(object.dateCol, Date(timeIntervalSince1970: -1))
XCTAssertEqual(object.longCol, 1)
XCTAssertEqual(object.decimalCol, Decimal128(1))
Expand Down Expand Up @@ -462,7 +462,7 @@ class AsyncAwaitSyncTests: SwiftSyncTestCase {
XCTAssertEqual(obj.intCol, 1)
XCTAssertEqual(obj.doubleCol, 1.1)
XCTAssertEqual(obj.stringCol, "string")
XCTAssertEqual(obj.binaryCol, "string".data(using: String.Encoding.utf8)!)
XCTAssertEqual(obj.binaryCol, Data("string".utf8))
XCTAssertEqual(obj.decimalCol, Decimal128(1))
XCTAssertEqual(obj.dateCol, Date(timeIntervalSince1970: -1))
XCTAssertEqual(obj.longCol, Int64(1))
Expand Down Expand Up @@ -1168,7 +1168,7 @@ class AsyncFlexibleSyncTests: SwiftSyncTestCase {
"intCol": 365,
"doubleCol": 365.365,
"stringCol": "@#¢∞¬÷÷",
"binaryCol": "string".data(using: String.Encoding.utf8)!,
"binaryCol": Data("string".utf8),
"dateCol": Date(timeIntervalSince1970: -365),
"longCol": 365,
"decimalCol": Decimal128(365),
Expand All @@ -1193,7 +1193,7 @@ class AsyncFlexibleSyncTests: SwiftSyncTestCase {
XCTAssertEqual(foundObject!.intCol, 365)
XCTAssertEqual(foundObject!.doubleCol, 365.365)
XCTAssertEqual(foundObject!.stringCol, "@#¢∞¬÷÷")
XCTAssertEqual(foundObject!.binaryCol, "string".data(using: String.Encoding.utf8)!)
XCTAssertEqual(foundObject!.binaryCol, Data("string".utf8))
XCTAssertEqual(foundObject!.dateCol, Date(timeIntervalSince1970: -365))
XCTAssertEqual(foundObject!.longCol, 365)
XCTAssertEqual(foundObject!.decimalCol, Decimal128(365))
Expand All @@ -1209,7 +1209,7 @@ class AsyncFlexibleSyncTests: SwiftSyncTestCase {
try await write { realm in
let object = SwiftCustomColumnObject()
object.id = objectId
object.binaryCol = "string".data(using: String.Encoding.utf8)!
object.binaryCol = Data("string".utf8)
let linkedObject = SwiftCustomColumnObject()
linkedObject.id = linkedObjectId
object.objectCol = linkedObject
Expand All @@ -1232,7 +1232,7 @@ class AsyncFlexibleSyncTests: SwiftSyncTestCase {
XCTAssertEqual(foundObject!.intCol, 1)
XCTAssertEqual(foundObject!.doubleCol, 1.1)
XCTAssertEqual(foundObject!.stringCol, "string")
XCTAssertEqual(foundObject!.binaryCol, "string".data(using: String.Encoding.utf8)!)
XCTAssertEqual(foundObject!.binaryCol, Data("string".utf8))
XCTAssertEqual(foundObject!.dateCol, Date(timeIntervalSince1970: -1))
XCTAssertEqual(foundObject!.longCol, 1)
XCTAssertEqual(foundObject!.decimalCol, Decimal128(1))
Expand All @@ -1248,7 +1248,7 @@ class AsyncFlexibleSyncTests: SwiftSyncTestCase {
try await write { realm in
let object = SwiftCustomColumnObject()
object.id = objectId
object.binaryCol = "string".data(using: String.Encoding.utf8)!
object.binaryCol = Data("string".utf8)
let linkedObject = SwiftCustomColumnObject()
linkedObject.id = linkedObjectId
object.objectCol = linkedObject
Expand All @@ -1271,7 +1271,7 @@ class AsyncFlexibleSyncTests: SwiftSyncTestCase {
XCTAssertEqual(foundObject!.intCol, 1)
XCTAssertEqual(foundObject!.doubleCol, 1.1)
XCTAssertEqual(foundObject!.stringCol, "string")
XCTAssertEqual(foundObject!.binaryCol, "string".data(using: String.Encoding.utf8)!)
XCTAssertEqual(foundObject!.binaryCol, Data("string".utf8))
XCTAssertEqual(foundObject!.dateCol, Date(timeIntervalSince1970: -1))
XCTAssertEqual(foundObject!.longCol, 1)
XCTAssertEqual(foundObject!.decimalCol, Decimal128(1))
Expand All @@ -1287,7 +1287,7 @@ class AsyncFlexibleSyncTests: SwiftSyncTestCase {
try await write { realm in
let object = SwiftCustomColumnObject()
object.id = objectId
object.binaryCol = "string".data(using: String.Encoding.utf8)!
object.binaryCol = Data("string".utf8)
let linkedObject = SwiftCustomColumnObject()
linkedObject.id = linkedObjectId
object.objectCol = linkedObject
Expand All @@ -1313,7 +1313,7 @@ class AsyncFlexibleSyncTests: SwiftSyncTestCase {
XCTAssertEqual(foundObject!.intCol, 1)
XCTAssertEqual(foundObject!.doubleCol, 1.1)
XCTAssertEqual(foundObject!.stringCol, "string")
XCTAssertEqual(foundObject!.binaryCol, "string".data(using: String.Encoding.utf8)!)
XCTAssertEqual(foundObject!.binaryCol, Data("string".utf8))
XCTAssertEqual(foundObject!.dateCol, Date(timeIntervalSince1970: -1))
XCTAssertEqual(foundObject!.longCol, 1)
XCTAssertEqual(foundObject!.decimalCol, Decimal128(1))
Expand Down
8 changes: 5 additions & 3 deletions Realm/ObjectServerTests/RealmServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extension URLSession {
completionHandler(.success(data))
} else if let error = error {
completionHandler(.failure(error))
// swiftlint:disable:next non_optional_string_data_conversion
} else if let data = data, let string = String(data: data, encoding: .utf8) {
completionHandler(.failure(NSError(domain: URLError.errorDomain,
code: URLError.badServerResponse.rawValue,
Expand Down Expand Up @@ -654,6 +655,7 @@ public class RealmServer: NSObject {
let logLevel = self.logLevel
pipe.fileHandleForReading.readabilityHandler = { file in
guard file.availableData.count > 0,
// swiftlint:disable:next non_optional_string_data_conversion
let available = String(data: file.availableData, encoding: .utf8)?.split(separator: "\t") else {
return
}
Expand All @@ -674,9 +676,9 @@ public class RealmServer: NSObject {
} else if part.contains("ERROR") {
parts.append("🔴")
} else if let json = try? JSONSerialization.jsonObject(with: part.data(using: .utf8)!) {
parts.append(String(data: try! JSONSerialization.data(withJSONObject: json,
options: .prettyPrinted),
encoding: .utf8)!)
parts.append(String(decoding: try! JSONSerialization.data(withJSONObject: json,
options: .prettyPrinted),
as: UTF8.self))
} else if !part.isEmpty {
parts.append(String(part))
}
Expand Down
4 changes: 2 additions & 2 deletions Realm/ObjectServerTests/SwiftObjectServerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class SwiftObjectServerTests: SwiftSyncTestCase {
XCTAssertEqual(obj.intCol, 1)
XCTAssertEqual(obj.doubleCol, 1.1)
XCTAssertEqual(obj.stringCol, "string")
XCTAssertEqual(obj.binaryCol, "string".data(using: String.Encoding.utf8)!)
XCTAssertEqual(obj.binaryCol, Data("string".utf8))
XCTAssertEqual(obj.decimalCol, Decimal128(1))
XCTAssertEqual(obj.dateCol, Date(timeIntervalSince1970: -1))
XCTAssertEqual(obj.longCol, Int64(1))
Expand Down Expand Up @@ -506,7 +506,7 @@ class SwiftObjectServerTests: SwiftSyncTestCase {
let ex = expectation(description: "async open")
ex.expectedFulfillmentCount = 2
let config = try configuration()
let completion = { (result: Result<Realm, Error>) -> Void in
let completion = { (result: Result<Realm, Error>) in
guard case .failure = result else {
XCTFail("No error on cancelled async open")
return ex.fulfill()
Expand Down
4 changes: 2 additions & 2 deletions Realm/ObjectServerTests/SwiftServerObjects.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class SwiftTypesSyncObject: Object {
@Persisted public var intCol: Int = 1
@Persisted public var doubleCol: Double = 1.1
@Persisted public var stringCol: String = "string"
@Persisted public var binaryCol: Data = "string".data(using: String.Encoding.utf8)!
@Persisted public var binaryCol: Data = Data("string".utf8)
@Persisted public var dateCol: Date = Date(timeIntervalSince1970: -1)
@Persisted public var longCol: Int64 = 1
@Persisted public var decimalCol: Decimal128 = Decimal128(1)
Expand Down Expand Up @@ -208,7 +208,7 @@ public class SwiftCustomColumnObject: Object {
@Persisted public var intCol: Int = 1
@Persisted public var doubleCol: Double = 1.1
@Persisted public var stringCol: String = "string"
@Persisted public var binaryCol = "string".data(using: String.Encoding.utf8)!
@Persisted public var binaryCol = Data("string".utf8)
@Persisted public var dateCol: Date = Date(timeIntervalSince1970: -1)
@Persisted public var longCol: Int64 = 1
@Persisted public var decimalCol: Decimal128 = Decimal128(1)
Expand Down
2 changes: 1 addition & 1 deletion Realm/RLMObjectId.mm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ - (id)copyWithZone:(NSZone *)zone {
}

+ (instancetype)objectId {
return [[RLMObjectId alloc] initWithValue:realm::ObjectId::gen()];
return [[self alloc] initWithValue:realm::ObjectId::gen()];
}

- (BOOL)isEqual:(id)object {
Expand Down
36 changes: 0 additions & 36 deletions Realm/TestUtils/TestUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -166,30 +166,6 @@ bool RLMHasCachedRealmForPath(NSString *path) {
return RLMGetAnyCachedRealmForPath(path.UTF8String);
}

static std::string serialize(id obj) {
auto data = [NSJSONSerialization dataWithJSONObject:obj
options:0
error:nil];
return std::string(static_cast<const char *>(data.bytes), data.length);
}

static std::string fakeJWT() {
std::string unencoded_prefix = serialize(@{@"alg": @"HS256"});
std::string unencoded_body = serialize(@{
@"user_data": @{@"token": @"dummy token"},
@"exp": @123,
@"iat": @456,
@"access": @[@"download", @"upload"]
});
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, encoded_prefix);
realm::util::base64_encode(unencoded_body, encoded_body);
std::string suffix = "Et9HFtf9R3GEMA0IICOfFMVXY7kkTX1wr4qCyhIf58U";
return encoded_prefix + "." + encoded_body + "." + suffix;
}

// A network transport which doesn't actually do anything
@interface NoOpTransport : NSObject <RLMNetworkTransport>
@end
Expand Down Expand Up @@ -261,18 +237,6 @@ + (RLMRealmConfiguration *)fakeFlexibleSyncConfiguration {
}
@end

// Xcode 13 adds -[NSUUID compare:] so this warns about the category
// implementing a method which already exists, but we can't use just the
// built-in one yet.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
@implementation NSUUID (RLMUUIDCompareTests)
- (NSComparisonResult)compare:(NSUUID *)other {
return [[self UUIDString] compare:other.UUIDString];
}
@end
#pragma clang diagnostic pop

bool RLMThreadSanitizerEnabled() {
#if __has_feature(thread_sanitizer)
return true;
Expand Down
13 changes: 6 additions & 7 deletions Realm/TestUtils/include/TestUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,19 @@

#import <Realm/RLMUser.h>

RLM_HEADER_AUDIT_BEGIN(nullability)

FOUNDATION_EXTERN void RLMAssertThrowsWithReasonMatchingSwift(XCTestCase *self,
__attribute__((noescape)) dispatch_block_t block,
NSString *regexString,
NSString *message,
NSString *_Nullable message,
NSString *fileName,
NSUInteger lineNumber);


@interface RLMRealmConfiguration (TestUser)
+ (RLMRealmConfiguration *_Nonnull)fakeSyncConfiguration;
+ (RLMRealmConfiguration *_Nonnull)fakeFlexibleSyncConfiguration;
@end

@interface NSUUID (RLMUUIDCompareTests)
- (NSComparisonResult)compare:(NSUUID *)other;
+ (RLMRealmConfiguration *)fakeSyncConfiguration;
+ (RLMRealmConfiguration *)fakeFlexibleSyncConfiguration;
@end

// It appears to be impossible to check this from Swift so we need a helper function
Expand All @@ -44,3 +42,4 @@ FOUNDATION_EXTERN bool RLMThreadSanitizerEnabled(void);
FOUNDATION_EXTERN bool RLMCanFork(void);
FOUNDATION_EXTERN pid_t RLMFork(void);

RLM_HEADER_AUDIT_END(nullability)
6 changes: 3 additions & 3 deletions Realm/Tests/Swift/SwiftObjectInterfaceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ class SwiftRLMObjectInterfaceTests: RLMTestCase {
func testPrimitiveArray() {
let obj = SwiftRLMPrimitiveArrayObject()
let str = "str" as NSString
let data = "str".data(using: .utf8)! as Data as NSData
let data = Data("str".utf8) as NSData
let date = NSDate()
let str2 = "str2" as NSString
let data2 = "str2".data(using: .utf8)! as Data as NSData
let data2 = Data("str2".utf8) as NSData
let date2 = NSDate(timeIntervalSince1970: 0)

obj.stringCol.add(str)
Expand Down Expand Up @@ -291,7 +291,7 @@ class SwiftRLMObjectInterfaceTests: RLMTestCase {
func testPrimitiveSet() {
let obj = SwiftRLMPrimitiveSetObject()
let str = "str" as NSString
let data = "str".data(using: .utf8)! as Data as NSData
let data = Data("str".utf8) as NSData
let date = NSDate()
obj.stringCol.add(str)
XCTAssertTrue(obj.stringCol.contains(str))
Expand Down
2 changes: 1 addition & 1 deletion Realm/Tests/Swift/SwiftPropertyTypeTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class SwiftRLMPropertyTypeTest: RLMTestCase {
let realm = realmWithTestPath()
var object: SwiftRLMObjectiveCTypesObject!
let now = NSDate()
let data = "fizzbuzz".data(using: .utf8)! as Data as NSData
let data = Data("fizzbuzz".utf8) as NSData
try! realm.transaction {
object = SwiftRLMObjectiveCTypesObject()
realm.add(object)
Expand Down
4 changes: 2 additions & 2 deletions RealmSwift/AsymmetricObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ extension AsymmetricObject {
It is not considered part of the public API.
:nodoc:
*/
public override final class func _getProperties() -> [RLMProperty] {
return ObjectUtil.getSwiftProperties(self)
public override static func _getProperties() -> [RLMProperty] {
ObjectUtil.getSwiftProperties(self)
}

// MARK: Object Customization
Expand Down
8 changes: 4 additions & 4 deletions RealmSwift/EmbeddedObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ import Realm.Private
public typealias EmbeddedObject = RealmSwiftEmbeddedObject
extension EmbeddedObject: _RealmCollectionValueInsideOptional {
/// :nodoc:
public class override final func isEmbedded() -> Bool {
return true
public static override func isEmbedded() -> Bool {
true
}

// MARK: Initializers
Expand Down Expand Up @@ -114,8 +114,8 @@ extension EmbeddedObject: _RealmCollectionValueInsideOptional {
It is not considered part of the public API.
:nodoc:
*/
public override final class func _getProperties() -> [RLMProperty] {
return ObjectUtil.getSwiftProperties(self)
public override static func _getProperties() -> [RLMProperty] {
ObjectUtil.getSwiftProperties(self)
}

// MARK: Object Customization
Expand Down
6 changes: 3 additions & 3 deletions RealmSwift/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public final class List<Element: RealmCollectionValue>: RLMSwiftCollectionBase,
rlmArray.exchangeObject(at: UInt(index1), withObjectAt: UInt(index2))
}

@objc class func _unmanagedCollection() -> RLMArray<AnyObject> {
@objc static func _unmanagedCollection() -> RLMArray<AnyObject> {
if let type = Element.self as? ObjectBase.Type {
return RLMArray(objectClassName: type.className())
}
Expand All @@ -222,8 +222,8 @@ public final class List<Element: RealmCollectionValue>: RLMSwiftCollectionBase,
}

/// :nodoc:
@objc public override class func _backingCollectionType() -> AnyClass {
return RLMManagedArray.self
@objc public override static func _backingCollectionType() -> AnyClass {
RLMManagedArray.self
}

// Printable requires a description property defined in Swift (and not obj-c),
Expand Down
Loading

0 comments on commit 8cf26e0

Please sign in to comment.