Skip to content

Commit

Permalink
Fix kover code coverage breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sebaslogen committed May 28, 2024
1 parent 3e35c13 commit b5af9b4
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 49 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ captures/
# IntelliJ
*.iml
.idea/*
.kotlin/

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
Expand Down
1 change: 0 additions & 1 deletion resaca/api/resaca.api
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,5 @@ public final class com/sebaslogen/resaca/ScopedViewModelOwner {

public final class com/sebaslogen/resaca/ViewModelCreationExtrasKt {
public static final fun addDefaultArguments (Landroidx/lifecycle/viewmodel/CreationExtras;Landroid/os/Bundle;)Landroidx/lifecycle/viewmodel/CreationExtras;
public static final fun toCreateCreationExtras (Landroid/os/Bundle;)Landroidx/lifecycle/viewmodel/CreationExtras;
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,4 @@ public fun CreationExtras.addDefaultArguments(defaultArguments: Bundle): Creatio
val combinedBundle = (get(DEFAULT_ARGS_KEY) ?: Bundle()).apply { putAll(defaultArguments) }
set(DEFAULT_ARGS_KEY, combinedBundle)
}
}

/**
* Convert the receiver [Bundle] to a [CreationExtras] object containing the same key-value pairs.
*/
public fun Bundle.toCreateCreationExtras(): CreationExtras = MutableCreationExtras().apply { putAll(this@toCreateCreationExtras) }
}
91 changes: 49 additions & 42 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
packaging {
Expand Down Expand Up @@ -147,44 +147,51 @@ dependencies {
kover(project(":resacakoin"))
}

//kover {
// reports {
// androidReports("debug") {
// filters {
// excludes {
// classes(
// "*Fragment",
// "*Fragment\$*",
// "*Activity",
// "*Activity\$*",
// "*.databinding.*",
// "*.BuildConfig",
// "*ComposableSingletons\$*",
// "*ColorKt*",
// "*ThemeKt*",
// "*TypeKt*",
// "hilt_aggregated_deps.*",
// "*dagger.hilt.internal.aggregatedroot.codegen*",
// "*com.sebaslogen.resacaapp.sample*", // Ignore sample code
// "*com.sebaslogen.resaca.ViewModelNewInstanceFactory*", // Skip class that is not used in code but used as backup for ViewModelFactory
// )
// }
// html {
// onCheck = true
// }
// xml {
// onCheck = true
// }
// verify {
// onCheck = true
// }
// }
//
// verify {
// rule {
// minBound(90)
// }
// }
// }
// }
//}
kover {
currentProject {
createVariant("custom") {
/**
* Tests, sources, classes, and compilation tasks of the 'debug' build variant will be included in the report variant `custom`.
* Thus, information from the 'debug' variant will be included in the `custom` report for this project and any project that specifies this project as a dependency.
*/
addWithDependencies("debug")
}
}
reports {
// filters for all report types of all build variants
filters {
excludes {
androidGeneratedClasses()
}
}
variant("custom") {
filters {
excludes {
androidGeneratedClasses()
classes(
"*Fragment",
"*Fragment\$*",
"*Activity",
"*Activity\$*",
"*.databinding.*",
"*.BuildConfig",
"*ComposableSingletons\$*",
"*ColorKt*",
"*ThemeKt*",
"*TypeKt*",
"hilt_aggregated_deps.*",
"*dagger.hilt.internal.aggregatedroot.codegen*",
"*com.sebaslogen.resacaapp.sample*", // Ignore sample code
"*com.sebaslogen.resaca.ViewModelNewInstanceFactory*", // Skip class that is not used in code but used as backup for ViewModelFactory
)
}
}

verify {
rule {
minBound(90)
}
}
}
}
}

0 comments on commit b5af9b4

Please sign in to comment.