mirror of https://github.com/readrops/Readrops.git
Migrate Jacoco task to Kotlin DSL
This commit is contained in:
parent
19c5b8b17e
commit
159a6969c2
|
@ -32,6 +32,6 @@ jobs:
|
||||||
script: ./gradlew clean build connectedCheck
|
script: ./gradlew clean build connectedCheck
|
||||||
- uses: codecov/codecov-action@v2.1.0
|
- uses: codecov/codecov-action@v2.1.0
|
||||||
with:
|
with:
|
||||||
files: ./build/reports/jacoco/jacocoFullReport.xml
|
files: ./build/reports/jacoco/jacocoFullReport/jacocoFullReport.xml
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: true
|
||||||
verbose: true
|
verbose: true
|
|
@ -7,6 +7,10 @@ android {
|
||||||
namespace = "com.readrops.api"
|
namespace = "com.readrops.api"
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
enableUnitTestCoverage = true
|
||||||
|
}
|
||||||
|
|
||||||
create("beta") {
|
create("beta") {
|
||||||
initWith(getByName("release"))
|
initWith(getByName("release"))
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import com.android.build.gradle.AppPlugin
|
import com.android.build.gradle.AppPlugin
|
||||||
import com.android.build.gradle.BaseExtension
|
import com.android.build.gradle.BaseExtension
|
||||||
import com.android.build.gradle.LibraryExtension
|
import com.android.build.gradle.LibraryExtension
|
||||||
|
@ -24,11 +23,10 @@ buildscript {
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.ksp) apply false
|
alias(libs.plugins.ksp) apply false
|
||||||
alias(libs.plugins.compose.compiler) apply false
|
alias(libs.plugins.compose.compiler) apply false
|
||||||
|
jacoco
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
//apply("jacoco")
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -87,54 +85,62 @@ tasks.register<Delete>("clean") {
|
||||||
delete(rootProject.layout.buildDirectory)
|
delete(rootProject.layout.buildDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*jacoco {
|
jacoco {
|
||||||
toolVersion = "0.8.7"
|
toolVersion = "0.8.7"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks.register("jacocoFullReport", JacocoReport) {
|
tasks.register<JacocoReport>("jacocoFullReport") {
|
||||||
group = "Reporting"
|
group = "Reporting"
|
||||||
description = "Generate Jacoco coverage reports for the debug build"
|
description = "Generate Jacoco coverage reports for the debug build"
|
||||||
|
|
||||||
reports {
|
reports {
|
||||||
html {
|
xml.required.set(true)
|
||||||
enabled true
|
html.required.set(true)
|
||||||
destination file("build/reports/jacoco/html")
|
|
||||||
}
|
|
||||||
xml {
|
|
||||||
enabled true
|
|
||||||
destination file("build/reports/jacoco/jacocoFullReport.xml")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//dependsOn ":app:testDebugUnitTest"
|
dependsOn(":app:testDebugUnitTest")
|
||||||
dependsOn ":api:testDebugUnitTest"
|
dependsOn(":api:testDebugUnitTest")
|
||||||
dependsOn ":db:testDebugUnitTest"
|
dependsOn(":db:testDebugUnitTest")
|
||||||
//dependsOn ":app:connectedAndroidTest"
|
dependsOn(":app:connectedAndroidTest")
|
||||||
dependsOn ":db:connectedAndroidTest"*/
|
dependsOn(":db:connectedAndroidTest")
|
||||||
|
|
||||||
//final fileFilter = ["**/R.class", "**/R\$*.class", "**/BuildConfig.*", "**/Manifest*.*", "android/**/*.*"]
|
val excludeFilter = listOf(
|
||||||
|
"**/R.class",
|
||||||
|
"**/R\$*.class",
|
||||||
|
"**/BuildConfig.*",
|
||||||
|
"**/Manifest*.*",
|
||||||
|
"android/**/*.*"
|
||||||
|
)
|
||||||
|
|
||||||
/* classDirectories.setFrom files([
|
classDirectories.setFrom(
|
||||||
//fileTree(dir: "$project.rootDir/app/build/intermediates/javac/debug", excludes: fileFilter),
|
files(
|
||||||
//fileTree(dir: "$project.rootDir/app/build/tmp/kotlin-classes/debug", excludes: fileFilter),
|
fileTree("${project.rootDir}/app/build/intermediates/javac/debug") { exclude(excludeFilter) },
|
||||||
fileTree(dir: "$project.rootDir/api/build/intermediates/javac/debug", excludes: fileFilter),
|
fileTree("${project.rootDir}/app/build/tmp/kotlin-classes/debug") { exclude(excludeFilter) }
|
||||||
fileTree(dir: "$project.rootDir/api/build/tmp/kotlin-classes/debug", excludes: fileFilter),
|
),
|
||||||
fileTree(dir: "$project.rootDir/db/build/tmp/kotlin-classes/debug", excludes: fileFilter),
|
fileTree("${project.rootDir}/api/build/tmp/kotlin-classes/debug") { exclude(excludeFilter) },
|
||||||
])
|
fileTree("${project.rootDir}/db/build/tmp/kotlin-classes/debug") { exclude(excludeFilter) },
|
||||||
def coverageSourceDirs = [
|
)
|
||||||
"$project.rootDir/app/src/main/java",
|
|
||||||
"$project.rootDir/api/src/main/java",
|
|
||||||
"$project.rootDir/db/src/main/java",
|
|
||||||
]
|
|
||||||
|
|
||||||
additionalSourceDirs.setFrom files(coverageSourceDirs)
|
val coverageSourceDirs = listOf(
|
||||||
sourceDirectories.setFrom files(coverageSourceDirs)
|
"${project.rootDir}/app/src/main/java",
|
||||||
executionData.setFrom fileTree(dir: project.rootDir, includes: [
|
"${project.rootDir}/api/src/main/java",
|
||||||
"app/jacoco.exec",
|
"${project.rootDir}/db/src/main/java",
|
||||||
"db/jacoco.exec",
|
)
|
||||||
"api/jacoco.exec",
|
|
||||||
"app/build/outputs/code_coverage/debugAndroidTest/connected/*-coverage.ec",
|
additionalSourceDirs.setFrom(files(coverageSourceDirs))
|
||||||
"db/build/outputs/code_coverage/debugAndroidTest/connected/*-coverage.ec"
|
sourceDirectories.setFrom(files(coverageSourceDirs))
|
||||||
])
|
|
||||||
}*/
|
executionData.setFrom(
|
||||||
|
fileTree(project.rootDir) {
|
||||||
|
include(
|
||||||
|
listOf(
|
||||||
|
"api/build/outputs/unit_test_code_coverage/**/*.exec",
|
||||||
|
"db/build/outputs/unit_test_code_coverage/**/*.exec",
|
||||||
|
"app/build/outputs/code_coverage/debugAndroidTest/connected/**/*.ec",
|
||||||
|
"db/build/outputs/code_coverage/debugAndroidTest/connected/**/*.ec"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,11 @@ android {
|
||||||
namespace = "com.readrops.db"
|
namespace = "com.readrops.db"
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
enableUnitTestCoverage = true
|
||||||
|
enableAndroidTestCoverage = true
|
||||||
|
}
|
||||||
|
|
||||||
create("beta") {
|
create("beta") {
|
||||||
initWith(getByName("release"))
|
initWith(getByName("release"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue