test-dependecies -> kts

This commit is contained in:
Milos Kozak 2023-10-14 23:24:34 +02:00
parent 5edc363733
commit 483a7549fa
4 changed files with 83 additions and 4 deletions

View file

@ -88,6 +88,7 @@ allprojects {
kotlinOptions {
freeCompilerArgs = listOf(
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlin.ExperimentalUnsignedTypes",
"-Xjvm-default=all" //Support @JvmDefault
)
jvmTarget = "11"

View file

@ -5,6 +5,7 @@ object Libs {
const val kotlin = "1.9.10"
const val test = "org.jetbrains.kotlin:kotlin-test:$kotlin"
}
object KotlinX {
@ -21,6 +22,14 @@ object Libs {
const val appCompat = "androidx.appcompat:appcompat:1.6.1"
const val preference = "androidx.preference:preference-ktx:1.2.1"
const val workRuntimeKtx = "androidx.work:work-runtime-ktx:2.8.1"
object Test {
const val espressoCore = "androidx.test.espresso:espresso-core:3.5.1"
const val extKtx = "androidx.test.ext:junit-ktx:1.1.5"
const val rules = "androidx.test:rules:1.5.0"
const val uiAutomator = "androidx.test.uiautomator:uiautomator:2.2.0"
}
}
object Google {
@ -28,6 +37,8 @@ object Libs {
const val measurementApi = "com.google.android.gms:play-services-measurement-api:21.3.0"
}
const val truth = "com.google.truth:truth:1.1.5"
}
object Dagger {
@ -59,8 +70,24 @@ object Libs {
const val logbackAndroid = "com.github.tony19:logback-android:2.0.0"
}
const val joda = "net.danlew:android.joda:2.12.5"
object JUnit {
private const val junitVersion = "5.10.0"
const val jupiter = "org.junit.jupiter:junit-jupiter:$junitVersion"
const val jupiterApi = "org.junit.jupiter:junit-jupiter-api:$junitVersion"
}
object Mockito {
const val jupiter = "org.mockito:mockito-junit-jupiter:5.6.0"
const val kotlin = "org.mockito.kotlin:mockito-kotlin:5.1.0"
}
const val androidSvg = "com.caverock:androidsvg:1.4"
const val joda = "net.danlew:android.joda:2.12.5"
const val json = "org.json:json:20230618"
const val jsonAssert = "org.skyscreamer:jsonassert:1.5.0"
const val room = "2.5.2"
const val lifecycle = "2.6.2"
@ -79,11 +106,9 @@ object Libs {
const val guava = "32.1.3-jre"
const val work = "2.8.1"
const val tink = "1.10.0"
const val json = "20230618"
const val swipe = "1.1.0"
const val junit = "4.13.2"
const val junit_jupiter = "5.10.0"
const val mockito = "5.6.0"
const val dexmaker = "1.2"
const val retrofit2 = "2.9.0"

View file

@ -0,0 +1,53 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id("com.android.library")
id("kotlin-android")
}
dependencies {
testImplementation(Libs.Kotlin.test)
testImplementation(Libs.JUnit.jupiter)
testImplementation(Libs.JUnit.jupiterApi)
testImplementation(Libs.json)
testImplementation(Libs.Mockito.jupiter)
testImplementation(Libs.Mockito.kotlin)
testImplementation(Libs.joda)
testImplementation(Libs.Google.truth)
testImplementation(Libs.jsonAssert)
androidTestImplementation(Libs.AndroidX.Test.espressoCore)
androidTestImplementation(Libs.AndroidX.Test.extKtx)
androidTestImplementation(Libs.AndroidX.Test.rules)
//androidTestImplementation(Libs.AndroidX.Test.uiAutomator)
}
tasks.withType<Test> {
// use to display stdout in travis
testLogging {
// set options for log level LIFECYCLE
events = setOf(
TestLogEvent.FAILED,
TestLogEvent.STARTED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = TestExceptionFormat.FULL
useJUnitPlatform()
}
}
tasks.withType<Test>().configureEach {
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
forkEvery = 20
}
android {
testOptions {
unitTests {
isReturnDefaultValues = true
isIncludeAndroidResources = true
}
}
}

View file

@ -7,9 +7,9 @@ plugins {
id("kotlinx-serialization")
id("android-module-dependencies")
id("all-open-dependencies")
id("test-dependencies")
}
apply(from = "${project.rootDir}/core/main/test_dependencies.gradle")
apply(from = "${project.rootDir}/core/main/jacoco_global.gradle")
android {