-
Notifications
You must be signed in to change notification settings - Fork 3.7k
/
jacoco.gradle.kts
51 lines (43 loc) · 1.62 KB
/
jacoco.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
apply(plugin = "jacoco")
configure<JacocoPluginExtension> { toolVersion = "0.8.7" }
tasks.register<JacocoReport>("debugCoverage") {
group = "Reporting"
description = "Generate Jacoco coverage reports for the debug build."
dependsOn("testDebugUnitTest")
val excludes =
listOf(
"**/R.class",
"**/R\$*.class",
"**/BuildConfig.*",
"**/Manifest*.*",
"**/*Test*.*",
"android/**/*.*",
"androidx/**/*.*",
"**/*\$ViewInjector*.*",
"**/*Dagger*.*",
"**/*MembersInjector*.*",
"**/*_Factory.*",
"**/*_Provide*Factory*.*",
"**/*_ViewBinding*.*",
"**/AutoValue_*.*",
"**/R2.class",
"**/R2\$*.class",
"**/*Directions\$*",
"**/*Directions.*",
"**/*Binding.*")
val jClasses = "${project.buildDir}/intermediates/javac/debug/classes/com/facebook/core"
val kClasses = "${project.buildDir}/tmp/kotlin-classes/debug/com/facebook"
val javaClasses = fileTree(mapOf("dir" to jClasses, "excludes" to excludes))
val kotlinClasses = fileTree(mapOf("dir" to kClasses, "excludes" to excludes))
classDirectories.from(files(listOf(javaClasses, kotlinClasses)))
val sourceDirs = listOf("${project.projectDir}/src/main/java")
sourceDirectories.from(files(sourceDirs))
executionData.from(files(listOf("${project.buildDir}/jacoco/testDebugUnitTest.exec")))
}