Skip to content

Commit

Permalink
Merge pull request #7426 from realm/tg/build-xcode-13-release
Browse files Browse the repository at this point in the history
Resume building releases with Xcode 13
  • Loading branch information
tgoyne authored Sep 3, 2021
2 parents 0adf050 + dcf3d6e commit 59a36ee
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ x.y.z Release notes (yyyy-MM-dd)
=============================================================
### Enhancements
* Add additional `observe` methods for Objects and RealmCollections which take a `PartialKeyPath` type key path parameter.
* The release package once again contains Xcode 13 binaries for iOS.

### Fixed
* `Map<Key, Value>` did not conform to `Codable`. ([Cocoa #7418](https://github.com/realm/realm-cocoa/pull/7418), since v10.8.0)
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile.releasability
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
xcodeVersions = ['12.2', '12.4', '12.5.1']
xcodeVersions = ['12.2', '12.4', '12.5.1', '13.0']
platforms = ['osx', 'ios', 'watchos', 'tvos', 'catalyst']
carthagePlatforms = ['osx', 'ios', 'watchos', 'tvos']
platformNames = ['osx': 'macOS', 'ios': 'iOS', 'watchos': 'watchOS', 'tvos': 'tvOS', 'catalyst': 'Catalyst']
Expand Down
8 changes: 5 additions & 3 deletions RealmSwift/BSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -379,18 +379,20 @@ extension MinKey: BSON {
/// Return this BSON as a `Decimal128` if possible.
/// This will coerce numeric cases (e.g. `.double`) into a `Decimal128` if such coercion would be lossless.
public func asDecimal128() -> Decimal128? {
let str: String
switch self {
case let .decimal128(d):
return d
case let .int64(i):
return try? Decimal128(string: String(i))
str = String(i)
case let .int32(i):
return try? Decimal128(string: String(i))
str = String(i)
case let .double(d):
return try? Decimal128(string: String(d))
str = String(d)
default:
return nil
}
return try? Decimal128(string: str)
}

/// Return this BSON as a `T` if possible, otherwise nil.
Expand Down
20 changes: 10 additions & 10 deletions RealmSwift/Decimal128.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ public final class Decimal128: RLMDecimal128, Decodable {

/// The mininum value for Decimal128
public static var min: Decimal128 {
__minimumDecimalNumber as! Self
unsafeDowncast(__minimumDecimalNumber, to: Self.self)
}

/// The maximum value for Decimal128
public static var max: Decimal128 {
__maximumDecimalNumber as! Self
unsafeDowncast(__maximumDecimalNumber, to: Self.self)
}
}

Expand Down Expand Up @@ -201,7 +201,7 @@ extension Decimal128 {

/// The magnitude of this Decimal128.
public var magnitude: Magnitude {
self.__magnitude as! Magnitude
unsafeDowncast(self.__magnitude, to: Magnitude.self)
}

/// Adds two decimal128 values and produces their sum.
Expand All @@ -210,7 +210,7 @@ extension Decimal128 {
/// - lhs: The first Decimal128 value to add.
/// - rhs: The second Decimal128 value to add.
public static func + (lhs: Decimal128, rhs: Decimal128) -> Decimal128 {
lhs.decimalNumber(byAdding: rhs) as! Decimal128
unsafeDowncast(lhs.decimalNumber(byAdding: rhs), to: Decimal128.self)
}

/// Subtracts one Decimal128 value from another and produces their difference.
Expand All @@ -219,7 +219,7 @@ extension Decimal128 {
/// - lhs: A Decimal128 value.
/// - rhs: The Decimal128 value to subtract from `lhs`.
public static func - (lhs: Decimal128, rhs: Decimal128) -> Decimal128 {
lhs.decimalNumber(bySubtracting: rhs) as! Decimal128
unsafeDowncast(lhs.decimalNumber(bySubtracting: rhs), to: Decimal128.self)
}

/// Multiplies two Decimal128 values and produces their product.
Expand All @@ -228,7 +228,7 @@ extension Decimal128 {
/// - lhs: The first value to multiply.
/// - rhs: The second value to multiply.
public static func * (lhs: Decimal128, rhs: Decimal128) -> Decimal128 {
lhs.decimalNumberByMultiplying(by: rhs) as! Decimal128
unsafeDowncast(lhs.decimalNumberByMultiplying(by: rhs), to: Decimal128.self)
}

/// Returns the quotient of dividing the first Decimal128 value by the second.
Expand All @@ -237,7 +237,7 @@ extension Decimal128 {
/// - lhs: The Decimal128 value to divide.
/// - rhs: The Decimal128 value to divide `lhs` by. `rhs` must not be zero.
public static func / (lhs: Decimal128, rhs: Decimal128) -> Decimal128 {
lhs.decimalNumberByDividing(by: rhs) as! Decimal128
unsafeDowncast(lhs.decimalNumberByDividing(by: rhs), to: Decimal128.self)
}
}

Expand All @@ -250,8 +250,8 @@ extension Decimal128 {
///
/// - Parameter other: The Decimal128 value to calculate the distance to.
/// - Returns: The distance from this value to `other`.
public func distance(to other: Decimal128) -> Stride {
other - self
public func distance(to other: Decimal128) -> Decimal128 {
unsafeDowncast(other.decimalNumber(bySubtracting: self), to: Decimal128.self)
}

/// Returns a Decimal128 that is offset the specified distance from this value.
Expand All @@ -263,7 +263,7 @@ extension Decimal128 {
/// - Parameter n: The distance to advance this Decimal128.
/// - Returns: A Decimal128 that is offset from this value by `n`.
public func advanced(by n: Decimal128) -> Decimal128 {
self + n
unsafeDowncast(decimalNumber(byAdding: n), to: Decimal128.self)
}
}

Expand Down
2 changes: 1 addition & 1 deletion RealmSwift/ObjectiveCSupport+BSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public extension ObjectiveCSupport {
return convertBson(object: value)
}
return .null
}.map { $0 == .null ? nil : $0 })
}.map { (v: AnyBSON) -> AnyBSON? in v == .null ? nil : v })
case .UUID:
guard let val = bson as? NSUUID else {
return nil
Expand Down
3 changes: 1 addition & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,7 @@ case "$COMMAND" in
export ASAN_OPTIONS='check_initialization_order=true:detect_stack_use_after_return=true'
fi
xcrun swift package resolve
find .build -name views.cpp -delete
xcrun swift test --configuration "$(echo "$CONFIGURATION" | tr "[:upper:]" "[:lower:]")" $SANITIZER
xcrun swift test -Xcc -g0 --configuration "$(echo "$CONFIGURATION" | tr "[:upper:]" "[:lower:]")" $SANITIZER
exit 0
;;

Expand Down
6 changes: 4 additions & 2 deletions examples/installation/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ xctest() {
)
elif [[ $NAME == SwiftPackageManager* ]]; then
if [ -n "$sha" ]; then
sed -i '' 's@branch = "master"@branch = "'"$sha"'"@' "$DIRECTORY/$NAME.xcodeproj/project.pbxproj"
ex '+%s@branch = "master"@branch = "'"$sha"'"@' -scwq "$DIRECTORY/$NAME.xcodeproj/project.pbxproj"
fi
elif [[ $LANG == swift* ]]; then
download_zip_if_needed swift
Expand All @@ -133,7 +133,9 @@ xctest() {
local scheme=(-scheme "$NAME")

# Ensure that dynamic framework tests try to use the correct version of the prebuilt libraries.
sed -i '' 's@/realm-swift-latest@/realm-swift-latest/'"${REALM_XCODE_VERSION}"'@' "$DIRECTORY/$NAME.xcodeproj/project.pbxproj"
if grep '/realm-swift-latest' "$DIRECTORY/$NAME.xcodeproj/project.pbxproj"; then
ex '+%s@/realm-swift-latest@/realm-swift-latest/'"${REALM_XCODE_VERSION}"'@' -scwq "$DIRECTORY/$NAME.xcodeproj/project.pbxproj"
fi

xcodebuild "${project[@]}" "${scheme[@]}" clean build "${destination[@]}" "${code_signing_flags[@]}"
if [[ $PLATFORM != watchos ]]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/package_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def replace_framework(example, path)
"examples/tvos/swift",
]

xcode_versions = %w(12.2 12.4 12.5.1)
xcode_versions = %w(12.2 12.4 12.5.1 13.0)

# Remove reference to Realm.xcodeproj from all example workspaces.
base_examples.each do |example|
Expand Down

0 comments on commit 59a36ee

Please sign in to comment.