From cae79a6fca99c63ce45d617429983e9c1bd48994 Mon Sep 17 00:00:00 2001 From: Colin Miller Date: Sun, 25 Oct 2020 18:24:54 -0700 Subject: [PATCH 1/6] Updated project to recent android versions Fixed the tests to go away from the old ActivityUnitTest. Updated the build files. --- SimpleNoSQL/build.gradle | 85 ++++++++------- .../simplenosql/NoSQLDeleteTaskTest.java | 65 ++++++----- .../simplenosql/NoSQLEntityTest.java | 14 ++- .../simplenosql/NoSQLRetrieveTaskTest.java | 101 +++++++----------- .../simplenosql/NoSQLSaveTaskTest.java | 35 +++--- .../simplenosql/SynchronousTest.java | 31 +++--- build.gradle | 14 +-- gradle.properties | 37 +++---- gradle/wrapper/gradle-wrapper.properties | 4 +- settings.gradle | 1 + 10 files changed, 188 insertions(+), 199 deletions(-) diff --git a/SimpleNoSQL/build.gradle b/SimpleNoSQL/build.gradle index 24e5f31..19f26df 100644 --- a/SimpleNoSQL/build.gradle +++ b/SimpleNoSQL/build.gradle @@ -1,52 +1,63 @@ -apply plugin: 'com.android.library' +plugins { + id 'com.android.library' +} android { - compileSdkVersion 21 - buildToolsVersion '21.1.2' - publishNonDefault true + compileSdkVersion 30 + buildToolsVersion '30.0.2' defaultConfig { - minSdkVersion 8 - targetSdkVersion 21 + minSdkVersion 14 + targetSdkVersion 30 versionCode 2 versionName "0.5" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" } - sourceSets { - main { - java { - srcDir 'src/main/java' - } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } -} -android.libraryVariants.all { variant -> - def name = variant.buildType.name - if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { - return; // Skip debug builds. + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } - def task = project.tasks.create "_jar${name.capitalize()}", Jar - task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - print variant.javaCompile.destinationDir.toString() - artifacts.add('archives', task); } -android.libraryVariants.all { variant -> - task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) { - description "Generates Javadoc for $variant.name." - source = variant.javaCompile.source - ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" - classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) - options.links("http://docs.oracle.com/javase/7/docs/api/"); - options.links("http://d.android.com/reference/"); - exclude '**/BuildConfig.java' - exclude '**/R.java' - } -} +// +//android.libraryVariants.all { variant -> +// def name = variant.buildType.name +// if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { +// return; // Skip debug builds. +// } +// def task = project.tasks.create "_jar${name.capitalize()}", Jar +// task.dependsOn variant.javaCompile +// task.from variant.javaCompile.destinationDir +// print variant.javaCompile.destinationDir.toString() +// artifacts.add('archives', task); +//} +// +//android.libraryVariants.all { variant -> +// task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) { +// description "Generates Javadoc for $variant.name." +// source = variant.javaCompile.source +// ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" +// classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) +// options.links("http://docs.oracle.com/javase/7/docs/api/"); +// options.links("http://d.android.com/reference/"); +// exclude '**/BuildConfig.java' +// exclude '**/R.java' +// } +//} dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.google.code.gson:gson:2.3' -} + api 'com.google.code.gson:gson:2.8.5' -apply from: '../maven_push.gradle' + testImplementation 'junit:junit:4.13.1' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' +} diff --git a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLDeleteTaskTest.java b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLDeleteTaskTest.java index f418182..59b91f9 100644 --- a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLDeleteTaskTest.java +++ b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLDeleteTaskTest.java @@ -1,34 +1,42 @@ package com.colintmiller.simplenosql; -import android.app.Activity; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import android.test.ActivityUnitTestCase; + +import androidx.test.ext.junit.runners.AndroidJUnit4; + import com.colintmiller.simplenosql.db.SimpleNoSQLContract; import com.colintmiller.simplenosql.db.SimpleNoSQLDBHelper; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + /** * Tests to verify the deletion asyncTask performs as expected */ -public class NoSQLDeleteTaskTest extends ActivityUnitTestCase { +@RunWith(AndroidJUnit4.class) +public class NoSQLDeleteTaskTest { private GsonSerialization serialization; private Context context; private CountDownLatch signal; public NoSQLDeleteTaskTest() { - super(Activity.class); serialization = new GsonSerialization(); } - @Override + @Before public void setUp() throws Exception { - super.setUp(); context = getInstrumentation().getTargetContext(); signal = new CountDownLatch(1); } @@ -42,6 +50,7 @@ public void hasFinished() { }; } + @Test public void testDeleteEntity() throws Throwable { NoSQLEntity entity = new NoSQLEntity("delete", "first"); NoSQLEntity entity2 = new NoSQLEntity("delete", "second"); @@ -52,33 +61,26 @@ public void testDeleteEntity() throws Throwable { entity.setData(bean1); entity2.setData(bean2); - final List> entities = new ArrayList>(2); + final List> entities = new ArrayList<>(2); entities.add(entity); entities.add(entity2); - runTestOnUiThread(new Runnable() { - @Override - public void run() { - NoSQL.with(context).using(SampleBean.class) - .addObserver(getObserver()) - .save(entities); - } - }); + // setup entities + NoSQL.with(context).using(SampleBean.class) + .addObserver(getObserver()) + .save(entities); signal.await(2, TimeUnit.SECONDS); signal = new CountDownLatch(1); - runTestOnUiThread(new Runnable() { - @Override - public void run() { - NoSQL.with(context).using(SampleBean.class) - .bucketId("delete") - .entityId("first") - .addObserver(getObserver()) - .delete(); - } - }); + // call delete + NoSQL.with(context).using(SampleBean.class) + .bucketId("delete") + .entityId("first") + .addObserver(getObserver()) + .delete(); + signal.await(2, TimeUnit.SECONDS); SimpleNoSQLDBHelper sqldbHelper = new SimpleNoSQLDBHelper(getInstrumentation().getTargetContext(), serialization, serialization); @@ -94,6 +96,7 @@ public void run() { assertEquals(1, cursor.getCount()); } + @Test public void testDeleteBucket() throws Throwable { final List> lots = new ArrayList>(10); for (int i = 0; i < 10; i++) { @@ -105,27 +108,19 @@ public void testDeleteBucket() throws Throwable { lots.add(entity); } - runTestOnUiThread(new Runnable() { - @Override - public void run() { NoSQL.with(context).using(SampleBean.class) .addObserver(getObserver()) .save(lots); - } - }); signal.await(2, TimeUnit.SECONDS); signal = new CountDownLatch(1); - runTestOnUiThread(new Runnable() { - @Override - public void run() { + NoSQL.with(context).using(SampleBean.class) .bucketId("delete") .addObserver(getObserver()) .delete(); - } - }); + signal.await(2, TimeUnit.SECONDS); SimpleNoSQLDBHelper sqldbHelper = new SimpleNoSQLDBHelper(getInstrumentation().getTargetContext(), serialization, serialization); diff --git a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLEntityTest.java b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLEntityTest.java index 1932940..8bdf4e4 100644 --- a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLEntityTest.java +++ b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLEntityTest.java @@ -1,24 +1,29 @@ package com.colintmiller.simplenosql; +import androidx.test.ext.junit.runners.AndroidJUnit4; -import android.app.Activity; -import android.test.ActivityUnitTestCase; +import org.junit.Test; +import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.List; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + /** * Tests for NSQLEntity and it's various functions. */ -public class NoSQLEntityTest extends ActivityUnitTestCase { +@RunWith(AndroidJUnit4.class) +public class NoSQLEntityTest { private GsonSerialization serialization; public NoSQLEntityTest() { - super(Activity.class); serialization = new GsonSerialization(); } + @Test public void testJsonConversion() { SampleBean testData = new SampleBean(); testData.setName("Colin"); @@ -43,6 +48,7 @@ public void testJsonConversion() { assertEquals(testData, waterData); } + @Test public void testUUID() { SampleBean testData = new SampleBean(); testData.setName("Colin"); diff --git a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLRetrieveTaskTest.java b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLRetrieveTaskTest.java index 07d2c81..d694331 100644 --- a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLRetrieveTaskTest.java +++ b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLRetrieveTaskTest.java @@ -1,26 +1,37 @@ package com.colintmiller.simplenosql; -import android.app.Activity; import android.content.Context; -import android.test.ActivityUnitTestCase; + +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + /** * Tests for the RetrieveTask for querying data from the DB. This includes querying a single entity or * an entire bucket. */ -public class NoSQLRetrieveTaskTest extends ActivityUnitTestCase { +@RunWith(AndroidJUnit4.class) +public class NoSQLRetrieveTaskTest { private String bucketId; private CountDownLatch signal; private List> results; private Context context; public NoSQLRetrieveTaskTest() { - super(Activity.class); bucketId = "retrieveTests"; results = new ArrayList>(); } @@ -35,27 +46,18 @@ public void retrievedResults(List> noSQLEntities) { }; } - @Override + @Before public void setUp() throws Exception { - super.setUp(); this.context = getInstrumentation().getTargetContext(); - try { - runTestOnUiThread(new Runnable() { - @Override - public void run() { - signal = TestUtils.cleanBucket(bucketId, context); - } - }); - } catch (Throwable throwable) { - // an error happened - throw new Exception(throwable); - } + signal = TestUtils.cleanBucket(bucketId, context); + signal.await(2, TimeUnit.SECONDS); signal = new CountDownLatch(1); } + @Test public void testRetrievalBuilder() throws Throwable { NoSQLEntity entity = getTestEntry(bucketId, "entity"); SampleBean bean = new SampleBean(); @@ -64,19 +66,15 @@ public void testRetrievalBuilder() throws Throwable { saveBean(entity); - runTestOnUiThread(new Runnable() { - @Override - public void run() { NoSQL.with(context).using(SampleBean.class) .bucketId(bucketId) .retrieve(getCallback()); - } - }); signal.await(2, TimeUnit.SECONDS); assertFalse("We should have results", results.isEmpty()); } + @Test public void testGettingStoredData() throws Throwable { final String entityId = "entityId"; @@ -96,7 +94,7 @@ private void gettingStoredDataWithRunnable(final String entityId, Runnable runna NoSQLEntity entity = getTestEntry(bucketId, entityId); saveBean(entity); - runTestOnUiThread(runnable); + runnable.run(); signal.await(2, TimeUnit.SECONDS); @@ -117,6 +115,7 @@ private void gettingStoredDataWithRunnable(final String entityId, Runnable runna } } + @Test public void testGettingFilteredResults() throws Throwable { NoSQLEntity entity1 = getTestEntry(bucketId, "entity1"); @@ -131,15 +130,11 @@ public boolean isIncluded(NoSQLEntity item) { } }; - runTestOnUiThread(new Runnable() { - @Override - public void run() { NoSQL.with(context).using(SampleBean.class) .bucketId(bucketId) .filter(filter) .retrieve(getCallback()); - } - }); + signal.await(2, TimeUnit.SECONDS); assertNotNull("The list of entities should not be null", results); @@ -147,6 +142,7 @@ public void run() { assertEquals("entity2", results.get(0).getId()); } + @Test public void testGettingOrderedResults() throws Throwable { List> entities = new ArrayList>(5); @@ -185,15 +181,10 @@ public int compare(NoSQLEntity lhs, NoSQLEntity rhs) { } }; - runTestOnUiThread(new Runnable() { - @Override - public void run() { NoSQL.with(context).using(SampleBean.class) .bucketId(bucketId) .orderBy(comparator) .retrieve(getCallback()); - } - }); signal.await(2, TimeUnit.SECONDS); @@ -206,41 +197,33 @@ public void run() { assertEquals(4, results.get(4).getData().getId()); } + @Test public void testNoBucket() throws Throwable { - runTestOnUiThread(new Runnable() { - @Override - public void run() { + NoSQL.with(context).using(SampleBean.class) .retrieve(getCallback()); - } - }); + signal.await(2, TimeUnit.SECONDS); assertTrue("Results should be empty", results.isEmpty()); } - + @Test public void testNoEntity() throws Throwable { - runTestOnUiThread(new Runnable() { - @Override - public void run() { + NoSQL.with(context).using(SampleBean.class) .addObserver(getObserver()) .save(new NoSQLEntity("null", "nullitem")); - } - }); + signal.await(2, TimeUnit.SECONDS); signal = new CountDownLatch(1); - runTestOnUiThread(new Runnable() { - @Override - public void run() { + NoSQL.with(context).using(SampleBean.class) .bucketId("null") .entityId("nullitem") .retrieve(getCallback()); - } - }); + signal.await(2, TimeUnit.SECONDS); assertFalse("Results should not be empty with a null entry", results.isEmpty()); @@ -248,6 +231,7 @@ public void run() { } + @Test public void testOldData() throws Throwable { OldSampleBean oldBean = new OldSampleBean(); oldBean.setName("Colin"); @@ -257,26 +241,19 @@ public void testOldData() throws Throwable { final NoSQLEntity oldEntity = new NoSQLEntity("oldbucket", "old"); oldEntity.setData(oldBean); - runTestOnUiThread(new Runnable() { - @Override - public void run() { + NoSQL.with(context).using(OldSampleBean.class) .addObserver(getObserver()) .save(oldEntity); - } - }); + signal.await(2, TimeUnit.SECONDS); signal = new CountDownLatch(1); - runTestOnUiThread(new Runnable() { - @Override - public void run() { NoSQL.with(context).using(SampleBean.class) .bucketId("oldbucket") .entityId("old") .retrieve(getCallback()); - } - }); + signal.await(2, TimeUnit.SECONDS); assertFalse("Should have gotten results", results.isEmpty()); @@ -305,9 +282,7 @@ private void saveBean(final NoSQLEntity... bean) throws Throwable { } final CountDownLatch saveLatch = new CountDownLatch(1); - runTestOnUiThread(new Runnable() { - @Override - public void run() { + NoSQL.with(context).using(SampleBean.class) .addObserver(new OperationObserver() { @@ -317,8 +292,6 @@ public void hasFinished() { } }) .save(beans); - } - }); saveLatch.await(3, TimeUnit.SECONDS); } diff --git a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLSaveTaskTest.java b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLSaveTaskTest.java index 9fd3b1e..03b1da1 100644 --- a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLSaveTaskTest.java +++ b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/NoSQLSaveTaskTest.java @@ -1,38 +1,47 @@ package com.colintmiller.simplenosql; -import android.app.Activity; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import android.test.ActivityUnitTestCase; + +import androidx.test.ext.junit.runners.AndroidJUnit4; + import com.colintmiller.simplenosql.db.SimpleNoSQLContract; import com.colintmiller.simplenosql.db.SimpleNoSQLDBHelper; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + /** * Tests for saving entities to the DB. This includes saving a single entity or saving multiple entities. */ -public class NoSQLSaveTaskTest extends ActivityUnitTestCase { +@RunWith(AndroidJUnit4.class) +public class NoSQLSaveTaskTest { private GsonSerialization serialization; private CountDownLatch signal; private Context context; public NoSQLSaveTaskTest() { - super(Activity.class); serialization = new GsonSerialization(); } - @Override + @Before public void setUp() throws Exception { - super.setUp(); signal = new CountDownLatch(1); this.context = getInstrumentation().getTargetContext(); } + @Test public void testSaveEntity() throws Throwable { final NoSQLEntity entity = new NoSQLEntity("test", "first"); SampleBean data = new SampleBean(); @@ -40,14 +49,10 @@ public void testSaveEntity() throws Throwable { data.setId(1); entity.setData(data); - runTestOnUiThread(new Runnable() { - @Override - public void run() { NoSQL.with(context).using(SampleBean.class) .addObserver(getObserver()) .save(entity); - } - }); + signal.await(3, TimeUnit.SECONDS); assertNotNull("Activity is null when it should not have been", getInstrumentation().getTargetContext()); @@ -63,6 +68,7 @@ public void run() { assertEquals(cursor.getCount(), 1); } + @Test public void testSaveEntities() throws Throwable { final List> allEntities = new ArrayList>(3); for(int i = 0; i < 3; i++) { @@ -74,14 +80,11 @@ public void testSaveEntities() throws Throwable { allEntities.add(entity); } - runTestOnUiThread(new Runnable() { - @Override - public void run() { + NoSQL.with(context).using(SampleBean.class) .addObserver(getObserver()) .save(allEntities); - } - }); + signal.await(2, TimeUnit.SECONDS); diff --git a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/SynchronousTest.java b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/SynchronousTest.java index bf1f2de..514b73f 100644 --- a/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/SynchronousTest.java +++ b/SimpleNoSQL/src/androidTest/java/com/colintmiller/simplenosql/SynchronousTest.java @@ -1,34 +1,39 @@ package com.colintmiller.simplenosql; -import android.app.Activity; import android.content.Context; import android.os.Handler; import android.os.HandlerThread; -import android.test.ActivityUnitTestCase; + +import androidx.test.ext.junit.runners.AndroidJUnit4; + import com.colintmiller.simplenosql.threading.QueryDelivery; import com.colintmiller.simplenosql.toolbox.SynchronousRetrieval; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; +import static org.junit.Assert.assertEquals; + /** * Created by cmiller on 10/21/14. */ -public class SynchronousTest extends ActivityUnitTestCase { +@RunWith(AndroidJUnit4.class) +public class SynchronousTest { private Context context; - public SynchronousTest() { - super(Activity.class); - } - - @Override + @Before public void setUp() throws Exception { - super.setUp(); this.context = getInstrumentation().getTargetContext(); } + @Test public void testSynchronousGet() throws Throwable { final CountDownLatch latch = new CountDownLatch(1); final List result = new ArrayList(); @@ -44,6 +49,7 @@ public void retrievedResults(List> noSQLEntities) { assertEquals(1, result.size()); } + @Test public void testSynchronousRetrieval() throws Throwable { SampleBean item = new SampleBean(); item.setName("item"); @@ -67,14 +73,12 @@ public void hasFinished() { * * @throws Throwable if something goes horribly wrong */ + @Test public void testSynchronousUIRetrieval() throws Throwable { final CountDownLatch lock = new CountDownLatch(1); final List> results = new ArrayList>(); - runTestOnUiThread(new Runnable() { - @Override - public void run() { final CountDownLatch saveLock = new CountDownLatch(1); SampleBean item = new SampleBean(); item.setName("item"); @@ -97,8 +101,7 @@ public void hasFinished() { results.addAll(retrievalCallback.getSynchronousResults()); lock.countDown(); - } - }); + lock.await(); assertEquals(1, results.size()); diff --git a/build.gradle b/build.gradle index 7bc804c..79fcf3d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,10 +5,11 @@ def isReleaseBuild() { buildscript { repositories { - mavenCentral() + google() + jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.0' + classpath 'com.android.tools.build:gradle:4.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -16,12 +17,13 @@ buildscript { } allprojects { - version = VERSION_NAME - group = GROUP repositories { - mavenCentral() + google() + jcenter() } } -apply plugin: 'android-reporting' +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gradle.properties b/gradle.properties index 7f4c61b..cf42136 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,33 +1,28 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit +## For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html - +# # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m +# Default value: -Xmx1024m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - +# # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true - -VERSION_NAME=0.5.1 -VERSION_CODE=2 +#Sun Oct 25 17:51:43 PDT 2020 GROUP=com.colintmiller - POM_DESCRIPTION=Android Library for a simple NoSQL data layer -POM_URL=https://github.com/Jearil/SimpleNoSQL -POM_SCM_URL=https://github.com/Jearil/SimpleNoSQL -POM_SCM_CONNECTION=scm:git@github.com:Jearil/SimpleNoSQL.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:Jearil/SimpleNoSQL.git -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt -POM_LICENCE_DIST=repo POM_DEVELOPER_ID=Jearil POM_DEVELOPER_NAME=Colin Miller +POM_LICENCE_DIST=repo +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=http\://www.apache.org/licenses/LICENSE-2.0.txt +POM_SCM_CONNECTION=scm\:git@github.com\:Jearil/SimpleNoSQL.git +POM_SCM_DEV_CONNECTION=scm\:git@github.com\:Jearil/SimpleNoSQL.git +POM_SCM_URL=https\://github.com/Jearil/SimpleNoSQL +POM_URL=https\://github.com/Jearil/SimpleNoSQL +VERSION_CODE=2 +VERSION_NAME=0.5.1 +android.enableJetifier=true +android.useAndroidX=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5c86c05..226ca83 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 22 15:27:56 PST 2014 +#Sun Oct 25 13:12:38 PDT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip diff --git a/settings.gradle b/settings.gradle index 775d93f..c687fe2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,2 @@ include ':SimpleNoSQL' +rootProject.name = "SimpleNoSQL" \ No newline at end of file From 264ab9baf67b96b422ad064325fb2227618aad1d Mon Sep 17 00:00:00 2001 From: Colin Miller Date: Sun, 25 Oct 2020 21:34:43 -0700 Subject: [PATCH 2/6] Updating travis Hopefully this will get CI working again. --- .travis.yml | 37 +++++++++++++++++++++++-------------- gradle.properties | 2 +- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0da3ec8..37f8a95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,32 @@ language: android -jdk: oraclejdk7 -# turn off caching to avoid caching problems -cache: false -# Use travis container-based infrastructure -sudo: false -env: - global: - - ADB_INSTALL_TIMEOUT=8 +dist: trusty # Emulator Management: Create, Start and Wait before_script: - - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a - - emulator -avd test -no-skin -no-audio -no-window & + - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a -c 100M + - emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & android: components: - - build-tools-21.1.1 - - android-21 - - extra - - sys-img-armeabi-v7a-android-21 + # Uncomment the lines below if you want to + # use the latest revision of Android SDK Tools + # - tools + # - platform-tools + + # The BuildTools version used by your project + - build-tools-26.0.2 + + # The SDK version used to compile your project + - android-26 + + # Additional components + - extra-google-google_play_services + - extra-google-m2repository + - extra-android-m2repository + + # Specify at least one system image, + # if you need to run emulator(s) during your tests + - sys-img-x86-android-26 + - sys-img-armeabi-v7a-android-17 \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index cf42136..470e591 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,6 +23,6 @@ POM_SCM_DEV_CONNECTION=scm\:git@github.com\:Jearil/SimpleNoSQL.git POM_SCM_URL=https\://github.com/Jearil/SimpleNoSQL POM_URL=https\://github.com/Jearil/SimpleNoSQL VERSION_CODE=2 -VERSION_NAME=0.5.1 +VERSION_NAME=0.5.2 android.enableJetifier=true android.useAndroidX=true From 88746c85c26c485bba1c5119e4d172b703f5e2e8 Mon Sep 17 00:00:00 2001 From: Colin Miller Date: Sun, 25 Oct 2020 22:02:08 -0700 Subject: [PATCH 3/6] Adding Javadoc creation and updating travis Seems to be an issue with the emulator version for travis. Trying a new one. --- .travis.yml | 3 ++- SimpleNoSQL/build.gradle | 49 ++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37f8a95..1d91e7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,8 @@ dist: trusty # Emulator Management: Create, Start and Wait before_script: - - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a -c 100M + - android list targets + - echo no | android create avd --force -n test -t android-26 --abi armeabi-v7a -c 100M - emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & diff --git a/SimpleNoSQL/build.gradle b/SimpleNoSQL/build.gradle index 19f26df..4c82c68 100644 --- a/SimpleNoSQL/build.gradle +++ b/SimpleNoSQL/build.gradle @@ -28,31 +28,30 @@ android { } } -// -//android.libraryVariants.all { variant -> -// def name = variant.buildType.name -// if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { -// return; // Skip debug builds. -// } -// def task = project.tasks.create "_jar${name.capitalize()}", Jar -// task.dependsOn variant.javaCompile -// task.from variant.javaCompile.destinationDir -// print variant.javaCompile.destinationDir.toString() -// artifacts.add('archives', task); -//} -// -//android.libraryVariants.all { variant -> -// task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) { -// description "Generates Javadoc for $variant.name." -// source = variant.javaCompile.source -// ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" -// classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) -// options.links("http://docs.oracle.com/javase/7/docs/api/"); -// options.links("http://d.android.com/reference/"); -// exclude '**/BuildConfig.java' -// exclude '**/R.java' -// } -//} +// jar with source files +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} + +task javadoc(type: Javadoc) { + failOnError false + source = android.sourceSets.main.java.sourceFiles + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + classpath += configurations.compile +} + +// build a jar with javadoc +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + dependencies { api 'com.google.code.gson:gson:2.8.5' From fb20f84899ca07fd1b06e258e6a5bb3163e8dc5a Mon Sep 17 00:00:00 2001 From: Colin Miller Date: Sun, 25 Oct 2020 22:11:05 -0700 Subject: [PATCH 4/6] Change to x86 abi Seeing if travis supports an x86 abi --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1d91e7e..d0553d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ dist: trusty # Emulator Management: Create, Start and Wait before_script: - - android list targets - - echo no | android create avd --force -n test -t android-26 --abi armeabi-v7a -c 100M + - android list target + - echo no | android create avd --force -n test -t android-26 --abi x86 -c 100M - emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & From 834bff72d681e8ce9db1ce3763ec6992f2f6fd7a Mon Sep 17 00:00:00 2001 From: Colin Miller Date: Sun, 25 Oct 2020 22:15:14 -0700 Subject: [PATCH 5/6] Remove abi completely It should default to whatever ABI is installed --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d0553d0..5d4e879 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ dist: trusty # Emulator Management: Create, Start and Wait before_script: - android list target - - echo no | android create avd --force -n test -t android-26 --abi x86 -c 100M + - echo no | android create avd --force -n test -t android-26 -c 100M - emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & From a79f5c6d1fec78cb6474a329e53fc0577d218049 Mon Sep 17 00:00:00 2001 From: Colin Miller Date: Sun, 25 Oct 2020 22:24:27 -0700 Subject: [PATCH 6/6] Adding maven_push back in and switching travis again Trying arm64-v8a --- .travis.yml | 2 +- SimpleNoSQL/build.gradle | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5d4e879..0e38cc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ dist: trusty # Emulator Management: Create, Start and Wait before_script: - android list target - - echo no | android create avd --force -n test -t android-26 -c 100M + - echo no | android create avd --force -n test -t android-26 --abi arm64-v8a -c 100M - emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & diff --git a/SimpleNoSQL/build.gradle b/SimpleNoSQL/build.gradle index 4c82c68..b99a963 100644 --- a/SimpleNoSQL/build.gradle +++ b/SimpleNoSQL/build.gradle @@ -60,3 +60,5 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' } + +apply from: '../maven_push.gradle'