Skip to content

Commit 6565472

Browse files
committed
Merge branch 'master' into support-new-datatypes
# Conflicts: # CHANGELOG.md # realm/realm-library/src/androidTest/java/io/realm/RealmMigrationTests.java # realm/realm-library/src/main/cpp/realm-core # version.txt
2 parents 14ce51d + b07bdce commit 6565472

File tree

26 files changed

+319
-195
lines changed

26 files changed

+319
-195
lines changed

CHANGELOG.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
## 10.5.0 (YYYY-MM-DD)
1+
## 10.6.0-BETA.1 (YYYY-MM-DD)
22

33
### Breaking Changes
4+
* [RealmApp] Sync protocol version increased to 3. This version adds support for the new data types introduced in file format version 21.
5+
* File format version bumped to 21. In this version we support new basic datatypes `UUID` and `RealmAny`, as well as `RealmSet` and `RealmMap` collections with string-based keys (i.e. `RealmDictionary`).
46
* Queries no longer do nullability checks on non-nullable fields, so using `null` as an argument will not throw an `IllegalArgumentException`.
57
* String query filters `contains`, `beginsWith`, `endsWith`, and `like`, now throw a null pointer exception on null values.
68
* The query builder no longer throw `IllegalStateException` but `IllegalArgumentException`.
@@ -34,12 +36,40 @@
3436
* Classes names "class_class_..." were not handled correctly when doing queries ([#4480](https://github.com/realm/realm-core/issues/4480))
3537
* Fix collection notification reporting for modifications. This could be observed by receiving the wrong indices of modifications on sorted or distinct results, or notification blocks sometimes not being called when only modifications have occurred. ([#4573](https://github.com/realm/realm-core/pull/4573) since v6).
3638

37-
### Breaking changes
38-
* Sync protocol version increased to 3. This version adds support for the new data types introduced in file format version 21.
39-
* File format version bumped to 21. In this version we support new basic datatypes `UUID` and `RealmAny`, as well as `RealmSet` and `RealmMap` collections with string-based keys (i.e. `RealmDictionary`).
39+
### Compatibility
40+
* File format: Generates Realms with format v21. Unsynced Realms will be upgraded from Realm Java 2.0 and later. Synced Realms can only be read and upgraded if created with Realm Java v10.0.0-BETA.1.
41+
* APIs are backwards compatible with all previous release of realm-java in the 10.6.y series.
42+
* Realm Studio 10.0.0 or above is required to open Realms created by this version.
4043

4144
### Internal
42-
* Updated to Realm Core commit: <TBD>.
45+
* Updated to Realm Core 11.0.0-beta.4, commit: d50aef63a8aaf435e3afed82b589b47d8e1ab1ab.
46+
47+
48+
## 10.5.0 (2021-05-07)
49+
50+
### Breaking Changes
51+
* [RealmApp] `SyncSession.State.WaitingForAccessToken` has been added. It represents the local access token not longer being valid, but is automatically being refreshed.
52+
53+
### Enhancements
54+
* We now make a backup of a Realm file prior to any file format upgrade. The backup is retained for 3 months. Backups from before a file format upgrade allows for better analysis of any upgrade failure. We also restore a backup, if a) an attempt is made to open a realm file whith a "future" file format and b) a backup file exist that fits the current file format. The backup file is placed next to the real Realm file and is named `<fileName>.v<realmFileFormatVersion>.backup.realm`.
55+
* The error message when the intial steps of opening a Realm file fails is now more descriptive.
56+
57+
### Fixes
58+
* [RealmApp] Client Reset errors now correctly forward the server error message. (Issue [#7363](https://github.com/realm/realm-java/issues/7363), since 10.0.0)
59+
* [RealmApp] All `AppException`s now correctly report the error message through `RuntimeException.getMessage()` instead of only through `AppException.getErrorMessage()`.
60+
* [RealmApp] Proactively check the expiry time on the access token and refresh it before attempting to initiate a sync session. This prevents some error logs from appearing on the client such as: "ERROR: Connection[1]: Websocket: Expected HTTP response 101 Switching Protocols, but received: HTTP/1.1 401 Unauthorized" (RCORE-473, since v10.0.0).
61+
* Fix name aliasing not working in sort/distinct clauses of raw string predicates.
62+
* Fix collection notification reporting for modifications. This could be observed by receiving the wrong indices of modifications on sorted or distinct results, or notification sometimes not being called when only modifications have occured. (since v7.0.0).
63+
* Make conversion of Decimal128 to/from string work for numbers with more than 19 significant digits. (#4548)
64+
65+
### Compatibility
66+
* File format: Generates Realms with format v20. Unsynced Realms will be upgraded from Realm Java 2.0 and later. Synced Realms can only be read and upgraded if created with Realm Java v10.0.0-BETA.1.
67+
* APIs are backwards compatible with all previous release of realm-java in the 10.x.y series.
68+
* Realm Studio 10.0.0 or above is required to open Realms created by this version.
69+
70+
### Internal
71+
* Updated to Realm Core 10.7.1, commit 5043c25e1d8f5971002e0fec85dea5ea3d7eb3d7.
72+
4373

4474
## 10.4.0 (2021-03-26)
4575

Jenkinsfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,19 +341,22 @@ def runBuild(buildFlags, instrumentationTestTarget) {
341341
def runPublish() {
342342
stage('Publish Release') {
343343
withCredentials([
344+
[$class: 'StringBinding', credentialsId: 'maven-central-java-ring-file', variable: 'SIGN_KEY'],
345+
[$class: 'StringBinding', credentialsId: 'maven-central-java-ring-file-password', variable: 'SIGN_KEY_PASSWORD'],
344346
[$class: 'StringBinding', credentialsId: 'slack-webhook-java-ci-channel', variable: 'SLACK_URL_CI'],
345347
[$class: 'StringBinding', credentialsId: 'slack-webhook-releases-channel', variable: 'SLACK_URL_RELEASE'],
346348
[$class: 'UsernamePasswordMultiBinding', credentialsId: 'maven-central-credentials', passwordVariable: 'MAVEN_CENTRAL_PASSWORD', usernameVariable: 'MAVEN_CENTRAL_USER'],
347349
[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'DOCS_S3_ACCESS_KEY', credentialsId: 'mongodb-realm-docs-s3', secretKeyVariable: 'DOCS_S3_SECRET_KEY'],
348350
[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'REALM_S3_ACCESS_KEY', credentialsId: 'realm-s3', secretKeyVariable: 'REALM_S3_SECRET_KEY']
349351
]) {
352+
// TODO Make sure that buildFlags and signingFlags are unified across builds
350353
sh """
351354
set +x
352355
sh tools/publish_release.sh '$MAVEN_CENTRAL_USER' '$MAVEN_CENTRAL_PASSWORD' \
353356
'$REALM_S3_ACCESS_KEY' '$REALM_S3_SECRET_KEY' \
354357
'$DOCS_S3_ACCESS_KEY' '$DOCS_S3_SECRET_KEY' \
355-
'$SLACK_URL_RELEASE' \
356-
'$SLACK_URL_CI'
358+
'$SLACK_URL_RELEASE' '$SLACK_URL_CI' \
359+
'-PsignBuild=true -PsignSecretRingFile="${SIGN_KEY}" -PsignPassword=${SIGN_KEY_PASSWORD} -PenableLTO=true -PbuildCore=true'
357360
"""
358361
}
359362
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ See [Realm Kotlin](https://github.com/realm/realm-kotlin) for more information a
1919

2020
## Getting Started
2121

22-
Please see the [detailed instructions in our docs](https://realm.io/docs/java/latest/#installation) to add Realm to your project.
22+
Please see the [detailed instructions in our docs](https://docs.mongodb.com/realm/sdk/android/install/) to add Realm to your project.
2323

2424
## Documentation
2525

build.gradle

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
buildscript {
2+
def properties = new Properties()
3+
properties.load(new FileInputStream("${projectDir}/dependencies.list"))
4+
25
repositories {
36
jcenter()
4-
}
5-
dependencies {
6-
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0'
7-
classpath 'ch.netzwerg:gradle-release-plugin:1.2.0'
7+
maven {
8+
url "https://plugins.gradle.org/m2/"
9+
}
810
}
911
}
1012

11-
apply plugin: 'ch.netzwerg.release'
12-
apply plugin: 'io.codearte.nexus-staging'
13-
1413
def currentVersion = file("${projectDir}/version.txt").text.trim()
1514

1615
// Find property in either System environment or Gradle properties.
@@ -292,7 +291,6 @@ task assemble {
292291

293292
task distributionJniUnstrippedPackage(type:Zip) {
294293
description = 'Generate native libs package with debug symbols'
295-
dependsOn assembleRealm
296294

297295
group = 'Artifact'
298296
archiveName = "realm-java-jni-libs-unstripped-${currentVersion}.zip"
@@ -301,6 +299,15 @@ task distributionJniUnstrippedPackage(type:Zip) {
301299
from("realm/realm-library/build/outputs/jniLibs-unstripped") {
302300
include '**/*.so'
303301
}
302+
doLast {
303+
// Failsafe check, ensuring that we catch if the path ever changes, which it might since it is an
304+
// implementation detail of the Android Gradle Plugin
305+
def unstrippedDir = file("${rootDir}/realm/realm-library/build/outputs/jniLibs-unstripped")
306+
print(unstrippedDir)
307+
if (!unstrippedDir.exists() || !unstrippedDir.isDirectory() || unstrippedDir.listFiles().size() == 0) {
308+
throw new GradleException("Could not locate unstripped binary files in: ${unstrippedDir.getPath()}")
309+
}
310+
}
304311
}
305312

306313
task cleanRealm(type:GradleBuild) {
@@ -404,7 +411,7 @@ task mavenCentralRealm(type: GradleBuild) {
404411
description = 'Publish the Realm AAR and AP to Maven Central'
405412
group = 'Publishing'
406413
buildFile = file('realm/build.gradle')
407-
tasks = ['publishAllPublicationsToMavenCentralRepository']
414+
tasks = ['publishToSonatype']
408415
startParameter.projectProperties = gradle.startParameter.projectProperties
409416
configure copyProperties
410417
}
@@ -413,24 +420,27 @@ task mavenCentralAnnotations(type: GradleBuild) {
413420
description = 'Publish the Realm Annotations to Maven Central'
414421
group = 'Publishing'
415422
buildFile = file('realm-annotations/build.gradle')
423+
tasks = ['publishToSonatype']
416424
startParameter.projectProperties = gradle.startParameter.projectProperties
417-
tasks = ['publishAllPublicationsToMavenCentralRepository']
425+
configure copyProperties
418426
}
419427

420428
task mavenCentralGradlePlugin(type: GradleBuild) {
421429
description = 'Publish the Realm Gradle Plugin to Maven Central'
422430
group = 'Publishing'
423431
buildFile = file('gradle-plugin/build.gradle')
432+
tasks = ['publishToSonatype']
424433
startParameter.projectProperties = gradle.startParameter.projectProperties
425-
tasks = ['publishAllPublicationsToMavenCentralRepository']
434+
configure copyProperties
426435
}
427436

428437
task mavenCentralTransformer(type: GradleBuild) {
429438
description = 'Publish the Realm Transformer to Maven Central'
430439
group = 'Publishing'
431440
buildFile = file('realm-transformer/build.gradle')
441+
tasks = ['publishToSonatype']
432442
startParameter.projectProperties = gradle.startParameter.projectProperties
433-
tasks = ['publishAllPublicationsToMavenCentralRepository']
443+
configure copyProperties
434444
}
435445

436446
task mavenCentralUpload {
@@ -441,26 +451,3 @@ task mavenCentralUpload {
441451
dependsOn mavenCentralGradlePlugin
442452
dependsOn mavenCentralTransformer
443453
}
444-
445-
apply from: "mavencentral-properties.gradle"
446-
447-
nexusStaging {
448-
// Lazily evaluate properties so they are only needed when actually used.
449-
packageGroup = "io.realm"
450-
stagingProfileId = rootProject.ext["sonatypeStagingProfileId"]
451-
username = rootProject.ext["ossrhUsername"]
452-
password = rootProject.ext["ossrhPassword"]
453-
// Maven Central, at times, seems really slow to update the repository status,
454-
// so setting the timeout to 20 minutes.
455-
delayBetweenRetriesInMillis = 10000
456-
numberOfRetries = 120
457-
}
458-
459-
// This is just a placeholder for the release plugin
460-
task build {}
461-
462-
release {
463-
push = false
464-
versionSuffix = '-SNAPSHOT'
465-
tagPrefix = 'v'
466-
}

dependencies.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ gradle=6.5
1717
ndkVersion=22.0.7026061
1818
BUILD_INFO_EXTRACTOR_GRADLE=4.17.0
1919
GRADLE_BINTRAY_PLUGIN=1.8.5
20+
GRADLE_NEXUS_PLUGIN=1.0.0
2021
CMAKE=3.18.4
2122

2223
# Bson dependency version

gradle-plugin/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ buildscript {
44

55
repositories {
66
jcenter()
7+
maven {
8+
url "https://plugins.gradle.org/m2/"
9+
}
710
}
811
dependencies {
912
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:${properties.get('BUILD_INFO_EXTRACTOR_GRADLE')}"
1013
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:${properties.get('GRADLE_BINTRAY_PLUGIN')}"
14+
classpath "io.github.gradle-nexus:publish-plugin:${properties.get("GRADLE_NEXUS_PLUGIN")}"
1115
}
1216
}
1317

@@ -84,6 +88,7 @@ sourceSets {
8488

8589
compileJava.dependsOn generateVersionClass
8690

91+
apply from: "${rootDir}/../mavencentral-publications.gradle"
8792
apply from: "${rootDir}/../mavencentral-publish.gradle"
8893

8994
publishing {

library-build-transformer/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ buildscript {
99
repositories {
1010
mavenCentral()
1111
jcenter()
12+
maven {
13+
url "https://plugins.gradle.org/m2/"
14+
}
1215
}
1316
dependencies {
14-
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:${properties.get('BUILD_INFO_EXTRACTOR_GRADLE')}"
15-
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:${properties.get('GRADLE_BINTRAY_PLUGIN')}"
17+
classpath "io.github.gradle-nexus:publish-plugin:${properties.get("GRADLE_NEXUS_PLUGIN")}"
1618
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1719
}
1820
}
@@ -23,8 +25,7 @@ version = file("${projectDir}/../version.txt").text.trim()
2325
apply plugin: 'kotlin'
2426
apply plugin: 'maven'
2527
apply plugin: 'maven-publish'
26-
apply plugin: 'com.jfrog.artifactory'
27-
apply plugin: 'com.jfrog.bintray'
28+
apply from: "${rootDir}/../mavencentral-publications.gradle"
2829

2930
repositories {
3031
google()

mavencentral-publications.gradle

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// This script is responsible for setting up the publications, so they are ready to be published
2+
// to Maven Central and other repositories. Publishing to Maven Central is configured in
3+
// `mavencentral-publish.gradle`. They are in separate files as the nexus publish plugin used
4+
// to deploy to Maven Central can only be applied to top level projects.
5+
apply plugin: 'maven-publish'
6+
apply plugin: 'signing'
7+
apply from: buildscript.sourceFile.getParent() + "/" + "mavencentral-properties.gradle"
8+
9+
// The publications doesn't know about our AAR dependencies, so we have to manually add them to the pom
10+
// Credit: http://stackoverflow.com/questions/24743562/gradle-not-including-dependencies-in-published-pom-xml
11+
def createPomDependencies(configurationNames) {
12+
return {
13+
def dependenciesNode = asNode().appendNode('dependencies')
14+
configurationNames.each { configurationName ->
15+
configurations[configurationName].allDependencies.each {
16+
// Also ignore `realm-library` because that is used by the Kotlin Extensions as
17+
// a project dependency, but it is being written to the POM file in a wrong way.
18+
// Instead we just ignore it as the Gradle Plugin makes sure it is always present.
19+
if (it.group != null && it.name != null && it.name != 'realm-library') {
20+
def dependencyNode = dependenciesNode.appendNode('dependency')
21+
dependencyNode.appendNode('groupId', it.group)
22+
dependencyNode.appendNode('artifactId', it.name)
23+
dependencyNode.appendNode('version', it.version)
24+
25+
//If there are any exclusions in dependency
26+
if (it.excludeRules.size() > 0) {
27+
def exclusionsNode = dependencyNode.appendNode('exclusions')
28+
it.excludeRules.each { rule ->
29+
def exclusionNode = exclusionsNode.appendNode('exclusion')
30+
exclusionNode.appendNode('groupId', rule.group)
31+
exclusionNode.appendNode('artifactId', rule.module)
32+
}
33+
}
34+
}
35+
}
36+
}
37+
}
38+
}
39+
40+
// TODO: Consider refactoring this. See https://github.com/realm/realm-java/pull/7327#discussion_r586281652
41+
def populatePom(publication, pomName, pomDescription, pomDependencies = null) {
42+
publication.pom {
43+
name = "${pomName}"
44+
description = "${pomDescription}"
45+
url = 'https://docs.mongodb.com/realm'
46+
licenses {
47+
license {
48+
name = 'The Apache Software License, Version 2.0'
49+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
50+
distribution = 'repo'
51+
}
52+
}
53+
issueManagement {
54+
system = 'github'
55+
url = 'https://github.com/realm/realm-java/issues'
56+
}
57+
scm {
58+
url = 'scm:https://github.com/realm/realm-java'
59+
connection = 'scm:[email protected]:realm/realm-java.git'
60+
developerConnection = 'scm:[email protected]:realm/realm-java.git'
61+
}
62+
developers {
63+
developer {
64+
name = 'Realm'
65+
66+
organization = 'MongoDB'
67+
organizationUrl = 'https://www.mongodb.com'
68+
}
69+
}
70+
}
71+
if (pomDependencies) {
72+
publication.pom.withXml(pomDependencies)
73+
}
74+
}
75+
76+
publishing {
77+
repositories {
78+
maven {
79+
name = "MavenCentral"
80+
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
81+
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
82+
url = version.endsWith('-SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
83+
credentials {
84+
username = rootProject.ext["ossrhUsername"]
85+
password = rootProject.ext["ossrhPassword"]
86+
}
87+
}
88+
}
89+
}
90+
91+
signing {
92+
required { signBuild }
93+
def keyId = rootProject.ext["signing.keyId"]
94+
def ringFile = rootProject.ext["signing.secretKeyRingFile"]
95+
def password = rootProject.ext["signing.password"]
96+
useInMemoryPgpKeys(keyId, ringFile, password)
97+
sign publishing.publications
98+
}
99+
100+
// Export methods so they are available in other gradle files
101+
// https://stackoverflow.com/questions/18715137/extract-common-methods-from-gradle-build-script
102+
ext {
103+
createPomDependencies = this.&createPomDependencies
104+
populatePom = this.&populatePom
105+
}
106+

0 commit comments

Comments
 (0)