Move dependencies into a single file so it's easier to copy
This commit is contained in:
parent
d7f0ca8ccf
commit
f35fe810e0
5 changed files with 152 additions and 52 deletions
|
|
@ -101,46 +101,10 @@ dependencies {
|
||||||
|
|
||||||
implementation project(":core")
|
implementation project(":core")
|
||||||
|
|
||||||
testImplementation "androidx.room:room-testing:$androidx_room_version"
|
applyAppTestDependenciesTo(this)
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
applyComposeTestDependenciesTo(this)
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-params:$testing_junit5_version"
|
|
||||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$testing_kotlin_mockito_version"
|
|
||||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
|
|
||||||
testImplementation "com.jraska.livedata:testing-ktx:$testing_livedata_version"
|
|
||||||
testImplementation "io.insert-koin:koin-test-junit5:$koin_version"
|
|
||||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
|
||||||
|
|
||||||
// robolectric specific
|
|
||||||
testImplementation "junit:junit:$testing_junit4_version"
|
|
||||||
testImplementation "org.robolectric:robolectric:$testing_robolectric_version"
|
|
||||||
testImplementation "androidx.test:core:$testing_androidx_code_version"
|
|
||||||
testImplementation "androidx.test:runner:$testing_androidx_code_version"
|
|
||||||
testImplementation "androidx.test.ext:junit:$testing_androidx_junit_version"
|
|
||||||
testImplementation "androidx.test.espresso:espresso-core:$testing_espresso_version"
|
|
||||||
testImplementation "androidx.test.espresso:espresso-intents:$testing_espresso_version"
|
|
||||||
testImplementation "androidx.test.espresso:espresso-contrib:$testing_espresso_version"
|
|
||||||
testImplementation project(':mockserver')
|
|
||||||
testImplementation "androidx.arch.core:core-testing:$testing_androidx_arch_core_version"
|
|
||||||
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version"
|
|
||||||
|
|
||||||
androidTestImplementation "androidx.room:room-testing:$androidx_room_version"
|
|
||||||
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
|
|
||||||
androidTestImplementation "io.insert-koin:koin-test-junit4:$koin_version"
|
|
||||||
androidTestImplementation "junit:junit:$testing_junit4_version"
|
|
||||||
androidTestImplementation "androidx.test:core:$testing_androidx_code_version"
|
|
||||||
androidTestImplementation "androidx.test:runner:$testing_androidx_code_version"
|
|
||||||
androidTestImplementation "androidx.test.ext:junit:$testing_androidx_junit_version"
|
|
||||||
androidTestImplementation "androidx.test.espresso:espresso-core:$testing_espresso_version"
|
|
||||||
androidTestImplementation "androidx.test.espresso:espresso-intents:$testing_espresso_version"
|
|
||||||
androidTestImplementation "androidx.test.espresso:espresso-contrib:$testing_espresso_version"
|
|
||||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$androidx_compose_version"
|
|
||||||
testImplementation "androidx.compose.ui:ui-test-junit4:$androidx_compose_version"
|
|
||||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$androidx_compose_version"
|
|
||||||
androidTestImplementation project(':mockserver')
|
androidTestImplementation project(':mockserver')
|
||||||
androidTestImplementation "androidx.arch.core:core-testing:$testing_androidx_arch_core_version"
|
|
||||||
androidTestRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version"
|
|
||||||
|
|
||||||
implementation "io.reactivex.rxjava3:rxjava:3.1.4"
|
|
||||||
|
|
||||||
testImplementation testFixtures(project(':core'))
|
testImplementation testFixtures(project(':core'))
|
||||||
androidTestImplementation testFixtures(project(':core'))
|
androidTestImplementation testFixtures(project(':core'))
|
||||||
|
|
|
||||||
|
|
@ -35,3 +35,4 @@ apply from: 'gradlescripts/ktlint.gradle'
|
||||||
apply from: 'gradlescripts/lint.gradle'
|
apply from: 'gradlescripts/lint.gradle'
|
||||||
apply from: 'gradlescripts/testoptions.gradle'
|
apply from: 'gradlescripts/testoptions.gradle'
|
||||||
apply from: 'gradlescripts/test.tasks.gradle'
|
apply from: 'gradlescripts/test.tasks.gradle'
|
||||||
|
apply from: 'gradlescripts/testdependencies.gradle'
|
||||||
|
|
@ -20,15 +20,7 @@ dependencies {
|
||||||
api project(":model")
|
api project(":model")
|
||||||
implementation project(":network")
|
implementation project(":network")
|
||||||
|
|
||||||
testImplementation "io.insert-koin:koin-test-junit5:$koin_version"
|
applyCoreTestDependenciesTo(this)
|
||||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
|
|
||||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$testing_kotlin_mockito_version"
|
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
|
||||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
|
||||||
testImplementation "com.squareup.retrofit2:retrofit:$retrofit_version"
|
|
||||||
testImplementation "app.cash.turbine:turbine:$turbine_version"
|
|
||||||
|
|
||||||
testImplementation "org.junit.jupiter:junit-jupiter-params:$testing_junit5_version"
|
|
||||||
|
|
||||||
testImplementation project(':mockserver')
|
testImplementation project(':mockserver')
|
||||||
testFixturesApi testFixtures(project(':network'))
|
testFixturesApi testFixtures(project(':network'))
|
||||||
|
|
|
||||||
146
gradlescripts/testdependencies.gradle
Normal file
146
gradlescripts/testdependencies.gradle
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
project.ext {
|
||||||
|
|
||||||
|
/*
|
||||||
|
------------------USAGE------------------
|
||||||
|
add line in root build.gradle:
|
||||||
|
apply from: 'gradlescripts/testdependencies.gradle' (this file)
|
||||||
|
then in your modules you can use:
|
||||||
|
|
||||||
|
------------------NETWORK(Java Module)------------------
|
||||||
|
dependencies {
|
||||||
|
applyNetworkTestDependenciesTo(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
------------------CORE(Java Module)------------------
|
||||||
|
dependencies {
|
||||||
|
applyCoreTestDependenciesTo(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
------------------APP(Android Module)------------------
|
||||||
|
dependencies {
|
||||||
|
applyAppTestDependenciesTo(this)
|
||||||
|
applyComposeTestDependenciesTo(this) // if you are using compose
|
||||||
|
}
|
||||||
|
|
||||||
|
------------------VERSIONS------------------
|
||||||
|
versions try to get the global value, if not found they fall back to some defaults.
|
||||||
|
You can find them just below
|
||||||
|
*/
|
||||||
|
|
||||||
|
def propertyOrNull = { key ->
|
||||||
|
if (hasProperty(key)) {
|
||||||
|
return property(key)
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------VERSIONS------------------
|
||||||
|
def testing_junit5_version = propertyOrNull('junit5_version') ?: "5.7.0"
|
||||||
|
def testing_junit4_version = propertyOrNull('juni4_version') ?: "4.13.2"
|
||||||
|
def testing_robolectric_version = propertyOrNull('robolectric_version') ?: "4.7"
|
||||||
|
def testing_androidx_code_version = propertyOrNull('androidx_test_version') ?: "1.4.0"
|
||||||
|
def testing_androidx_junit_version = propertyOrNull('androidx_junit_version') ?: "1.1.3"
|
||||||
|
def testing_espresso_version = propertyOrNull('espresso_version') ?: "3.4.0"
|
||||||
|
def testing_androidx_arch_core_version = propertyOrNull('androidx_arch_version') ?: "2.1.0"
|
||||||
|
def test_coroutines_version = propertyOrNull('coroutines_versionx') ?: "1.6.0"
|
||||||
|
def testing_kotlin_mockito_version = propertyOrNull('mockito_version') ?: "3.1.0"
|
||||||
|
def testing_koin_version = propertyOrNull('koin_version') ?: "3.1.2"
|
||||||
|
def testing_json_assert_version = propertyOrNull('json_assert_version') ?: "1.5.0"
|
||||||
|
def testing_okhttp3 = propertyOrNull('okhttp_version') ?: "4.9.3"
|
||||||
|
def testing_turbine_version = propertyOrNull('turbine_version') ?: "0.7.0"
|
||||||
|
def testing_androidx_room_version = propertyOrNull('room_version') ?: "2.4.1"
|
||||||
|
def testing_livedata_version = propertyOrNull('testing_livedata_version') ?: "1.2.0"
|
||||||
|
def testing_compose_version = propertyOrNull('compose_version') ?: "1.1.0"
|
||||||
|
|
||||||
|
// ------------------PRIVATE------------------
|
||||||
|
// JUni4 + Espresso + Room
|
||||||
|
def androidSpecificTestDependencies = [
|
||||||
|
"junit:junit:$testing_junit4_version",
|
||||||
|
|
||||||
|
"androidx.room:room-testing:$testing_androidx_room_version",
|
||||||
|
|
||||||
|
"com.jraska.livedata:testing-ktx:$testing_livedata_version",
|
||||||
|
|
||||||
|
"androidx.test:core:$testing_androidx_code_version",
|
||||||
|
"androidx.test:runner:$testing_androidx_code_version",
|
||||||
|
|
||||||
|
"androidx.test.ext:junit:$testing_androidx_junit_version",
|
||||||
|
|
||||||
|
"androidx.test.espresso:espresso-core:$testing_espresso_version",
|
||||||
|
"androidx.test.espresso:espresso-intents:$testing_espresso_version",
|
||||||
|
"androidx.test.espresso:espresso-contrib:$testing_espresso_version",
|
||||||
|
|
||||||
|
"androidx.arch.core:core-testing:$testing_androidx_arch_core_version",
|
||||||
|
]
|
||||||
|
|
||||||
|
// ------------------PRIVATE------------------
|
||||||
|
def applyStandardTestDependenciesTo = { module ->
|
||||||
|
module.dependencies {
|
||||||
|
// coroutine testing
|
||||||
|
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$test_coroutines_version"
|
||||||
|
|
||||||
|
// mockito, mocking library
|
||||||
|
testImplementation "org.mockito.kotlin:mockito-kotlin:$testing_kotlin_mockito_version"
|
||||||
|
|
||||||
|
testImplementation "io.insert-koin:koin-test-junit5:$testing_koin_version"
|
||||||
|
// junit5
|
||||||
|
testImplementation "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
||||||
|
testImplementation "org.junit.jupiter:junit-jupiter-params:$testing_junit5_version"
|
||||||
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------NETWORK------------------
|
||||||
|
applyNetworkTestDependenciesTo = { module ->
|
||||||
|
applyStandardTestDependenciesTo(module)
|
||||||
|
|
||||||
|
module.dependencies {
|
||||||
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
||||||
|
// JSON Assert
|
||||||
|
testImplementation "org.skyscreamer:jsonassert:$testing_json_assert_version"
|
||||||
|
|
||||||
|
// mockwebserver + https support
|
||||||
|
testImplementation "com.squareup.okhttp3:mockwebserver:$testing_okhttp3"
|
||||||
|
testImplementation "com.squareup.okhttp3:okhttp-tls:$testing_okhttp3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------CORE------------------
|
||||||
|
applyCoreTestDependenciesTo = { module ->
|
||||||
|
applyStandardTestDependenciesTo(module)
|
||||||
|
|
||||||
|
module.dependencies {
|
||||||
|
// turbine, flow testing
|
||||||
|
testImplementation "app.cash.turbine:turbine:$testing_turbine_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------APP------------------
|
||||||
|
applyAppTestDependenciesTo = { module ->
|
||||||
|
applyStandardTestDependenciesTo(module)
|
||||||
|
|
||||||
|
module.dependencies {
|
||||||
|
testImplementation "org.robolectric:robolectric:$testing_robolectric_version"
|
||||||
|
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version"
|
||||||
|
|
||||||
|
androidSpecificTestDependencies.forEach { dependency ->
|
||||||
|
testImplementation dependency
|
||||||
|
androidTestImplementation dependency
|
||||||
|
}
|
||||||
|
|
||||||
|
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$test_coroutines_version"
|
||||||
|
androidTestImplementation "io.insert-koin:koin-test-junit5:$testing_koin_version"
|
||||||
|
androidTestRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------COMPOSE------------------
|
||||||
|
applyComposeTestDependenciesTo = { module ->
|
||||||
|
module.dependencies {
|
||||||
|
testImplementation "androidx.compose.ui:ui-test-junit4:$testing_compose_version"
|
||||||
|
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$testing_compose_version"
|
||||||
|
debugImplementation "androidx.compose.ui:ui-test-manifest:$testing_compose_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,10 +24,7 @@ dependencies {
|
||||||
|
|
||||||
api project(":model")
|
api project(":model")
|
||||||
|
|
||||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
|
applyNetworkTestDependenciesTo(this)
|
||||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$testing_kotlin_mockito_version"
|
|
||||||
testImplementation "org.skyscreamer:jsonassert:$testing_json_assert_version"
|
|
||||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
|
||||||
|
|
||||||
testFixturesApi project(':mockserver')
|
testFixturesApi project(':mockserver')
|
||||||
testFixturesApi "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
testFixturesApi "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue