remove database -> shared dependency
This commit is contained in:
parent
7ec1049276
commit
bf14292b98
4 changed files with 26 additions and 6 deletions
|
@ -20,9 +20,6 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
// shared needed for OpenForTesting
|
||||
implementation project(':shared')
|
||||
|
||||
api "androidx.core:core-ktx:$core_version"
|
||||
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
|
||||
|
@ -48,5 +45,5 @@ dependencies {
|
|||
|
||||
allOpen {
|
||||
// allows mocking for classes w/o directly opening them for release builds
|
||||
annotation 'info.nightscout.androidaps.annotations.OpenForTesting'
|
||||
annotation 'info.nightscout.androidaps.annotations.DbOpenForTesting'
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package info.nightscout.androidaps.annotations
|
||||
|
||||
/**
|
||||
* This is the actual annotation that makes the class open. Don't use it directly, only through [DbOpenForTesting]
|
||||
* which has a NOOP replacement in production.
|
||||
*/
|
||||
@Target(AnnotationTarget.ANNOTATION_CLASS)
|
||||
annotation class DbOpenClass
|
||||
|
||||
/**
|
||||
* Annotate a class with [DbOpenForTesting] if it should be extendable for testing.
|
||||
*/
|
||||
@DbOpenClass
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class DbOpenForTesting
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.database
|
||||
|
||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||
import info.nightscout.androidaps.annotations.DbOpenForTesting
|
||||
import info.nightscout.androidaps.database.data.NewEntries
|
||||
import info.nightscout.androidaps.database.embedments.InterfaceIDs
|
||||
import info.nightscout.androidaps.database.entities.*
|
||||
|
@ -19,7 +19,7 @@ import javax.inject.Inject
|
|||
import javax.inject.Singleton
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@OpenForTesting
|
||||
@DbOpenForTesting
|
||||
@Singleton class AppRepository @Inject internal constructor(
|
||||
internal val database: AppDatabase
|
||||
) {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package info.nightscout.androidaps.annotations
|
||||
|
||||
/**
|
||||
* Annotate a class with [DbOpenForTesting] if it should be extendable for testing.
|
||||
* In production the class remains final.
|
||||
*/
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class DbOpenForTesting
|
Loading…
Reference in a new issue