diff --git a/ActiveAndroid/build.gradle b/ActiveAndroid/build.gradle index 6096675..6f2c37a 100644 --- a/ActiveAndroid/build.gradle +++ b/ActiveAndroid/build.gradle @@ -11,7 +11,6 @@ repositories { } android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/Common/build.gradle b/Common/build.gradle index 38bca22..d1e3b4c 100644 --- a/Common/build.gradle +++ b/Common/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.library' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/Couchbase/build.gradle b/Couchbase/build.gradle index da5385a..fcd6675 100644 --- a/Couchbase/build.gradle +++ b/Couchbase/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/Cupboard/build.gradle b/Cupboard/build.gradle index 11d00dd..1c9d91c 100644 --- a/Cupboard/build.gradle +++ b/Cupboard/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/DBFlow/build.gradle b/DBFlow/build.gradle index 70ee67c..2f20bf4 100644 --- a/DBFlow/build.gradle +++ b/DBFlow/build.gradle @@ -11,7 +11,6 @@ repositories { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/Firebase/build.gradle b/Firebase/build.gradle index 312367a..5a1bfbc 100644 --- a/Firebase/build.gradle +++ b/Firebase/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/OrmLite/build.gradle b/OrmLite/build.gradle index bd0c190..0c06695 100644 --- a/OrmLite/build.gradle +++ b/OrmLite/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/Parse/build.gradle b/Parse/build.gradle index 378f8c0..e35d081 100644 --- a/Parse/build.gradle +++ b/Parse/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/Realm/build.gradle b/Realm/build.gradle index 5cffb5f..97fa26b 100644 --- a/Realm/build.gradle +++ b/Realm/build.gradle @@ -9,7 +9,6 @@ apply plugin: 'com.android.application' apply plugin: 'realm-android' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/Room/build.gradle b/Room/build.gradle index f847771..a108a6a 100644 --- a/Room/build.gradle +++ b/Room/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/SQLDelight/build.gradle b/SQLDelight/build.gradle index ecd83eb..5748f14 100644 --- a/SQLDelight/build.gradle +++ b/SQLDelight/build.gradle @@ -9,7 +9,6 @@ apply plugin: 'com.android.application' apply plugin: 'com.squareup.sqldelight' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { @@ -24,8 +23,8 @@ android { dependencies { androidTestCompile project(':Common') compile dep.supportAnnotations - provided 'com.google.auto.value:auto-value:1.5.1' - provided 'javax.annotation:jsr250-api:1.0' + compileOnly 'com.google.auto.value:auto-value:1.5.1' + compileOnly 'javax.annotation:jsr250-api:1.0' annotationProcessor 'com.google.auto.value:auto-value:1.5.1' } diff --git a/Sqlite/build.gradle b/Sqlite/build.gradle index 4def9db..73f91bd 100644 --- a/Sqlite/build.gradle +++ b/Sqlite/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/SquiDB/build.gradle b/SquiDB/build.gradle index e674459..c285df8 100644 --- a/SquiDB/build.gradle +++ b/SquiDB/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/SugarORM/.gitignore b/SugarORM/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/SugarORM/.gitignore @@ -0,0 +1 @@ +/build diff --git a/SugarORM/build.gradle b/SugarORM/build.gradle new file mode 100644 index 0000000..99d12e1 --- /dev/null +++ b/SugarORM/build.gradle @@ -0,0 +1,37 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + buildToolsVersion "28.0.3" + + + defaultConfig { + applicationId "de.greenrobot.performance.sugarorm" + minSdkVersion 19 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:28.0.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation('com.android.support.test.espresso:espresso-core:+', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + androidTestImplementation project(path: ':Common') + implementation 'com.github.satyan:sugar:1.5' +} diff --git a/SugarORM/proguard-rules.pro b/SugarORM/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/SugarORM/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/SugarORM/src/androidTest/java/de/greenrobot/performance/sugarorm/PerfTestSugarorm.java b/SugarORM/src/androidTest/java/de/greenrobot/performance/sugarorm/PerfTestSugarorm.java new file mode 100644 index 0000000..1837552 --- /dev/null +++ b/SugarORM/src/androidTest/java/de/greenrobot/performance/sugarorm/PerfTestSugarorm.java @@ -0,0 +1,117 @@ +package de.greenrobot.performance.sugarorm; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import com.orm.SugarRecord; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.ArrayList; +import java.util.List; + +import de.greenrobot.performance.BasePerfTestCase; +import de.greenrobot.performance.Benchmark; + +import static org.junit.Assert.*; + +/** + * @see Getting started with Sugar ORM + */ +@RunWith(AndroidJUnit4.class) +public class PerfTestSugarorm extends BasePerfTestCase { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("de.greenrobot.performance.sugarorm", appContext.getPackageName()); + } + + @Override + protected void doOneByOneCrudRun(int count) throws Exception { + final List list = new ArrayList<>(); + + for (long i = 0; i < count; i++) + list.add(createSimpleEntityNotNull(i)); + + startClock(); + for (int i = 0; i < count; i++) { + list.get(i).save(); + } + stopClock(Benchmark.Type.ONE_BY_ONE_CREATE); + + startClock(); + for (int i = 0; i < count; i++) { + SimpleEntityNotNull.findById(SimpleEntityNotNull.class, i).save(); + } + stopClock(Benchmark.Type.ONE_BY_ONE_UPDATE); + + deleteAll(SimpleEntityNotNull.class); + } + + @Override + protected void doBatchCrudRun(int count) throws Exception { + final List list = new ArrayList<>(); + + for (long i = 0; i < count; i++) { + list.add(createSimpleEntityNotNull(i)); + } + + startClock(); + SugarRecord.saveInTx(list); + stopClock(Benchmark.Type.BATCH_CREATE); + + startClock(); + SugarRecord.updateInTx(list); + stopClock(Benchmark.Type.BATCH_UPDATE); + + startClock(); + List reloaded = SugarRecord.listAll(SimpleEntityNotNull.class); + stopClock(Benchmark.Type.BATCH_READ); + + startClock(); + for (int i = 0; i < reloaded.size(); i++) { + SimpleEntityNotNull entity = reloaded.get(i); + entity.getId(); + entity.getSimpleBoolean(); + entity.getSimpleByte(); + entity.getSimpleShort(); + entity.getSimpleInt(); + entity.getSimpleLong(); + entity.getSimpleFloat(); + entity.getSimpleDouble(); + entity.getSimpleString(); + entity.getReplaceByteArray(); + } + stopClock(Benchmark.Type.BATCH_ACCESS); + + startClock(); + deleteAll(SimpleEntityNotNull.class); + stopClock(Benchmark.Type.BATCH_DELETE); + } + + private static SimpleEntityNotNull createSimpleEntityNotNull(Long key) { + if (key == null) { + return null; + } + SimpleEntityNotNull entity = new SimpleEntityNotNull(); + entity.setId(key); + entity.setSimpleBoolean(true); + entity.setSimpleByte(Integer.MAX_VALUE); + entity.setSimpleShort(Short.MAX_VALUE); + entity.setSimpleInt(Integer.MAX_VALUE); + entity.setSimpleLong(Long.MAX_VALUE); + entity.setSimpleFloat(Float.MAX_VALUE); + entity.setSimpleDouble(Double.MAX_VALUE); + entity.setSimpleString("greenrobot greenDAO"); + entity.replaceByteArray = "42, -17, 23, 0, 127, -128"; + return entity; + } + + private static void deleteAll(Class type) { + SugarRecord.deleteAll(type); + } +} diff --git a/SugarORM/src/main/AndroidManifest.xml b/SugarORM/src/main/AndroidManifest.xml new file mode 100644 index 0000000..0c93a0b --- /dev/null +++ b/SugarORM/src/main/AndroidManifest.xml @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/SugarORM/src/main/java/de/greenrobot/performance/sugarorm/IndexedStringEntity.java b/SugarORM/src/main/java/de/greenrobot/performance/sugarorm/IndexedStringEntity.java new file mode 100644 index 0000000..500a8bf --- /dev/null +++ b/SugarORM/src/main/java/de/greenrobot/performance/sugarorm/IndexedStringEntity.java @@ -0,0 +1,19 @@ +package de.greenrobot.performance.sugarorm; + +import com.orm.dsl.Table; +import com.orm.dsl.Unique; + +@Table +public class IndexedStringEntity { + @Unique + long id; + String indexedString; + + public IndexedStringEntity(long id, String indexedString) { + this.id = id; + this.indexedString = indexedString; + } + + public IndexedStringEntity() { + } +} diff --git a/SugarORM/src/main/java/de/greenrobot/performance/sugarorm/SimpleEntityNotNull.java b/SugarORM/src/main/java/de/greenrobot/performance/sugarorm/SimpleEntityNotNull.java new file mode 100644 index 0000000..ab5d839 --- /dev/null +++ b/SugarORM/src/main/java/de/greenrobot/performance/sugarorm/SimpleEntityNotNull.java @@ -0,0 +1,121 @@ +package de.greenrobot.performance.sugarorm; + +import com.orm.SugarRecord; +import com.orm.dsl.Unique; + +public class SimpleEntityNotNull extends SugarRecord { + + @Unique + long id; + + boolean simpleBoolean; + int simpleByte; + short simpleShort; + int simpleInt; + long simpleLong; + float simpleFloat; + double simpleDouble; + /** Not-null value. */ + String simpleString; + /** Storing lists and arrays not supported yet */ +// byte[] simpleByteArray; + String replaceByteArray; + + public SimpleEntityNotNull(long id, boolean simpleBoolean, int simpleByte, short simpleShort, int simpleInt, long simpleLong, float simpleFloat, double simpleDouble, String simpleString, String replaceByteArray) { + this.id = id; + this.simpleBoolean = simpleBoolean; + this.simpleByte = simpleByte; + this.simpleShort = simpleShort; + this.simpleInt = simpleInt; + this.simpleLong = simpleLong; + this.simpleFloat = simpleFloat; + this.simpleDouble = simpleDouble; + this.simpleString = simpleString; + this.replaceByteArray = replaceByteArray; + + } + + public SimpleEntityNotNull() { + } + + public void setId(long id) { + this.id = id; + } + + public void setSimpleBoolean(boolean simpleBoolean) { + this.simpleBoolean = simpleBoolean; + } + + public void setSimpleByte(int simpleByte) { + this.simpleByte = simpleByte; + } + + public void setSimpleShort(short simpleShort) { + this.simpleShort = simpleShort; + } + + public void setSimpleInt(int simpleInt) { + this.simpleInt = simpleInt; + } + + public void setSimpleLong(long simpleLong) { + this.simpleLong = simpleLong; + } + + public void setSimpleFloat(float simpleFloat) { + this.simpleFloat = simpleFloat; + } + + public void setSimpleDouble(double simpleDouble) { + this.simpleDouble = simpleDouble; + } + + public void setSimpleString(String simpleString) { + this.simpleString = simpleString; + } + + public void setReplaceByteArray(String replaceByteArray) { + this.replaceByteArray = replaceByteArray; + } + + @Override + public Long getId() { + return id; + } + + public boolean getSimpleBoolean() { + return simpleBoolean; + } + + public int getSimpleByte() { + return simpleByte; + } + + public short getSimpleShort() { + return simpleShort; + } + + public int getSimpleInt() { + return simpleInt; + } + + public long getSimpleLong() { + return simpleLong; + } + + public float getSimpleFloat() { + return simpleFloat; + } + + public double getSimpleDouble() { + return simpleDouble; + } + + public String getSimpleString() { + return simpleString; + } + + public String getReplaceByteArray() { + return replaceByteArray; + } +} diff --git a/SugarORM/src/main/res/drawable-v24/ic_launcher_foreground.xml b/SugarORM/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..1f6bb29 --- /dev/null +++ b/SugarORM/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/SugarORM/src/main/res/drawable/ic_launcher_background.xml b/SugarORM/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..0d025f9 --- /dev/null +++ b/SugarORM/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SugarORM/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/SugarORM/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/SugarORM/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/SugarORM/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/SugarORM/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/SugarORM/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/SugarORM/src/main/res/mipmap-hdpi/ic_launcher.png b/SugarORM/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..898f3ed Binary files /dev/null and b/SugarORM/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/SugarORM/src/main/res/mipmap-hdpi/ic_launcher_round.png b/SugarORM/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..dffca36 Binary files /dev/null and b/SugarORM/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/SugarORM/src/main/res/mipmap-mdpi/ic_launcher.png b/SugarORM/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..64ba76f Binary files /dev/null and b/SugarORM/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/SugarORM/src/main/res/mipmap-mdpi/ic_launcher_round.png b/SugarORM/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..dae5e08 Binary files /dev/null and b/SugarORM/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/SugarORM/src/main/res/mipmap-xhdpi/ic_launcher.png b/SugarORM/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..e5ed465 Binary files /dev/null and b/SugarORM/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/SugarORM/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/SugarORM/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..14ed0af Binary files /dev/null and b/SugarORM/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/SugarORM/src/main/res/mipmap-xxhdpi/ic_launcher.png b/SugarORM/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..b0907ca Binary files /dev/null and b/SugarORM/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/SugarORM/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/SugarORM/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..d8ae031 Binary files /dev/null and b/SugarORM/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/SugarORM/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/SugarORM/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..2c18de9 Binary files /dev/null and b/SugarORM/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/SugarORM/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/SugarORM/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..beed3cd Binary files /dev/null and b/SugarORM/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/SugarORM/src/main/res/values/colors.xml b/SugarORM/src/main/res/values/colors.xml new file mode 100644 index 0000000..69b2233 --- /dev/null +++ b/SugarORM/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #008577 + #00574B + #D81B60 + diff --git a/SugarORM/src/main/res/values/strings.xml b/SugarORM/src/main/res/values/strings.xml new file mode 100644 index 0000000..5e716d3 --- /dev/null +++ b/SugarORM/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + SugarORM + diff --git a/SugarORM/src/main/res/values/styles.xml b/SugarORM/src/main/res/values/styles.xml new file mode 100644 index 0000000..5885930 --- /dev/null +++ b/SugarORM/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/build.gradle b/build.gradle index dd51a0d..a6a598d 100644 --- a/build.gradle +++ b/build.gradle @@ -9,6 +9,10 @@ subprojects { mavenCentral() google() } + + dependencies { + classpath 'com.android.tools.build:gradle:3.4.0' + } } repositories { @@ -19,7 +23,7 @@ subprojects { } } -task wrapper(type: Wrapper) { +wrapper { gradleVersion = '4.1' distributionType = org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bf1b63c..2f5b0e4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sat May 11 13:23:38 MSK 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/greenDAO/build.gradle b/greenDAO/build.gradle index 129b0f2..1c5533c 100644 --- a/greenDAO/build.gradle +++ b/greenDAO/build.gradle @@ -9,7 +9,6 @@ apply plugin: 'com.android.application' apply plugin: 'org.greenrobot.greendao' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/requery/build.gradle b/requery/build.gradle index f36d0d0..58f146d 100644 --- a/requery/build.gradle +++ b/requery/build.gradle @@ -7,7 +7,6 @@ buildscript { apply plugin: 'com.android.application' android { - buildToolsVersion rootProject.ext.buildToolsVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { diff --git a/settings.gradle b/settings.gradle index 4e08dfe..6c02194 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -include ':Common' +include ':Common', ':SugarORM' include ':ActiveAndroid' include ':Couchbase' include ':Cupboard'