2024-07-04 17:37:03 +02:00
|
|
|
import com.android.build.gradle.AppPlugin
|
|
|
|
import com.android.build.gradle.BaseExtension
|
|
|
|
import com.android.build.gradle.LibraryExtension
|
|
|
|
import com.android.build.gradle.LibraryPlugin
|
2024-08-05 23:28:04 +02:00
|
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
|
2019-01-12 13:10:02 +01:00
|
|
|
|
|
|
|
buildscript {
|
|
|
|
repositories {
|
2024-07-07 12:48:20 +02:00
|
|
|
gradlePluginPortal()
|
2019-01-12 13:10:02 +01:00
|
|
|
google()
|
2021-07-02 18:56:11 +02:00
|
|
|
mavenCentral()
|
2019-01-12 13:10:02 +01:00
|
|
|
}
|
2024-07-04 17:37:03 +02:00
|
|
|
|
2019-01-12 13:10:02 +01:00
|
|
|
dependencies {
|
2024-07-06 17:04:09 +02:00
|
|
|
classpath(libs.android.agp)
|
|
|
|
classpath(libs.kotlin.kgp)
|
|
|
|
classpath(libs.jacoco)
|
2024-07-07 12:48:20 +02:00
|
|
|
classpath(libs.aboutlibraries)
|
2019-01-12 13:10:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 14:01:58 +02:00
|
|
|
plugins {
|
2024-07-06 17:04:09 +02:00
|
|
|
alias(libs.plugins.ksp) apply false
|
2024-08-05 23:28:04 +02:00
|
|
|
alias(libs.plugins.compose.compiler) apply false
|
2024-09-20 16:40:20 +02:00
|
|
|
jacoco
|
2024-07-06 14:01:58 +02:00
|
|
|
}
|
|
|
|
|
2019-01-12 13:10:02 +01:00
|
|
|
allprojects {
|
|
|
|
repositories {
|
|
|
|
google()
|
2019-09-14 12:56:10 +02:00
|
|
|
mavenCentral()
|
2024-07-04 12:34:02 +02:00
|
|
|
maven(url = "https://jitpack.io")
|
2019-01-12 13:10:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-04 17:37:03 +02:00
|
|
|
subprojects {
|
|
|
|
afterEvaluate {
|
2024-08-05 23:28:04 +02:00
|
|
|
with(extensions.getByType<KotlinAndroidProjectExtension>()) {
|
|
|
|
compilerOptions {
|
|
|
|
jvmTarget = JvmTarget.JVM_17
|
2024-07-04 17:37:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
plugins.withType<AppPlugin> {
|
|
|
|
configure<BaseExtension> {
|
|
|
|
configure(this)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
plugins.withType<LibraryPlugin> {
|
|
|
|
configure<LibraryExtension> {
|
|
|
|
configure(this)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fun configure(extension: BaseExtension) = with(extension) {
|
|
|
|
compileSdkVersion(34)
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
minSdk = 21
|
|
|
|
targetSdk = 34
|
|
|
|
buildToolsVersion = "34.0.0"
|
|
|
|
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
}
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
|
|
|
|
|
|
isCoreLibraryDesugaringEnabled = true
|
|
|
|
}
|
|
|
|
|
|
|
|
lintOptions.isAbortOnError = false
|
|
|
|
|
|
|
|
/*dependencies {
|
|
|
|
add("coreLibraryDesugaring", libs.jdk.desugar)
|
|
|
|
}*/
|
2019-12-21 21:46:02 +01:00
|
|
|
}
|
|
|
|
|
2024-07-04 12:34:02 +02:00
|
|
|
tasks.register<Delete>("clean") {
|
2024-08-05 23:28:04 +02:00
|
|
|
delete(rootProject.layout.buildDirectory)
|
2021-09-16 22:29:25 +02:00
|
|
|
}
|
|
|
|
|
2024-09-20 16:40:20 +02:00
|
|
|
jacoco {
|
2021-09-16 22:29:25 +02:00
|
|
|
toolVersion = "0.8.7"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-09-20 16:40:20 +02:00
|
|
|
tasks.register<JacocoReport>("jacocoFullReport") {
|
2024-07-04 12:34:02 +02:00
|
|
|
group = "Reporting"
|
2021-09-16 22:29:25 +02:00
|
|
|
description = "Generate Jacoco coverage reports for the debug build"
|
|
|
|
|
|
|
|
reports {
|
2024-09-20 16:40:20 +02:00
|
|
|
xml.required.set(true)
|
|
|
|
html.required.set(true)
|
2021-09-16 22:29:25 +02:00
|
|
|
}
|
|
|
|
|
2024-09-20 16:40:20 +02:00
|
|
|
dependsOn(":app:testDebugUnitTest")
|
|
|
|
dependsOn(":api:testDebugUnitTest")
|
|
|
|
dependsOn(":db:testDebugUnitTest")
|
|
|
|
dependsOn(":app:connectedAndroidTest")
|
|
|
|
dependsOn(":db:connectedAndroidTest")
|
|
|
|
|
|
|
|
val excludeFilter = listOf(
|
|
|
|
"**/R.class",
|
|
|
|
"**/R\$*.class",
|
|
|
|
"**/BuildConfig.*",
|
|
|
|
"**/Manifest*.*",
|
|
|
|
"android/**/*.*"
|
|
|
|
)
|
|
|
|
|
|
|
|
classDirectories.setFrom(
|
|
|
|
files(
|
|
|
|
fileTree("${project.rootDir}/app/build/intermediates/javac/debug") { exclude(excludeFilter) },
|
|
|
|
fileTree("${project.rootDir}/app/build/tmp/kotlin-classes/debug") { exclude(excludeFilter) }
|
|
|
|
),
|
|
|
|
fileTree("${project.rootDir}/api/build/tmp/kotlin-classes/debug") { exclude(excludeFilter) },
|
|
|
|
fileTree("${project.rootDir}/db/build/tmp/kotlin-classes/debug") { exclude(excludeFilter) },
|
|
|
|
)
|
|
|
|
|
|
|
|
val coverageSourceDirs = listOf(
|
|
|
|
"${project.rootDir}/app/src/main/java",
|
|
|
|
"${project.rootDir}/api/src/main/java",
|
|
|
|
"${project.rootDir}/db/src/main/java",
|
|
|
|
)
|
|
|
|
|
|
|
|
additionalSourceDirs.setFrom(files(coverageSourceDirs))
|
|
|
|
sourceDirectories.setFrom(files(coverageSourceDirs))
|
|
|
|
|
|
|
|
executionData.setFrom(
|
|
|
|
fileTree(project.rootDir) {
|
|
|
|
include(
|
|
|
|
listOf(
|
|
|
|
"api/build/outputs/unit_test_code_coverage/**/*.exec",
|
|
|
|
"db/build/outputs/unit_test_code_coverage/**/*.exec",
|
|
|
|
"app/build/outputs/code_coverage/debugAndroidTest/connected/**/*.ec",
|
|
|
|
"db/build/outputs/code_coverage/debugAndroidTest/connected/**/*.ec"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|