From 5e867f7044c6d1d2c2a62a7f9df76547c7a7d5c0 Mon Sep 17 00:00:00 2001 From: Hadi Satrio Date: Sun, 28 Jul 2024 00:18:37 +0700 Subject: [PATCH] root: Centralize Kover configuration This commit centralizes the Kover configuration in the root `build.gradle.kts` file and applies it to all subprojects. --- app-kmm-journal3/build.gradle.kts | 23 ----------------------- build.gradle.kts | 28 ++++++++++++++++++++++++++++ lib-kmm-foundation/build.gradle.kts | 23 ----------------------- lib-kmm-geography/build.gradle.kts | 23 ----------------------- lib-kmm-io/build.gradle.kts | 23 ----------------------- lib-kmm-json/build.gradle.kts | 23 ----------------------- lib-kmm-paraphrase/build.gradle.kts | 23 ----------------------- 7 files changed, 28 insertions(+), 138 deletions(-) diff --git a/app-kmm-journal3/build.gradle.kts b/app-kmm-journal3/build.gradle.kts index 04167dbf..54fd1383 100644 --- a/app-kmm-journal3/build.gradle.kts +++ b/app-kmm-journal3/build.gradle.kts @@ -44,26 +44,3 @@ android { targetSdk = 33 } } - -koverReport { - filters { - excludes { - classes("*Fake*", "*Test") - } - } - defaults { - verify { - onCheck = true - rule("Branch coverage must exceed 90%") { - isEnabled = true - entity = kotlinx.kover.gradle.plugin.dsl.GroupingEntityType.APPLICATION - - bound { - minValue = 90 - metric = kotlinx.kover.gradle.plugin.dsl.MetricType.BRANCH - aggregation = kotlinx.kover.gradle.plugin.dsl.AggregationType.COVERED_PERCENTAGE - } - } - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts index f1c27a52..79e94fbf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,8 @@ import io.gitlab.arturbosch.detekt.extensions.DetektExtension +import kotlinx.kover.gradle.plugin.dsl.AggregationType +import kotlinx.kover.gradle.plugin.dsl.GroupingEntityType +import kotlinx.kover.gradle.plugin.dsl.KoverReportExtension +import kotlinx.kover.gradle.plugin.dsl.MetricType plugins { //trick: for the same plugin versions in all sub-modules @@ -40,6 +44,30 @@ subprojects { dependencies { add("detektPlugins", libs.detekt.formatting) } + + apply(plugin = libs.plugins.kover.get().pluginId) + extensions.configure { + filters { + excludes { + classes("*Fake*", "*Test") + } + } + defaults { + verify { + onCheck = true + rule("Branch coverage must exceed 90%") { + isEnabled = true + entity = GroupingEntityType.APPLICATION + + bound { + minValue = 90 + metric = MetricType.BRANCH + aggregation = AggregationType.COVERED_PERCENTAGE + } + } + } + } + } } sonarqube { diff --git a/lib-kmm-foundation/build.gradle.kts b/lib-kmm-foundation/build.gradle.kts index 2f125dbc..7580970f 100644 --- a/lib-kmm-foundation/build.gradle.kts +++ b/lib-kmm-foundation/build.gradle.kts @@ -60,26 +60,3 @@ android { } } } - -koverReport { - filters { - excludes { - classes("*Fake*", "*Test") - } - } - defaults { - verify { - onCheck = true - rule("Branch coverage must exceed 90%") { - isEnabled = true - entity = kotlinx.kover.gradle.plugin.dsl.GroupingEntityType.APPLICATION - - bound { - minValue = 90 - metric = kotlinx.kover.gradle.plugin.dsl.MetricType.BRANCH - aggregation = kotlinx.kover.gradle.plugin.dsl.AggregationType.COVERED_PERCENTAGE - } - } - } - } -} diff --git a/lib-kmm-geography/build.gradle.kts b/lib-kmm-geography/build.gradle.kts index bbfa7725..6b0e5624 100644 --- a/lib-kmm-geography/build.gradle.kts +++ b/lib-kmm-geography/build.gradle.kts @@ -58,26 +58,3 @@ android { } } } - -koverReport { - filters { - excludes { - classes("*Fake*", "*Test") - } - } - defaults { - verify { - onCheck = true - rule("Branch coverage must exceed 90%") { - isEnabled = true - entity = kotlinx.kover.gradle.plugin.dsl.GroupingEntityType.APPLICATION - - bound { - minValue = 90 - metric = kotlinx.kover.gradle.plugin.dsl.MetricType.BRANCH - aggregation = kotlinx.kover.gradle.plugin.dsl.AggregationType.COVERED_PERCENTAGE - } - } - } - } -} diff --git a/lib-kmm-io/build.gradle.kts b/lib-kmm-io/build.gradle.kts index ffce52f8..cfa0cfa5 100644 --- a/lib-kmm-io/build.gradle.kts +++ b/lib-kmm-io/build.gradle.kts @@ -52,26 +52,3 @@ android { } } } - -koverReport { - filters { - excludes { - classes("*Fake*", "*Test") - } - } - defaults { - verify { - onCheck = true - rule("Branch coverage must exceed 90%") { - isEnabled = true - entity = kotlinx.kover.gradle.plugin.dsl.GroupingEntityType.APPLICATION - - bound { - minValue = 90 - metric = kotlinx.kover.gradle.plugin.dsl.MetricType.BRANCH - aggregation = kotlinx.kover.gradle.plugin.dsl.AggregationType.COVERED_PERCENTAGE - } - } - } - } -} diff --git a/lib-kmm-json/build.gradle.kts b/lib-kmm-json/build.gradle.kts index c5a2be0d..a69d0428 100644 --- a/lib-kmm-json/build.gradle.kts +++ b/lib-kmm-json/build.gradle.kts @@ -43,26 +43,3 @@ android { } } } - -koverReport { - filters { - excludes { - classes("*Fake*", "*Test") - } - } - defaults { - verify { - onCheck = true - rule("Branch coverage must exceed 90%") { - isEnabled = true - entity = kotlinx.kover.gradle.plugin.dsl.GroupingEntityType.APPLICATION - - bound { - minValue = 90 - metric = kotlinx.kover.gradle.plugin.dsl.MetricType.BRANCH - aggregation = kotlinx.kover.gradle.plugin.dsl.AggregationType.COVERED_PERCENTAGE - } - } - } - } -} diff --git a/lib-kmm-paraphrase/build.gradle.kts b/lib-kmm-paraphrase/build.gradle.kts index 4e76338a..dfdf5429 100644 --- a/lib-kmm-paraphrase/build.gradle.kts +++ b/lib-kmm-paraphrase/build.gradle.kts @@ -44,26 +44,3 @@ android { } } } - -koverReport { - filters { - excludes { - classes("*Fake*", "*Test") - } - } - defaults { - verify { - onCheck = true - rule("Branch coverage must exceed 90%") { - isEnabled = true - entity = kotlinx.kover.gradle.plugin.dsl.GroupingEntityType.APPLICATION - - bound { - minValue = 90 - metric = kotlinx.kover.gradle.plugin.dsl.MetricType.BRANCH - aggregation = kotlinx.kover.gradle.plugin.dsl.AggregationType.COVERED_PERCENTAGE - } - } - } - } -}