Skip to content

Commit

Permalink
Add kover plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
massivemadness committed Oct 21, 2023
1 parent 27b2e78 commit d5da943
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
68 changes: 68 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,78 @@ plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.kapt) apply false
alias(libs.plugins.kotlin.kover)
alias(libs.plugins.hilt) apply false
alias(libs.plugins.navigation) apply false
}

subprojects {
apply(plugin = "org.jetbrains.kotlinx.kover")
pluginManager.withPlugin("com.android.library") {
koverMerge("debug")
}
pluginManager.withPlugin("com.android.application") {
koverMerge("fdroidDebug")
}
rootProject.dependencies.add("kover", this)
}

fun Project.koverMerge(buildVariant: String) {
koverReport {
defaults {
mergeWith(buildVariant)
}
}
}

// ./gradlew :koverHtmlReport
koverReport {
filters {
excludes {
classes(
// Android classes
"*Application*",
"*Activity*",
"*Fragment*",
"*Dialog*",
"*Worker*",
// Android generated
"*.databinding.*",
"*.BuildConfig",
// Hilt generated
"hilt_aggregated_deps.*",
"*_Factory*",
"*_Provide*Factory*",
"*_HiltModules*",
"*_MembersInjector*",
// NavComponent generated
"*FragmentArgs",
"*FragmentArgs\$*",
"*FragmentDirections",
"*FragmentDirections\$*",
// Room generated
"*Dao_Impl",
"*Dao_Impl\$*",
// Code style
"*App*",
"*Extensions*",
"*.internal.*",
"*.model.*",
"*.entity.*",
"*.adapter.*",
"*.customview.*",
"*.view.*",
"*.widget.*",
"*.dialog.*",
"*.fragment.*",
"*.navigation.*",
"*.lexer.*",
"*.editorkit.*",
)
}
}
}

val ktlint: Configuration by configurations.creating

dependencies {
Expand Down
1 change: 1 addition & 0 deletions common-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.blacksquircle.ui.BuildConst

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
id("com.blacksquircle.stub")
}

Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[versions]
agp = "8.1.2"
kotlin = "1.9.10"
kover = "0.7.4"
core = "1.12.0"
activity = "1.8.0"
fragment = "1.6.1"
Expand Down Expand Up @@ -44,12 +45,14 @@ android-test = { id = "com.android.test", version.ref = "agp" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
kotlin-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
navigation = { id = "androidx.navigation.safeargs.kotlin", version.ref = "navigation" }

[libraries]
plugin-android = { module = "com.android.tools.build:gradle", version.ref = "agp" }
plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
plugin-kover = { module = "org.jetbrains.kotlinx:kover-gradle-plugin", version.ref = "kover" }

kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
materialdesign = { module = "com.google.android.material:material", version.ref = "materialdesign" }
Expand Down

0 comments on commit d5da943

Please sign in to comment.