Skip to content

Commit

Permalink
Merge branch 'master' into feature/github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Melchior committed Aug 16, 2022
2 parents faac15b + 94fc80f commit aa68f95
Show file tree
Hide file tree
Showing 99 changed files with 4,140 additions and 822 deletions.
20 changes: 20 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -e

# Prevents pushing any code to the server that does not comply with klint or detekt
# It ignores any unchecked files.

# Ignore any unchecked file
echo "Stashing changes before doing checks"
git stash push -q -u --keep-index

# Pop the stash once the scripts finishes, fails or gets cancelled
function pop_stash() {
echo "Checks completed, popping stash"
git stash pop -q
}

trap "exit" INT TERM ERR
trap pop_stash EXIT

# Do the actual check ups
./gradlew ktlintCheck detekt
80 changes: 80 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,83 @@
## 1.1.0 (YYYY-MM-DD)

### Breaking Changes
* None.

### Enhancements
* Added support for `UUID` through a new property type: `RealmUUID`.
* Support for `Realm.writeCopyTo(configuration)`.
* [Sync] Add support for `User.delete()`, making it possible to delete user data on the server side (Issue [#491](https://github.com/realm/realm-kotlin/issues/491)).

### Fixed
* `Realm.deleteRealm(config)` would throw an exception if the file didn't exist.

### Compatibility
* This release is compatible with:
* Kotlin 1.6.10 and above.
* Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that.
* AtomicFu 0.17.0.
* Minimum Gradle version: 6.1.1.
* Minimum Android Gradle Plugin version: 4.0.0.
* Minimum Android SDK: 16.

### Internal
* None.


## 1.0.2 (2022-08-05)

### Breaking Changes
* None.

### Enhancements
* None.

### Fixed
* Missing proguard configuration for `CoreErrorUtils`. (Issue [#942](https://github.com/realm/realm-kotlin/issues/942))
* [Sync] Embedded Objects could not be added to the schema for `SyncConfiguration`s. (Issue [#945](https://github.com/realm/realm-kotlin/issues/945)).

### Compatibility
* This release is compatible with:
* Kotlin 1.6.10 and above.
* Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that.
* AtomicFu 0.17.0.
* Minimum Gradle version: 6.1.1.
* Minimum Android Gradle Plugin version: 4.0.0.
* Minimum Android SDK: 16.

### Internal
* None.


## 1.0.1 (2022-07-07)

### Breaking Changes
* None.

### Enhancements
* Added support for `ByteArray`. ([#584](https://github.com/realm/realm-kotlin/issues/584))

### Fixed
* Fixed JVM memory leak when passing string to C-API. (Issue [#890](https://github.com/realm/realm-kotlin/issues/890))
* Fixed crash present on release-mode apps using Sync due to missing Proguard exception for `ResponseCallback`.
* The compiler plugin did not set the generic parameter correctly for an internal field inside model classes. This could result in other libraries that operated on the source code throwing an error of the type: `undeclared type variable: T`. (Issue [#901](https://github.com/realm/realm-kotlin/issues/901))
* String read from a realm was mistakenly treated as zero-terminated, resulting in strings with `\0`-characters to be truncated when read. Inserting data worked correctly. (Issue [#911](https://github.com/realm/realm-kotlin/issues/911))
* [Sync] Fix internal ordering of `EmailPasswordAuth.resetPassword(...)` arguments. (Issue [#885](https://github.com/realm/realm-kotlin/issues/885))
* [Sync] Sync error events not requiring a Client Reset incorrectly assumed they had to include a path to a recovery Realm file. (Issue [#895](https://github.com/realm/realm-kotlin/issues/895))

### Compatibility
* This release is compatible with:
* Kotlin 1.6.10 and above.
* Coroutines 1.6.0-native-mt. Also compatible with Coroutines 1.6.0 but requires enabling of the new memory model and disabling of freezing, see https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility for details on that.
* AtomicFu 0.17.0.
* Minimum Gradle version: 6.1.1.
* Minimum Android Gradle Plugin version: 4.0.0.
* Minimum Android SDK: 16.

### Internal
* None.


## 1.0.0 (2022-06-07)

### Breaking Changes
Expand Down
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ We use the offical [style guide](https://kotlinlang.org/docs/reference/coding-co
./gradlew ktlintFormat
```

Note: ktlint does not allow group imports using `.*`. You can configure IntelliJ to disallow this by going to preferences `Editor > Code Style > Kotlin > Imports` and select "Use single name imports".
A pre-push git hook that automatically will perform these checks is available. You can configure it with the following command:

```
git config core.hooksPath .githooks
```

Note: ktlint does not allow group imports using `.*`. You can configure IntelliJ to disallow this by going to preferences `Editor > Code Style > Kotlin > Imports` and select "Use single name imports".

## Multiplatform source layout

Expand Down
2 changes: 1 addition & 1 deletion DEPRECATED-Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pipeline {
steps {
testWithServer([
// This will overwrite previous test results, but should be ok as we would not get here
// if previous stages failed.
// if previous stages failed.
{
testAndCollect("test", "cleanAllTests macosTest -Pkotlin.native.binary.memoryModel=experimental")
},
Expand Down
8 changes: 8 additions & 0 deletions dependencies.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Version of MongoDB Realm used by integration tests
# See https://github.com/realm/ci/packages/147854 for available versions
MONGODB_REALM_SERVER=2022-05-21

# `BAAS` and `BAAS-UI` projects commit hashes matching MONGODB_REALM_SERVER image version
# note that the MONGODB_REALM_SERVER image is a nightly build, find the matching commits
# for that date within the following repositories:
# https://github.com/10gen/baas/
# https://github.com/10gen/baas-ui/
REALM_BAAS_GIT_HASH=87e4edf99a6510aa8468450e87af69dcfc74abe7
REALM_BAAS_UI_GIT_HASH=57c5b89882d5492bc0f4971c376e25ba50b65b5f
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ expect enum class PropertyType {
RLM_PROPERTY_TYPE_INT,
RLM_PROPERTY_TYPE_BOOL,
RLM_PROPERTY_TYPE_STRING,
RLM_PROPERTY_TYPE_BINARY,
RLM_PROPERTY_TYPE_OBJECT,
RLM_PROPERTY_TYPE_FLOAT,
RLM_PROPERTY_TYPE_DOUBLE,
RLM_PROPERTY_TYPE_TIMESTAMP,
RLM_PROPERTY_TYPE_OBJECT_ID,
RLM_PROPERTY_TYPE_UUID,
;

// Consider adding property methods to make it easier to do generic code on all types. Or is this exactly what collection type is about
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ expect object RealmInterop {
fun realm_is_frozen(realm: RealmPointer): Boolean
fun realm_close(realm: RealmPointer)
fun realm_delete_files(path: String)
fun realm_convert_with_config(realm: RealmPointer, config: RealmConfigurationPointer)

fun realm_get_schema(realm: RealmPointer): RealmSchemaPointer
fun realm_get_schema_version(realm: RealmPointer): Long
Expand Down Expand Up @@ -263,6 +264,7 @@ expect object RealmInterop {
fun realm_app_log_in_with_credentials(app: RealmAppPointer, credentials: RealmCredentialsPointer, callback: AppCallback<RealmUserPointer>)
fun realm_app_log_out(app: RealmAppPointer, user: RealmUserPointer, callback: AppCallback<Unit>)
fun realm_app_remove_user(app: RealmAppPointer, user: RealmUserPointer, callback: AppCallback<Unit>)
fun realm_app_delete_user(app: RealmAppPointer, user: RealmUserPointer, callback: AppCallback<Unit>)
fun realm_clear_cached_apps()
fun realm_app_sync_client_get_default_file_path_for_realm(
app: RealmAppPointer,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2022 Realm Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.realm.kotlin.internal.interop

/**
* Wrapper around Core UUID values.
* See https://github.com/realm/realm-core/blob/master/src/realm/uuid.hpp for more information
*/
interface UUIDWrapper {
val bytes: ByteArray
}

// Implementation that should only be used within the cinterop module.
internal data class UUIDWrapperImpl(override val bytes: ByteArray) : UUIDWrapper {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false

other as UUIDWrapperImpl

if (!bytes.contentEquals(other.bytes)) return false

return true
}

override fun hashCode(): Int {
return bytes.contentHashCode()
}
}

const val UUID_BYTES_SIZE = 16
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ actual enum class PropertyType(override val nativeValue: UInt) : NativeEnumerate
RLM_PROPERTY_TYPE_INT(realm_wrapper.RLM_PROPERTY_TYPE_INT),
RLM_PROPERTY_TYPE_BOOL(realm_wrapper.RLM_PROPERTY_TYPE_BOOL),
RLM_PROPERTY_TYPE_STRING(realm_wrapper.RLM_PROPERTY_TYPE_STRING),
RLM_PROPERTY_TYPE_BINARY(realm_wrapper.RLM_PROPERTY_TYPE_BINARY),
RLM_PROPERTY_TYPE_OBJECT(realm_wrapper.RLM_PROPERTY_TYPE_OBJECT),
RLM_PROPERTY_TYPE_FLOAT(realm_wrapper.RLM_PROPERTY_TYPE_FLOAT),
RLM_PROPERTY_TYPE_DOUBLE(realm_wrapper.RLM_PROPERTY_TYPE_DOUBLE),
RLM_PROPERTY_TYPE_TIMESTAMP(realm_wrapper.RLM_PROPERTY_TYPE_TIMESTAMP),
RLM_PROPERTY_TYPE_OBJECT_ID(realm_wrapper.RLM_PROPERTY_TYPE_OBJECT_ID);
RLM_PROPERTY_TYPE_OBJECT_ID(realm_wrapper.RLM_PROPERTY_TYPE_OBJECT_ID),
RLM_PROPERTY_TYPE_UUID(realm_wrapper.RLM_PROPERTY_TYPE_UUID)
;

actual companion object {
actual fun from(nativeValue: Int): PropertyType {
Expand Down
Loading

0 comments on commit aa68f95

Please sign in to comment.