Skip to content

Commit

Permalink
chore(deps): update plugin kover to v0.7.6 (#1025)
Browse files Browse the repository at this point in the history
* chore(deps): update plugin kover to v0.7.6

* chore: enable parallel gradle builds

* ci: update kover config for new version

Update the config to run on all modules and generate a merged report.

* ci: update github actions to use new kover task

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Troy Rijkaard <[email protected]>
  • Loading branch information
renovate[bot] and Chesire authored Feb 25, 2024
1 parent 369febd commit 4bcdc6c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: run assemble
run: ./gradlew assemble
- name: run kover
run: ./gradlew koverMergedXmlReport
run: ./gradlew koverXmlReport
- uses: codecov/codecov-action@v4
- name: run lint
run: ./gradlew :app:lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: setup gradle cache
uses: gradle/actions/setup-gradle@v3
- name: run kover
run: ./gradlew koverMergedXmlReport
run: ./gradlew koverXmlReport
- uses: codecov/codecov-action@v4
- name: publish results
uses: EnricoMi/publish-unit-test-result-action@v2
Expand Down
87 changes: 47 additions & 40 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import com.android.build.gradle.BaseExtension
import io.gitlab.arturbosch.detekt.Detekt
import kotlinx.kover.gradle.plugin.dsl.KoverReportExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType

plugins {
alias(libs.plugins.detekt)
Expand All @@ -14,22 +19,12 @@ plugins {
}

subprojects {
apply(plugin = "org.jetbrains.kotlinx.kover")
apply(plugin = "org.jlleitschuh.gradle.ktlint")

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
verbose = true
android = true
outputToConsole = true
disabledRules = listOf("max-line-length")

reporters {
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)
}
}
afterEvaluate {
if (plugins.hasPlugin("android") || plugins.hasPlugin("android-library")) {
configure<com.android.build.gradle.BaseExtension> {
apply(plugin = "org.jetbrains.kotlinx.kover")
apply(plugin = "org.jlleitschuh.gradle.ktlint")

configure<BaseExtension> {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand All @@ -42,9 +37,24 @@ subprojects {
}
}
}
configure<org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension> {
configure<KotlinAndroidProjectExtension> {
jvmToolchain(17)
}
configure<KoverReportExtension> {
defaults {
mergeWith("debug")
}
}
configure<KtlintExtension> {
verbose = true
android = true
outputToConsole = true
disabledRules = listOf("max-line-length")

reporters {
reporter(ReporterType.PLAIN)
}
}
}
}
}
Expand All @@ -64,12 +74,29 @@ tasks.register<Detekt>("detektCheck") {
buildUponDefaultConfig = false
}

koverMerged {
enable()
private val excludeProjects = setOf(
":core", // Container project
":core:compose", // UI Logic
":features", // Container project
":libraries", // Container project
":libraries:datasource", // Container project
":testing" // Test code
)
dependencies {
detektPlugins(libs.detekt.compose)
detektPlugins(libs.detekt.formatting)
detektPlugins(libs.detekt.kotlin.compiler)
subprojects.forEach { subproject ->
if (!excludeProjects.contains(subproject.path)) {
kover(subproject)
}
}
}

koverReport {
filters {
classes {
excludes.addAll(
excludes {
classes(
listOf(
"*.databinding.*", // Autogen ViewBinding
"dagger.*", // Autogen Dagger code
Expand All @@ -93,27 +120,7 @@ koverMerged {
"com.chesire.nekome.injection.*" // Dagger injection code
)
)
}
annotations {
excludes.addAll(
listOf(
"androidx.compose.runtime.Composable" // Compose components
)
)
}
projects {
excludes.addAll(
listOf(
":core:compose", // View code
":testing" // Testing code
)
)
annotatedBy("androidx.compose.runtime.Composable")
}
}
}

dependencies {
detektPlugins(libs.detekt.compose)
detektPlugins(libs.detekt.formatting)
detektPlugins(libs.detekt.kotlin.compiler)
}
5 changes: 1 addition & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@
android.useAndroidX=true
org.gradle.configuration-cache=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
org.gradle.parallel=true
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
google-dagger-hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
google-devtools-ksp = { id = "com.google.devtools.ksp", version = "1.9.22-1.0.17" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version = "0.6.1" }
kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.6" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "11.6.1" }

[bundles]
Expand Down

0 comments on commit 4bcdc6c

Please sign in to comment.