Skip to content

Commit

Permalink
Merge pull request #19905 from wordpress-mobile/configure_kover
Browse files Browse the repository at this point in the history
Configure `kover`
  • Loading branch information
wzieba authored Jan 10, 2024
2 parents d7c3f49 + a9c5988 commit 482f339
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 0 deletions.
1 change: 1 addition & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins {
id "se.bjurr.violations.violation-comments-to-github-gradle-plugin"
id "com.google.gms.google-services"
id 'dagger.hilt.android.plugin'
id "org.jetbrains.kotlinx.kover"
}

sentry {
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id "io.gitlab.arturbosch.detekt"
id 'com.automattic.android.measure-builds'
id "org.jetbrains.kotlinx.kover"
id "androidx.navigation.safeargs.kotlin" apply false
id "com.android.library" apply false
id 'com.google.gms.google-services' apply false
Expand Down Expand Up @@ -248,4 +249,5 @@ dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$gradle.ext.detektVersion"
}

apply from: './config/gradle/code_coverage.gradle'
apply from: './config/gradle/gradle_build_scan.gradle'
71 changes: 71 additions & 0 deletions config/gradle/code_coverage.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
static String resolveProjectVariantForCodeCoverage(Project project) {
if (project.name == "WordPress") {
return "wordpressVanillaRelease"
} else {
return "release"
}
}

subprojects {
pluginManager.withPlugin("org.jetbrains.kotlinx.kover") {
if (project.plugins.hasPlugin("com.android.library") || project.plugins.hasPlugin("com.android.application")) {
koverReport {
defaults {
mergeWith(resolveProjectVariantForCodeCoverage(project))
}
}
}
}
}

dependencies {
kover(
project(":WordPress"),
project(":libs:editor"),
project(":libs:image-editor"),
project(":libs:processors"),
)
}

koverReport {
filters {
excludes {
packages(
'com.bumptech.glide',
'dagger.*',
'*.compose*',
'*.debug*',
'hilt_aggregated_deps',
'*.databinding',
'org.wordpress.android.modules',
'org.wordpress.android.widgets',
)

classes(
'*_Factory*',
'*Activity',
'*Activity$*',
'*Adapter',
'*Adapter$*',
'*BuildConfig',
'*DiffCallback*',
'*Dialog',
'*Dialog$*',
'*Fragment',
'*Fragment$*',
'*FragmentDirections*',
'*FragmentKt*',
'*Module',
'*Module_*',
'*View',
'*View$*',
'*ViewHolder',
'*ViewHolder$*',
'*ViewHolderKt*',
'*.Hilt_*',
'*HiltModules*',
'*_MembersInjector',
)
}
}
}
1 change: 1 addition & 0 deletions libs/editor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id "com.android.library"
id "org.jetbrains.kotlin.android"
id "org.jetbrains.kotlin.plugin.parcelize"
id "org.jetbrains.kotlinx.kover"
}

repositories {
Expand Down
1 change: 1 addition & 0 deletions libs/image-editor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id "org.jetbrains.kotlin.android"
id "org.jetbrains.kotlin.plugin.parcelize"
id "androidx.navigation.safeargs.kotlin"
id "org.jetbrains.kotlinx.kover"
}

android {
Expand Down
1 change: 1 addition & 0 deletions libs/processors/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "org.jetbrains.kotlin.jvm"
id "org.jetbrains.kotlin.kapt"
id "org.jetbrains.kotlinx.kover"
}

sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pluginManagement {
gradle.ext.detektVersion = '1.23.0'
gradle.ext.violationCommentsVersion = '1.67'
gradle.ext.measureBuildsVersion = '2.0.3'
gradle.ext.koverVersion = '0.7.5'

plugins {
id "org.jetbrains.kotlin.android" version gradle.ext.kotlinVersion
Expand All @@ -24,6 +25,7 @@ pluginManagement {
id "io.gitlab.arturbosch.detekt" version gradle.ext.detektVersion
id "se.bjurr.violations.violation-comments-to-github-gradle-plugin" version gradle.ext.violationCommentsVersion
id 'com.automattic.android.measure-builds' version gradle.ext.measureBuildsVersion
id "org.jetbrains.kotlinx.kover" version gradle.ext.koverVersion
}
repositories {
maven {
Expand Down

0 comments on commit 482f339

Please sign in to comment.