From 0baa5035df5c9de0a874894bab0a3a7e1a32b6b8 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Mon, 9 Oct 2023 10:57:26 -0300 Subject: [PATCH] Bump minSdk to 33 and upgrade unit test dependencies --- app/build.gradle | 13 +++++++------ .../seedvault/metadata/MetadataManagerTest.kt | 2 +- .../seedvault/plugins/saf/DocumentFileTest.kt | 2 +- .../seedvault/restore/install/DeviceInfoTest.kt | 2 +- build.gradle | 2 +- contactsbackup/build.gradle | 7 ++++++- gradle/dependencies.gradle | 4 ++-- storage/lib/build.gradle | 2 +- 8 files changed, 20 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b6394ec26..56508f332 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,7 +18,7 @@ android { compileSdk rootProject.ext.compileSdk defaultConfig { - minSdk 32 // leave at 32 for robolectric tests + minSdk rootProject.ext.minSdk targetSdk rootProject.ext.targetSdk versionNameSuffix "-$gitDescribe" testInstrumentationRunner "com.stevesoltys.seedvault.KoinInstrumentationTestRunner" @@ -52,6 +52,10 @@ android { jvmTarget = JavaVersion.VERSION_17.toString() languageVersion = "1.8" } + packagingOptions { + exclude("META-INF/LICENSE.md") + exclude("META-INF/LICENSE-notice.md") + } testOptions { unitTests.all { useJUnitPlatform() @@ -144,11 +148,8 @@ dependencies { // anything less than 'implementation' fails tests run with gradlew testImplementation rootProject.ext.aosp_libs - testImplementation 'androidx.test.ext:junit:1.1.3' - testImplementation('org.robolectric:robolectric:4.8.1') { - // https://github.com/robolectric/robolectric/issues/5245 - exclude group: "com.google.auto.service", module: "auto-service" - } + testImplementation 'androidx.test.ext:junit:1.1.5' + testImplementation('org.robolectric:robolectric:4.10.3') testImplementation 'org.hamcrest:hamcrest:2.2' testImplementation "org.junit.jupiter:junit-jupiter-api:$junit5_version" testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5_version" diff --git a/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataManagerTest.kt b/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataManagerTest.kt index 9683ad06d..661677ab2 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataManagerTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataManagerTest.kt @@ -41,7 +41,7 @@ import kotlin.random.Random @Suppress("DEPRECATION") @RunWith(AndroidJUnit4::class) @Config( - sdk = [32], // robolectric does not support 33, yet + sdk = [33], // robolectric does not support 34, yet application = TestApp::class ) class MetadataManagerTest { diff --git a/app/src/test/java/com/stevesoltys/seedvault/plugins/saf/DocumentFileTest.kt b/app/src/test/java/com/stevesoltys/seedvault/plugins/saf/DocumentFileTest.kt index bc3443c6a..3fd6491b0 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/plugins/saf/DocumentFileTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/plugins/saf/DocumentFileTest.kt @@ -19,7 +19,7 @@ import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) @Config( - sdk = [32], // robolectric does not support 33, yet + sdk = [33], // robolectric does not support 34, yet application = TestApp::class ) internal class DocumentFileTest { diff --git a/app/src/test/java/com/stevesoltys/seedvault/restore/install/DeviceInfoTest.kt b/app/src/test/java/com/stevesoltys/seedvault/restore/install/DeviceInfoTest.kt index 8d93b053f..2ee5f7c26 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/restore/install/DeviceInfoTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/restore/install/DeviceInfoTest.kt @@ -22,7 +22,7 @@ import kotlin.random.Random @RunWith(AndroidJUnit4::class) @Config( - sdk = [32], // robolectric does not support 33, yet + sdk = [33], // robolectric does not support 34, yet application = TestApp::class ) internal class DeviceInfoTest { diff --git a/build.gradle b/build.gradle index c69489897..13e210ec0 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ plugins { ext { compileSdk = 34 - minSdk = 32 + minSdk = 33 targetSdk = 34 } diff --git a/contactsbackup/build.gradle b/contactsbackup/build.gradle index c00a4b40d..e68d2df86 100644 --- a/contactsbackup/build.gradle +++ b/contactsbackup/build.gradle @@ -30,6 +30,11 @@ android { jvmTarget = JavaVersion.VERSION_17.toString() } + packagingOptions { + exclude("META-INF/LICENSE.md") + exclude("META-INF/LICENSE-notice.md") + } + testOptions { unitTests.returnDefaultValues = true } @@ -67,7 +72,7 @@ dependencies { testImplementation "io.mockk:mockk:$mockk_version" androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version" androidTestImplementation "io.mockk:mockk-android:$mockk_version" } diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 34b00b9db..eca8573e4 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -6,8 +6,8 @@ ext { // test dependencies below - these do not care about AOSP and can be freely updated junit4_version = "4.13.2" - junit5_version = "5.7.2" // careful, upgrading this can change a Cipher's IV size in tests!? - mockk_version = "1.12.3" + junit5_version = "5.10.0" // careful, upgrading this can change a Cipher's IV size in tests!? + mockk_version = "1.13.4" // newer versions require kotlin > 1.8.10 espresso_version = "3.4.0" } diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index 447b28495..c3bd1c98d 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -99,7 +99,7 @@ dependencies { testImplementation "io.mockk:mockk:$mockk_version" testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" - androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version" }