Skip to content

Commit

Permalink
next-major (#1519)
Browse files Browse the repository at this point in the history
* Update to Core next-major

* Update old-format file, update changelog

* Add support for collections in RealmValue (#1469)

* Initial stab at collections in mixed

* regenerate ffi bindings

* Add more tests

* Add notification tests

* Return the types

* Address some PR feedback

* Add RealmValueType

* Fix some tests

* Add query tests

* Add tests for indexOf/contains; add tests for sets

* Create a symlink for test data inside tests

* Add a few more tests

* Correct Core issue link

* enable notifications tests

* Enable some tests

* Re-generate ffi

* Fix test

* Added a changelog entry

* Update Core and reenable some tests

* Update core submodule

* Move cmake presets to root of repo

* Move cmake presets back in realm_dart

* Update Core

* Fix paths

* Regenerate ffi bindings

* Remove deprecated members (#1526)

* Update changelog

* Update paths in prepare-release.yml

* [Release 2.0.0-alpha.1] (#1527)

* [Release 2.0.0-alpha.1]

* fix paths

* Read package version from the correct file

* More release workflow fixes

* ..

* Remove some symlink removal

* tar the correct packages

---------

Co-authored-by: nirinchev <[email protected]>
Co-authored-by: Nikola Irinchev <[email protected]>

* Fixes to the release process

* [Release 2.0.0-alpha.2] (#1528)

* [Release 2.0.0-alpha.2]

* Remove revived symlink

---------

Co-authored-by: nirinchev <[email protected]>
Co-authored-by: Nikola Irinchev <[email protected]>

* Add support for dynamic.getSet/getMap (#1533)

* Add support for dynamic.getSet/getMap

* Fix test

* More test fixes

* Apply suggestions from code review

Co-authored-by: Kasper Overgård Nielsen <[email protected]>

* Regenerate models

* Update changelog

---------

Co-authored-by: Kasper Overgård Nielsen <[email protected]>

---------

Co-authored-by: Realm CI <[email protected]>
Co-authored-by: nirinchev <[email protected]>
Co-authored-by: Kasper Overgård Nielsen <[email protected]>
  • Loading branch information
4 people authored Mar 6, 2024
1 parent 07972c1 commit 4432c3e
Show file tree
Hide file tree
Showing 42 changed files with 2,801 additions and 1,041 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ jobs:

- name: Check cache
id: check-cache
if: ${{ !contains(github.head_ref, 'release/') }}
uses: actions/cache@v4
with:
path: ./packages/realm_dart/binary/**
key: binaries-${{ matrix.build }}-${{ inputs.runner }}-${{hashFiles('./packages/realm_dart/src/**')}}


- name: Setup Ninja
if: contains(github.head_ref, 'release/') || steps.check-cache.outputs.cache-hit != 'true'
if: steps.check-cache.outputs.cache-hit != 'true'
uses: seanmiddleditch/gha-setup-ninja@1815f2d05c2cd60c2d900f89843139b8dde09f4c

- name: Setup Android NDK
Expand All @@ -56,7 +55,7 @@ jobs:
run: sudo xcode-select -s /Applications/Xcode_14.0.1.app

- name: Build
if: ${{ contains(github.head_ref, 'release/') || steps.check-cache.outputs.cache-hit != 'true' }}
if: steps.check-cache.outputs.cache-hit != 'true'
run: |
cmake --preset ${{ startsWith(matrix.build, 'ios-') && 'ios' || matrix.build }}
cmake --build --preset ${{ matrix.build }} --config Release ${{ startsWith(matrix.build, 'android-') && '--target strip' || '' }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
with:
find: "const libraryVersion = '[^']*';"
replace: "const libraryVersion = '${{ steps.update-changelog.outputs.new-version }}';"
include: 'package/realm_dart/lib/src/native/realm_core.dart'
include: 'packages/realm_dart/lib/src/native/realm_core.dart'

- name: Make sure we updated libraryVersion in realm_core.dart
run: |
Expand All @@ -62,7 +62,7 @@ jobs:
with:
find: 'RLM_API const char\* realm_dart_library_version\(\) \{ return "[^"]*"; \}'
replace: 'RLM_API const char* realm_dart_library_version() { return "${{ steps.update-changelog.outputs.new-version }}"; }'
include: 'package/realm_dart/src/realm_dart.cpp'
include: 'packages/realm_dart/src/realm_dart.cpp'

- name: Make sure we updated realm_dart_library_version in realm_dart.cpp
run: |
Expand All @@ -78,15 +78,15 @@ jobs:
echo "core-version=$pkgVersion" >> $GITHUB_OUTPUT
echo "Realm Core version: $pkgVersion"
shell: bash
working-directory: package/realm_dart/src/realm-core
working-directory: packages/realm_dart/src/realm-core

- name: Update realmCoreVersion in metrics_command.dart
id: update-realmCoreVersion
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0
with:
find: "const realmCoreVersion = '[^']*';"
replace: "const realmCoreVersion = '${{ steps.get-core-version.outputs.core-version }}';"
include: 'package/realm_dart/lib/src/cli/metrics/metrics_command.dart'
include: 'packages/realm_dart/lib/src/cli/metrics/metrics_command.dart'

- name: Make sure we updated realmCoreVersion in metrics
run: |
Expand All @@ -99,7 +99,7 @@ jobs:
uses: peter-evans/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad #! 3.10.1
with:
branch: release/${{ steps.update-changelog.outputs.new-version }}
base: main
base: ${{ github.ref_name }}
title: '[Release ${{ steps.update-changelog.outputs.new-version }}]'
draft: false
body: An automated PR for next release.
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Read version
id: get-version
run: |
pkgVersion=$(sed -ne "s/^version: \(.*\)/\1/p" pubspec.yaml)
pkgVersion=$(sed -ne "s/^version: \(.*\)/\1/p" packages/realm_dart/pubspec.yaml)
pkgSuffix="${{ github.event.inputs.environment != 'Production' && format('-{0}', github.sha) || '' }}"
echo "version=$pkgVersion$pkgSuffix" >> $GITHUB_OUTPUT
shell: bash
Expand All @@ -40,20 +40,22 @@ jobs:
with:
workflow: ci.yml
commit: ${{ github.sha }}
path: ${{ github.workspace }}/packages/realm_dart/binary/
path: ${{ github.workspace }}/binary/
workflow_conclusion: completed

# The rename is necessary because action-download-artifact will put things in a folder named the same
# as the artifact name - i.e. librealm-linux, etc.
- name: Archive binaries
run: |
mkdir -p release
mkdir -p ${{ github.workspace }}/release
for directory in binary/*; do
targetFile="release/${directory#*-}.tar.gz"
dart run realm_dart archive --source-dir "$directory" --output-file "${{ github.workspace }}/$targetFile"
for directory in ${{ github.workspace }}/binary/*; do
artifactFolder=$(basename $directory)
targetFile="${{ github.workspace }}/release/${artifactFolder#*-}.tar.gz"
dart run realm_dart archive --source-dir "$directory" --output-file "$targetFile"
done
working-directory: packages/realm_dart
shell: bash

- name: Update realm_* path dependencies (Production)
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0
Expand Down Expand Up @@ -88,7 +90,7 @@ jobs:

- name: Package realm_common
run: |
cp -Lr ../package/realm_common .
cp -Lr ../packages/realm_common .
cd realm_common
dart pub publish --dry-run || true
working-directory: release
Expand All @@ -104,12 +106,9 @@ jobs:
- name: Cleanup binary symlinks
run: |
rm packages/realm/android/src/main/cpp/lib
rm packages/realm/ios/src
rm packages/realm/ios/realm_dart.xcframework
rm packages/realm/linux/binary
rm packages/realm/windows/binary
rm packages/realm/macos/librealm_dart.dylib
rm packages/realm/example/binary
- name: Package realm (flutter)
run: |
Expand All @@ -121,8 +120,8 @@ jobs:
- name: Package realm_dart
run: |
mkdir realm_dart
cp -Lr ../package/realm_dart/bin ../package/realm_dart/example ../package/realm_dart/lib ../package/realm_dart/test realm_dart
rsync -vt ../* realm_dart/
cp -Lr ../packages/realm_dart/bin ../packages/realm_dart/example ../packages/realm_dart/lib ../packages/realm_dart/test realm_dart
rsync -vt ../packages/realm_dart/* realm_dart/
cd realm_dart
dart pub publish --dry-run || true
working-directory: release
Expand Down Expand Up @@ -152,7 +151,7 @@ jobs:
- name: Upload release folder to S3
id: upload-to-s3
run: |
tar -zcvf packages.tar.gz common generator realm_dart realm ExtractedChangelog.md
tar -zcvf packages.tar.gz realm_common realm_generator realm_dart realm ExtractedChangelog.md
rm -rf common generator realm_dart realm ExtractedChangelog.md
s3_folder="static.realm.io/downloads/dart/${{ steps.get-version.outputs.version }}"
Expand Down
74 changes: 69 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
## vNext (TBD)
## vNext

### Breaking changes
### Breaking Changes
* `RealmValue.type` is now an enum of type `RealmValueType` rather than `Type`. If you need the runtime type of the value wrapped in `RealmValue`, use `RealmValue.value.runtimeType`. (Issue [#1505](https://github.com/realm/realm-dart/issues/1505))
* Renamed `RealmValue.uint8List` constructor to `RealmValue.binary`. (PR [#1469](https://github.com/realm/realm-dart/pull/1469))
* Removed the following deprecated classes and members:
* `AppConfiguration.localAppName` - was unused and had no effect
* `AppConfiguration.localAppVersion` - was unused and had no effect
* `ClientResetError.isFatal` - it was always `true`
* `ClientResetError.sessionErrorCode`
* `SyncError.codeValue` - can be accessed through `SyncError.code.code`
* `SyncError.category` - categories were deprecated in `1.6.0`
* `SyncError.detailedMessage` - was always empty
* `SyncError` constructor and `SyncError.create` factory - sync errors are created internally by the SDK and are not supposed to be constructed by users
* `SyncClientError`, `SyncConnectionError`, `SyncSessionError`, `SyncResolveError`, `SyncWebSocketError`, `GeneralSyncError` - consolidated into `SyncError` as part of the error simplification in `1.6.0`
* `RealmProperty.indexed` - replaced by `RealmProperty.indexType`
* `SyncErrorCategory`, `SyncClientErrorCode`, `SyncConnectionErrorCode`, `SyncSessionErrorCode`, `SyncResolveErrorCode`, `SyncWebsocketErrorCode`, `GeneralSyncErrorCode` - consolidated into `SyncErrorCode` as part of the error simplification in `1.6.0`
* `User.provider` - the provider is associated with each identity, so the value was incorrect for users who had more than one identity
* The generated parts are now named `.realm.dart` instead of `.g.dart`. This is because the builder is now a `PartBuilder`, instead of a `SharedPartBuilder`. To migrate to this version you need to update all the part declarations to match, ie. `part 'x.g.dart` becomes `part x.realm.dart` and rerun the generator.

This makes it easier to combine builders. Here is an example of combining with `dart_mappable`:
Expand Down Expand Up @@ -30,16 +45,65 @@
```

### Enhancements
* None
* Added `isCollectionDeleted` to `RealmListChanges`, `RealmSetChanges`, and `RealmMapChanges` which will be `true` if the parent object, containing the collection has been deleted. (Core 14.0.0)
* Added `isCleared` to `RealmMapChanges` which will be `true` if the map has been cleared. (Core 14.0.0)
* Querying a specific entry in a collection (in particular 'first and 'last') is supported. (Core 14.0.0)
```dart
class _Owner {
late List<_Dog> dogs;
}
realm.query<Owner>('dogs[1].age = 5'); // Query all owners whose second dog element is 5 years old
realm.query<Owner>('dogs[FIRST].age = 5'); // Query all owners whose first dog is 5 years old
realm.query<Owner>('dogs[LAST].age = 5'); // Query all owners whose last dog is 5 years old
realm.query<Owner>('dogs[SIZE] = 10'); // Query all owners who have 10 dogs
```
* Added support for storing lists and maps inside a `RealmValue` property. (Issue [#1504](https://github.com/realm/realm-dart/issues/1504))
```dart
class _Container {
late RealmValue anything;
}
realm.write(() {
realm.add(Container(anything: RealmValue.from([1, 'foo', 3.14])));
});
final container = realm.all<Container>().first;
final list = container.anything.asList(); // will throw if cast is invalid
for (final item in containerValue) {
switch (item.type) {
case RealmValueType.int:
print('Integer: ${item.value as int}');
break;
case RealmValueType.string:
print('String: ${item.value as String}');
break;
case RealmValueType.double:
print('Double: ${item.value as double}');
break;
}
}
final subscription = list.changes.listen((event) {
// The list changed
});
```
* Added `RealmValueType` enum that contains all the possible types that can be wrapped by a `RealmValue`. (PR [#1469](https://github.com/realm/realm-dart/pull/1469))
* Added support for accessing `Set` and `Map` types using the dynamic object API - `obj.dynamic.getSet/getMap`. (PR [#1533](https://github.com/realm/realm-dart/pull/1533))


### Fixed
* If you have more than 8388606 links pointing to one specific object, the program will crash. (Core 14.0.0)
* A Realm generated on a non-apple ARM 64 device and copied to another platform (and vice-versa) were non-portable due to a sorting order difference. This impacts strings or binaries that have their first difference at a non-ascii character. These items may not be found in a set, or in an indexed column if the strings had a long common prefix (> 200 characters). (Core 14.0.0)
* Ctor arguments appear in random order on generated classes, if the realm model contains many properties. (PR [#1531](https://github.com/realm/realm-dart/pull/1531))

### Compatibility
* Realm Studio: 13.0.0 or later.
* Realm Studio: 14.0.0 or later.
* Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier.

### Internal
* Using Core x.y.z.
* Using Core 14.0.0

## 1.9.0 (2024-02-02)

Expand Down
2 changes: 1 addition & 1 deletion packages/realm/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: realm_example
description: Demonstrates how to use the Realm SDK for Flutter.
version: 1.9.0
version: 2.0.0-alpha.2

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
Expand Down
2 changes: 1 addition & 1 deletion packages/realm/ios/realm.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ puts "bundleId is #{bundleId}"

Pod::Spec.new do |s|
s.name = 'realm'
s.version = '1.9.0'
s.version = '2.0.0-alpha.2'
s.summary = 'The official Realm SDK for Flutter'
s.description = <<-DESC
Realm is a mobile database - an alternative to SQLite and key-value stores.
Expand Down
2 changes: 1 addition & 1 deletion packages/realm/macos/realm.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ puts "bundleId is #{bundleId}"

Pod::Spec.new do |s|
s.name = 'realm'
s.version = '1.9.0'
s.version = '2.0.0-alpha.2'
s.summary = 'The official Realm SDK for Flutter'
s.description = <<-DESC
Realm is a mobile database - an alternative to SQLite and key-value stores.
Expand Down
2 changes: 1 addition & 1 deletion packages/realm/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: realm
description: The official Realm SDK for Flutter. Realm is a mobile database - an alternative to SQLite and key-value stores.
version: 1.9.0
version: 2.0.0-alpha.2

homepage: https://www.realm.io
repository: https://github.com/realm/realm-dart
Expand Down
2 changes: 1 addition & 1 deletion packages/realm/tests/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A new Flutter project.

publish_to: "none"

version: 1.9.0
version: 2.0.0-alpha.2

environment:
sdk: ^3.0.0
Expand Down
Loading

0 comments on commit 4432c3e

Please sign in to comment.