Skip to content

Commit

Permalink
Update to latest Core (#3016)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev authored Sep 1, 2022
1 parent 2c9222a commit 4a8888a
Show file tree
Hide file tree
Showing 27 changed files with 437 additions and 504 deletions.
9 changes: 7 additions & 2 deletions .github/templates/common.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,16 @@ with:
shell: bash
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Setup Vcpkg
id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
#@yaml/text-templated-strings
with:
path: wrappers/realm-core/tools/vcpkg/ports
cache-key: vcpkg-(@= preset @)-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}-${{ steps.vcpkg_cache_key.outputs.commit }}
cache-restore-keys: vcpkg-(@= preset @)-
cache-key: vcpkg3-(@= preset @)-${{ steps.vcpkg_cache_key.outputs.commit }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}
cache-restore-keys: vcpkg3-(@= preset @)-${{ steps.vcpkg_cache_key.outputs.commit }}
- name: Refetch vcpkg
run: git fetch --unshallow
working-directory: wrappers/realm-core/tools/vcpkg/ports
#@ end

#@ def downloadAllArtifacts(conclusion = "completed"):
Expand Down Expand Up @@ -194,6 +198,7 @@ with:
name: #@ artifactName
path: #@ "${{ github.workspace }}/" + relPath
retention-days: #@ retentionDays
if-no-files-found: error
#@ end
---
#@ def setupDotnet(version = "6.0.x", ifCondition = ""):
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,30 +149,35 @@ jobs:
name: Realm.Fody.${{ steps.get-version.outputs.version }}
path: ${{ github.workspace }}/Realm/packages/Realm.Fody.${{ steps.get-version.outputs.version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.${{ steps.get-version.outputs.version }}
uses: actions/upload-artifact@v2
with:
name: Realm.${{ steps.get-version.outputs.version }}
path: ${{ github.workspace }}/Realm/packages/Realm.${{ steps.get-version.outputs.version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.UnityUtils.${{ steps.get-version.outputs.version }}
uses: actions/upload-artifact@v2
with:
name: Realm.UnityUtils.${{ steps.get-version.outputs.version }}
path: ${{ github.workspace }}/Realm/packages/Realm.UnityUtils.${{ steps.get-version.outputs.version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for Realm.UnityWeaver.${{ steps.get-version.outputs.version }}
uses: actions/upload-artifact@v2
with:
name: Realm.UnityWeaver.${{ steps.get-version.outputs.version }}
path: ${{ github.workspace }}/Realm/packages/Realm.UnityWeaver.${{ steps.get-version.outputs.version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for ExtractedChangelog
uses: actions/upload-artifact@v2
with:
name: ExtractedChangelog
path: ${{ github.workspace }}/Realm/Realm/ExtractedChangelog.md
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Check Docfx cache
id: check-docfx-cache
if: inputs.build-docs
Expand All @@ -197,4 +202,5 @@ jobs:
name: Docs.zip
path: ${{ github.workspace }}/Realm/packages/Docs.zip
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
if: inputs.build-docs
3 changes: 3 additions & 0 deletions .github/workflows/build-unity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ jobs:
name: io.realm.unity-${{ inputs.version }}.tgz
path: ${{ github.workspace }}/Realm/Realm.Unity/io.realm.unity-${{ inputs.version }}.tgz
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
- name: Store artifacts for AssetStorePublisher-${{ inputs.version }}
uses: actions/upload-artifact@v2
with:
name: AssetStorePublisher-${{ inputs.version }}
path: ${{ github.workspace }}/Tools/AssetStorePublisher
retention-days: ${{ (github.event_name != 'pull_request' || contains(github.head_ref, 'release')) && 30 || 1 }}
if-no-files-found: error
- name: Build Tests
run: dotnet run --project Tools/SetupUnityPackage/ -- tests --realm-package Realm/Realm.Unity/io.realm.unity-${{ inputs.version }}.tgz
- name: Store artifacts for UnityTests
Expand All @@ -65,3 +67,4 @@ jobs:
name: UnityTests
path: ${{ github.workspace }}/Tests/Tests.Unity
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
if-no-files-found: error
8 changes: 6 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ jobs:
shell: bash
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Setup Vcpkg
id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
path: wrappers/realm-core/tools/vcpkg/ports
cache-key: vcpkg-windows-x64-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}-${{ steps.vcpkg_cache_key.outputs.commit }}
cache-restore-keys: vcpkg-windows-x64-
cache-key: vcpkg3-windows-x64-${{ steps.vcpkg_cache_key.outputs.commit }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}
cache-restore-keys: vcpkg3-windows-x64-${{ steps.vcpkg_cache_key.outputs.commit }}
- name: Refetch vcpkg
run: git fetch --unshallow
working-directory: wrappers/realm-core/tools/vcpkg/ports
- name: Build wrappers
run: powershell ./wrappers/build.ps1 Windows -Platforms x64 -Configuration Release
- name: Perform CodeQL Analysis
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ jobs:
name: dashboard.charts
path: ${{ github.workspace }}/dashboard.charts
retention-days: 30
if-no-files-found: error
cleanup-cluster:
uses: ./.github/workflows/cleanup-baas.yml
if: always()
Expand Down
38 changes: 34 additions & 4 deletions .github/workflows/wrappers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
name: wrappers-macos
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-macos.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
Expand All @@ -67,6 +68,7 @@ jobs:
name: wrappers-linux
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-linux.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
Expand All @@ -83,6 +85,7 @@ jobs:
name: wrappers-ios-Simulator
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-ios-Simulator.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
Expand All @@ -99,6 +102,7 @@ jobs:
name: wrappers-ios-Device
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-ios-Device.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
Expand All @@ -115,6 +119,7 @@ jobs:
name: wrappers-ios-Catalyst
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-ios-Catalyst.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
Expand All @@ -131,6 +136,7 @@ jobs:
name: wrappers-android-armeabi-v7a
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-android-armeabi-v7a.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
Expand All @@ -147,6 +153,7 @@ jobs:
name: wrappers-android-arm64-v8a
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-android-arm64-v8a.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
Expand All @@ -163,6 +170,7 @@ jobs:
name: wrappers-android-x86
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-android-x86.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
Expand All @@ -179,6 +187,7 @@ jobs:
name: wrappers-android-x86_64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-android-x86_64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
Expand All @@ -195,6 +204,7 @@ jobs:
name: wrappers-windows-Win32
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-Win32.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
Expand All @@ -211,6 +221,7 @@ jobs:
name: wrappers-windows-x64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-x64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
Expand All @@ -227,6 +238,7 @@ jobs:
name: wrappers-windows-ARM64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-ARM64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
Expand All @@ -243,6 +255,7 @@ jobs:
name: wrappers-windows-uwp-Win32
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-uwp-Win32.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
Expand All @@ -259,6 +272,7 @@ jobs:
name: wrappers-windows-uwp-x64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-uwp-x64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
Expand All @@ -275,6 +289,7 @@ jobs:
name: wrappers-windows-uwp-ARM
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-uwp-ARM.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
Expand All @@ -291,6 +306,7 @@ jobs:
name: wrappers-windows-uwp-ARM64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-uwp-ARM64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
Expand Down Expand Up @@ -322,6 +338,7 @@ jobs:
name: wrappers-macos
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
ios:
runs-on: macos-latest
name: iOS
Expand Down Expand Up @@ -355,6 +372,7 @@ jobs:
name: wrappers-ios-${{ matrix.arch }}
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: needs.check-cache.outputs.wrappers-ios-Simulator != 'true' || needs.check-cache.outputs.wrappers-ios-Device != 'true' || needs.check-cache.outputs.wrappers-ios-Catalyst != 'true'
linux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -403,6 +421,7 @@ jobs:
name: wrappers-linux
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
android:
runs-on: ubuntu-20.04
name: Android
Expand Down Expand Up @@ -437,6 +456,7 @@ jobs:
name: wrappers-android-${{ matrix.arch }}
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: needs.check-cache.outputs.wrappers-android-armeabi-v7a != 'true' || needs.check-cache.outputs.wrappers-android-arm64-v8a != 'true' || needs.check-cache.outputs.wrappers-android-x86 != 'true' || needs.check-cache.outputs.wrappers-android-x86_64 != 'true'
windows:
runs-on: windows-latest
Expand Down Expand Up @@ -468,11 +488,15 @@ jobs:
shell: bash
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Setup Vcpkg
id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
path: wrappers/realm-core/tools/vcpkg/ports
cache-key: vcpkg-windows-${{ matrix.arch }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}-${{ steps.vcpkg_cache_key.outputs.commit }}
cache-restore-keys: vcpkg-windows-${{ matrix.arch }}-
cache-key: vcpkg3-windows-${{ matrix.arch }}-${{ steps.vcpkg_cache_key.outputs.commit }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}
cache-restore-keys: vcpkg3-windows-${{ matrix.arch }}-${{ steps.vcpkg_cache_key.outputs.commit }}
- name: Refetch vcpkg
run: git fetch --unshallow
working-directory: wrappers/realm-core/tools/vcpkg/ports
- name: Build wrappers
run: pwsh ./wrappers/build.ps1 Windows -Platforms ${{ matrix.arch }} -Configuration Release -EnableLTO
if: steps.check-cache.outputs.cache-hit != 'true'
Expand All @@ -482,6 +506,7 @@ jobs:
name: wrappers-windows-${{ matrix.arch }}
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: needs.check-cache.outputs.wrappers-windows-Win32 != 'true' || needs.check-cache.outputs.wrappers-windows-x64 != 'true' || needs.check-cache.outputs.wrappers-windows-ARM64 != 'true'
uwp:
runs-on: windows-latest
Expand Down Expand Up @@ -514,11 +539,15 @@ jobs:
shell: bash
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Setup Vcpkg
id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
path: wrappers/realm-core/tools/vcpkg/ports
cache-key: vcpkg-uwp-${{ matrix.arch }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}-${{ steps.vcpkg_cache_key.outputs.commit }}
cache-restore-keys: vcpkg-uwp-${{ matrix.arch }}-
cache-key: vcpkg3-uwp-${{ matrix.arch }}-${{ steps.vcpkg_cache_key.outputs.commit }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}
cache-restore-keys: vcpkg3-uwp-${{ matrix.arch }}-${{ steps.vcpkg_cache_key.outputs.commit }}
- name: Refetch vcpkg
run: git fetch --unshallow
working-directory: wrappers/realm-core/tools/vcpkg/ports
- name: Build wrappers
run: pwsh ./wrappers/build.ps1 WindowsStore -Platforms ${{ matrix.arch }} -Configuration Release -EnableLTO
if: steps.check-cache.outputs.cache-hit != 'true'
Expand All @@ -528,4 +557,5 @@ jobs:
name: wrappers-windows-uwp-${{ matrix.arch }}
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
if-no-files-found: error
if: needs.check-cache.outputs.wrappers-windows-uwp-Win32 != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-x64 != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-ARM != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-ARM64 != 'true'
10 changes: 2 additions & 8 deletions Realm/Realm/DatabaseTypes/Accessors/ManagedAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,9 @@ public void UnsubscribeFromNotifications()
}

/// <inheritdoc/>
void INotifiable<NotifiableObjectHandleBase.CollectionChangeSet>.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet? changes, NativeException? exception)
void INotifiable<NotifiableObjectHandleBase.CollectionChangeSet>.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet? changes)
{
var managedException = exception?.Convert();

if (managedException != null)
{
Realm.NotifyError(managedException);
}
else if (changes.HasValue)
if (changes.HasValue)
{
foreach (int propertyIndex in changes.Value.Properties.AsEnumerable())
{
Expand Down
3 changes: 1 addition & 2 deletions Realm/Realm/DatabaseTypes/INotifiable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ internal interface INotifiable<TChangeset>
/// Method called when there are changes to report for that object.
/// </summary>
/// <param name="changes">The changes that occurred.</param>
/// <param name="exception">An exception if one occurred.</param>
void NotifyCallbacks(TChangeset? changes, NativeException? exception);
void NotifyCallbacks(TChangeset? changes);
}

internal class NotificationToken<TCallback> : IDisposable
Expand Down
7 changes: 3 additions & 4 deletions Realm/Realm/DatabaseTypes/RealmCollectionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public abstract class RealmCollectionBase<T>
IThreadConfined,
IMetadataObject
{
private readonly List<NotificationCallbackDelegate<T>> _callbacks = new List<NotificationCallbackDelegate<T>>();
private readonly List<NotificationCallbackDelegate<T>> _callbacks = new();

private NotificationTokenHandle _notificationToken;

Expand Down Expand Up @@ -395,9 +395,8 @@ private void UpdateCollectionChangedSubscriptionIfNecessary(bool isSubscribed)

#endregion INotifyCollectionChanged

void INotifiable<NotifiableObjectHandleBase.CollectionChangeSet>.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet? changes, NativeException? exception)
void INotifiable<NotifiableObjectHandleBase.CollectionChangeSet>.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet? changes)
{
var managedException = exception?.Convert();
ChangeSet changeset = null;
if (changes != null)
{
Expand All @@ -417,7 +416,7 @@ private void UpdateCollectionChangedSubscriptionIfNecessary(bool isSubscribed)

foreach (var callback in _callbacks.ToArray())
{
callback(this, changeset, managedException);
callback(this, changeset, null);
}
}

Expand Down
Loading

0 comments on commit 4a8888a

Please sign in to comment.