From 301fa49e384e9f73191cd7064a1101f668ef769b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 18 Nov 2021 15:47:42 +0100 Subject: [PATCH] unify @OpenForTesting --- omnipod-dash/build.gradle | 25 +++++++++++++------ .../dash/annotations/OpenForTesting.kt | 15 ----------- .../driver/pod/util/RandomByteGenerator.kt | 2 +- .../driver/pod/util/X25519KeyGenerator.kt | 2 +- .../dash/annotations/OpenForTesting.kt | 8 ------ omnipod-eros/build.gradle | 25 +++++++++++++------ 6 files changed, 36 insertions(+), 41 deletions(-) delete mode 100644 omnipod-dash/src/debug/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/annotations/OpenForTesting.kt delete mode 100644 omnipod-dash/src/release/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/annotations/OpenForTesting.kt diff --git a/omnipod-dash/build.gradle b/omnipod-dash/build.gradle index 7ed945c1aa..e512adf80c 100644 --- a/omnipod-dash/build.gradle +++ b/omnipod-dash/build.gradle @@ -11,23 +11,32 @@ apply from: "${project.rootDir}/gradle/android_module_dependencies.gradle" apply from: "${project.rootDir}/gradle/test_dependencies.gradle" apply from: "${project.rootDir}/gradle/jacoco_global.gradle" -allOpen { - annotation 'info.nightscout.androidaps.plugins.pump.omnipod.dash.annotations.OpenClass' -} - detekt { // TODO move to `subprojects` section in global build.gradle toolVersion = "1.15.0-RC2" config = files("./detekt-config.yml") // TODO move to global space and use "../detekt-config.yml" } +android { + defaultConfig { + kapt { + arguments { + arg("room.incremental", "true") + arg("room.schemaLocation", "$projectDir/schemas") + } + } + } +} + dependencies { implementation project(':core') implementation project(':pump-common') implementation project(':omnipod-common') + implementation project(':database') - implementation "androidx.room:room-runtime:$room_version" - implementation "androidx.room:room-rxjava2:$room_version" - implementation project(path: ':pump-common') + api "androidx.room:room-ktx:$room_version" + api "androidx.room:room-runtime:$room_version" + api "androidx.room:room-rxjava2:$room_version" kapt "androidx.room:room-compiler:$room_version" - implementation 'com.github.guepardoapps:kulid:2.0.0.0' + + api 'com.github.guepardoapps:kulid:2.0.0.0' } diff --git a/omnipod-dash/src/debug/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/annotations/OpenForTesting.kt b/omnipod-dash/src/debug/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/annotations/OpenForTesting.kt deleted file mode 100644 index 689d6a467c..0000000000 --- a/omnipod-dash/src/debug/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/annotations/OpenForTesting.kt +++ /dev/null @@ -1,15 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.dash.annotations - -/** - * This is the actual annotation that makes the class open. Don't use it directly, only through [OpenForTesting] - * which has a NOOP replacement in production. - */ -@Target(AnnotationTarget.ANNOTATION_CLASS) -annotation class OpenClass - -/** - * Annotate a class with [OpenForTesting] if it should be extendable for testing. - */ -@OpenClass -@Target(AnnotationTarget.CLASS) -annotation class OpenForTesting diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/RandomByteGenerator.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/RandomByteGenerator.kt index ca6beb17dd..971869f5d2 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/RandomByteGenerator.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/RandomByteGenerator.kt @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util -import info.nightscout.androidaps.plugins.pump.omnipod.dash.annotations.OpenForTesting +import info.nightscout.androidaps.annotations.OpenForTesting import java.security.SecureRandom @OpenForTesting diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/X25519KeyGenerator.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/X25519KeyGenerator.kt index 160f620df6..56a7f1b425 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/X25519KeyGenerator.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/X25519KeyGenerator.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util import com.google.crypto.tink.subtle.X25519 -import info.nightscout.androidaps.plugins.pump.omnipod.dash.annotations.OpenForTesting +import info.nightscout.androidaps.annotations.OpenForTesting @OpenForTesting class X25519KeyGenerator { diff --git a/omnipod-dash/src/release/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/annotations/OpenForTesting.kt b/omnipod-dash/src/release/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/annotations/OpenForTesting.kt deleted file mode 100644 index 6cf2180e50..0000000000 --- a/omnipod-dash/src/release/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/annotations/OpenForTesting.kt +++ /dev/null @@ -1,8 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.dash.annotations - -/** - * Annotate a class with [OpenForTesting] if it should be extendable for testing. - * In production the class remains final. - */ -@Target(AnnotationTarget.CLASS) -annotation class OpenForTesting diff --git a/omnipod-eros/build.gradle b/omnipod-eros/build.gradle index 5fc0d2628d..967309deb1 100644 --- a/omnipod-eros/build.gradle +++ b/omnipod-eros/build.gradle @@ -9,21 +9,30 @@ apply from: "${project.rootDir}/gradle/android_module_dependencies.gradle" apply from: "${project.rootDir}/gradle/test_dependencies.gradle" apply from: "${project.rootDir}/gradle/jacoco_global.gradle" +android { + defaultConfig { + kapt { + arguments { + arg("room.incremental", "true") + arg("room.schemaLocation", "$projectDir/schemas") + } + } + } +} + dependencies { implementation project(':core') implementation project(':pump-common') implementation project(':omnipod-common') implementation project(':rileylink') + implementation project(':database') - implementation "androidx.room:room-runtime:$room_version" - annotationProcessor("androidx.room:room-compiler:$room_version") - // To use Kotlin annotation processing tool (kapt) - kapt("androidx.room:room-compiler:$room_version") - // optional - Kotlin Extensions and Coroutines support for Room - implementation("androidx.room:room-ktx:$room_version") - // optional - RxJava2 support for Room - implementation "androidx.room:room-rxjava2:$room_version" + api "androidx.room:room-ktx:$room_version" + api "androidx.room:room-runtime:$room_version" + api "androidx.room:room-rxjava2:$room_version" + kapt "androidx.room:room-compiler:$room_version" + // optional - Test helpers testImplementation("androidx.room:room-testing:$room_version") }