Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e2419af
re-writing accessors transformer using the new AGP API
nhachicha Jun 30, 2022
fbb9f08
cleanup
nhachicha Jun 30, 2022
8a3c558
Using Java 11
nhachicha Jul 10, 2022
a9a2575
Silencing Javadoc
nhachicha Jul 11, 2022
15a02d5
Project already evaluated
nhachicha Jul 11, 2022
207e5bc
WIP
nhachicha Jul 27, 2022
bf97b43
Fix sdk tests and all examples
rorbech Aug 10, 2022
13a9de5
Fix kotlin-extension tests
rorbech Aug 12, 2022
e1aeed2
Fix example projects according to latest updates
rorbech Aug 12, 2022
8ad69c6
Merge branch 'master' into nh/new_transformer
rorbech Aug 15, 2022
134a9bd
Revert annotations JDK target update
rorbech Aug 16, 2022
df23338
Fix processor test encoding issues
rorbech Aug 16, 2022
33081ef
Ensure JNI headers are generated before native build
rorbech Aug 16, 2022
3d780c8
Fix automatic dependency setup
rorbech Aug 22, 2022
f8940ce
Update to Core 12.5.1 and tests for raw queries with keyword field na…
rorbech Aug 29, 2022
1af01b7
Strip object server symbols from base artifacts
rorbech Aug 30, 2022
58a791e
Clean up
rorbech Aug 30, 2022
d895320
Merge branch 'master' into nh/new_transformer
rorbech Aug 30, 2022
8f17c24
Update version
rorbech Aug 30, 2022
eae54a1
Add CHANGELOG entry
rorbech Aug 31, 2022
98c6bbe
Update config.yml
geragray Sep 6, 2022
77225f1
Update config.yml
geragray Sep 6, 2022
a4f034b
Update config.yml
geragray Sep 6, 2022
535bfb2
Merge pull request #7718 from realm/geragray-patch-1
Sep 7, 2022
143fe75
Bump core 1.6.0 (#7717)
clementetb Sep 7, 2022
d7f3fda
Merge branch 'releases'
clementetb Sep 7, 2022
64a7000
Remove export compliance clause
nielsenko Sep 8, 2022
ba633a7
Merge pull request #7721 from realm/kn/clean-license
Sep 8, 2022
b057cab
Refactor EmailPasswordAuth tests to be less flaky. (#7723)
Sep 13, 2022
0357c11
Updates according to review comments
rorbech Sep 14, 2022
f7cde57
Merge branch 'master' into nh/new_transformer
rorbech Sep 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## 10.12.0 (YYYY-MM-DD)
## 10.12.0-transformer-api (YYYY-MM-DD)

### Breaking Changes
* Only works with Android Gradle Plugin 7.4 or newer. (Issue [#7714](https://github.com/realm/realm-java/issues/7714))

### Enhancements
* [RealmApp] Introduced `SyncSession.RecoverOrDiscardUnsyncedChangesStrategy`, an alternative automatic client reset strategy that tries to automatically recover any unsynced data from the client, and discards any unsynced data if not possible. This is now the default client reset policy if not explicitly set in the `SyncConfiguration`.
Expand Down
6 changes: 3 additions & 3 deletions dependencies.list
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ REALM_BAAS_GIT_HASH=ba172f8dd37c3102499ab7d728e7c0dcb9e52ae8
REALM_BAAS_UI_GIT_HASH=1fc10a6e04f87247790662d825500c9e21dbfbc7

# Common Android settings across projects
GRADLE_BUILD_TOOLS=7.1.0
GRADLE_BUILD_TOOLS=7.4.0-alpha08
ANDROID_BUILD_TOOLS=30.0.3
KOTLIN=1.5.31
KOTLIN_COROUTINES=1.5.2
KOTLIN=1.6.21
KOTLIN_COROUTINES=1.6.0

# Common classpath dependencies
gradle=7.3.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ static class ViewHolder extends RecyclerView.ViewHolder {
return;
}
AppCompatActivity activity = ContextUtils.findActivity(view.getContext());
PersonFragment personFragment = PersonFragment.create(person.getName());
// PersonFragment personFragment = PersonFragment.create(person.getName());
Comment thread
rorbech marked this conversation as resolved.
Outdated
PersonFragment personFragment = PersonFragment.create(person.name);
activity.getSupportFragmentManager()
.beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
Expand All @@ -132,7 +133,8 @@ public ViewHolder(View itemView) {

public void bind(Person person) {
this.person = person;
name.setText(person.getName());
// name.setText(person.getName());
name.setText(person.name);
age.setText(String.valueOf(person.getAge()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public class Person extends RealmObject {
@Index
private String name;
public String name;

private int age;

Expand Down
13 changes: 7 additions & 6 deletions examples/coroutinesExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

android {
compileSdkVersion rootProject.sdkVersion
// androidx.lifecycle dependencies requires Android APIs 31 or later
compileSdkVersion 31
buildToolsVersion rootProject.buildTools

defaultConfig {
Expand Down Expand Up @@ -57,18 +58,18 @@ dependencies {

implementation "androidx.fragment:fragment-ktx:1.2.5"

implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.4.0"

implementation "androidx.legacy:legacy-support-v4:1.0.0"

implementation "androidx.multidex:multidex:2.0.1"

implementation "androidx.recyclerview:recyclerview:1.1.0"

implementation "com.dropbox.mobile.store:store4:4.0.0"
implementation "com.dropbox.mobile.store:store4:4.0.5"

implementation "com.google.android.material:material:1.2.1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ protected void onCreate(Bundle savedInstanceState) {

RealmConfiguration realmConfiguration = new RealmConfiguration.Builder()
.encryptionKey(key)
.allowQueriesOnUiThread(true)
.allowWritesOnUiThread(true)
.build();

// Start with a clean slate every time
Expand Down
2 changes: 1 addition & 1 deletion examples/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-rc-2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import io.realm.OrderedRealmCollectionChangeListener;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import io.realm.RealmResults;
import io.realm.Sort;
import io.realm.examples.intro.model.Cat;
Expand Down Expand Up @@ -66,7 +67,10 @@ protected void onCreate(Bundle savedInstanceState) {
Realm.deleteRealm(Realm.getDefaultConfiguration());

// Create the Realm instance
realm = Realm.getDefaultInstance();
RealmConfiguration build = new RealmConfiguration.Builder()
.allowWritesOnUiThread(true)
.allowQueriesOnUiThread(true).build();
realm = Realm.getInstance(build);

// Asynchronous queries are evaluated on a background thread,
// and passed to the registered change listener when it's done.
Expand Down
2 changes: 0 additions & 2 deletions examples/kotlinExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ realm {
kotlinExtensionsEnabled = true
}


// enable @ParametersAreNonnullByDefault annotation. See https://blog.jetbrains.com/kotlin/2017/09/kotlin-1-1-50-is-out/
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
Expand All @@ -48,6 +47,5 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
implementation "org.jetbrains.anko:anko-commons:0.10.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.util.Log
import android.widget.LinearLayout
import android.widget.TextView
import io.realm.Realm
import io.realm.RealmConfiguration
import io.realm.Sort
import io.realm.examples.kotlin.model.Cat
import io.realm.examples.kotlin.model.Dog
Expand All @@ -46,6 +47,13 @@ class KotlinExampleActivity : Activity() {
rootLayout = findViewById(R.id.container)
rootLayout.removeAllViews()

Realm.setDefaultConfiguration(
RealmConfiguration.Builder()
.allowQueriesOnUiThread(true)
.allowWritesOnUiThread(true)
.build()
)

// Open the realm for the UI thread.
realm = Realm.getDefaultInstance()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import io.realm.examples.librarymodules.model.Elephant;
import io.realm.examples.librarymodules.model.Lion;
import io.realm.examples.librarymodules.model.Zebra;
import io.realm.examples.librarymodules.modules.AllAnimalsModule;
import io.realm.examples.librarymodules.modules.DomesticAnimalsModule;
import io.realm.examples.librarymodules.modules.ZooAnimalsModule;
import io.realm.exceptions.RealmException;
Expand All @@ -58,20 +59,29 @@ protected void onCreate(Bundle savedInstanceState) {
// The default Realm instance implicitly knows about all classes in the realmModuleAppExample Android Studio
// module. This does not include the classes from the realmModuleLibraryExample AS module so a Realm using this
// configuration would know about the following classes: { Cow, Pig, Snake, Spider }
RealmConfiguration defaultConfig = new RealmConfiguration.Builder().build();
RealmConfiguration defaultConfig = new RealmConfiguration
.Builder()
.modules(Realm.getDefaultModule(), new AllAnimalsModule())
.allowQueriesOnUiThread(true)
.allowWritesOnUiThread(true)
.build();

// It is possible to extend the default schema by adding additional Realm modules using modules(). This can
// also be Realm modules from libraries. The below Realm contains the following classes: { Cow, Pig, Snake,
// Spider, Cat, Dog }
RealmConfiguration farmAnimalsConfig = new RealmConfiguration.Builder()
.name("farm.realm")
.modules(Realm.getDefaultModule(), new DomesticAnimalsModule())
.allowQueriesOnUiThread(true)
.allowWritesOnUiThread(true)
.modules(Realm.getDefaultModule(), new AllAnimalsModule())
.build();

// Or you can completely replace the default schema.
// This Realm contains the following classes: { Elephant, Lion, Zebra, Snake, Spider }
RealmConfiguration exoticAnimalsConfig = new RealmConfiguration.Builder()
.name("exotic.realm")
.allowQueriesOnUiThread(true)
.allowWritesOnUiThread(true)
.modules(new ZooAnimalsModule(), new CreepyAnimalsModule())
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public class Zoo {
public Zoo() {
realmConfig = new RealmConfiguration.Builder() // The app is responsible for calling `Realm.init(Context)`
.name("library.zoo.realm") // So always use a unique name
.modules(new AllAnimalsModule()) // Always use explicit modules in library projects
.allowQueriesOnUiThread(true)
.allowWritesOnUiThread(true)
.modules(new AllAnimalsModule())
// Always use explicit modules in library projects
.build();

// Reset Realm
Expand Down
7 changes: 4 additions & 3 deletions examples/mongoDbRealmExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'realm-android'

android {
compileSdkVersion rootProject.sdkVersion
// androidx.lifecycle dependencies requires Android APIs 31 or later
compileSdkVersion 31
buildToolsVersion rootProject.buildTools

defaultConfig {
Expand Down Expand Up @@ -53,8 +54,8 @@ realm {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public class MyApplication extends Application {
public void onCreate() {
super.onCreate();
Realm.init(this);
RealmConfiguration configuration = new RealmConfiguration.Builder().deleteRealmIfMigrationNeeded().build();
RealmConfiguration configuration = new RealmConfiguration.Builder()
.deleteRealmIfMigrationNeeded()
.allowWritesOnUiThread(true)
.allowQueriesOnUiThread(true)
.build();
Realm.setDefaultConfiguration(configuration);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public class MyApplication extends Application {
public void onCreate() {
super.onCreate();
Realm.init(this);
RealmConfiguration config = new RealmConfiguration.Builder().build();
RealmConfiguration config = new RealmConfiguration.Builder()
.allowWritesOnUiThread(true)
.allowQueriesOnUiThread(true)
.build();
Realm.deleteRealm(config);
Realm.setDefaultConfiguration(config);
createTestData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public void onCreate() {

// Configure Realm for the application
Realm.init(this);
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().build();
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder()
.allowWritesOnUiThread(true)
.allowQueriesOnUiThread(true)
.build();
Realm.deleteRealm(realmConfiguration); // Clean slate
Realm.setDefaultConfiguration(realmConfiguration); // Make this Realm the default
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.widget.TextView;

import io.realm.Realm;
import io.realm.RealmConfiguration;
import io.realm.RealmResults;
import io.realm.examples.unittesting.model.Person;

Expand All @@ -43,7 +44,12 @@ protected void onCreate(Bundle savedInstanceState) {
rootLayout.removeAllViews();

// Open the default Realm for the UI thread.
realm = Realm.getDefaultInstance();
RealmConfiguration conf = new RealmConfiguration
.Builder()
.allowWritesOnUiThread(true)
.allowQueriesOnUiThread(true)
.build();
realm = Realm.getInstance(conf);

// Clean up from previous run
cleanUp();
Expand Down
18 changes: 10 additions & 8 deletions gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.gradle.api.internal.project.ProjectInternal
buildscript {
def properties = new Properties()
properties.load(new FileInputStream("${rootDir}/../dependencies.list"))

ext.kotlin_version = properties.get('KOTLIN')
repositories {
jcenter()
maven {
Expand All @@ -15,10 +15,12 @@ buildscript {
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:${properties.get('BUILD_INFO_EXTRACTOR_GRADLE')}"
classpath "io.github.gradle-nexus:publish-plugin:${properties.get("GRADLE_NEXUS_PLUGIN")}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

apply plugin: 'groovy-gradle-plugin'
apply plugin: 'kotlin'
apply plugin: 'java-gradle-plugin'
apply plugin: 'maven-publish'

def props = new Properties()
Expand All @@ -33,8 +35,8 @@ repositories {
jcenter()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 11
targetCompatibility = 11

group = 'io.realm'
version = file("${projectDir}/../version.txt").text.trim()
Expand Down Expand Up @@ -78,8 +80,8 @@ dependencies {
}

task generateVersionClass(type: Copy) {
from 'src/main/templates/Version.java'
into 'build/generated-src/main/java/io/realm'
from 'src/main/templates/Version.kt'
into 'build/generated-src/main/kotlin/io/realm'
filter(ReplaceTokens, tokens: [version: version])
outputs.upToDateWhen { false }
}
Expand All @@ -88,12 +90,12 @@ task generateVersionClass(type: Copy) {
sourceSets {
main {
java {
srcDir 'build/generated-src/main/java'
srcDirs += ['build/generated-src/main/kotlin']
}
}
}

compileJava.dependsOn generateVersionClass
compileKotlin.dependsOn generateVersionClass

apply from: "${rootDir}/../mavencentral-publications.gradle"
apply from: "${rootDir}/../mavencentral-publish.gradle"
Expand Down
2 changes: 1 addition & 1 deletion gradle-plugin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading