File tree Expand file tree Collapse file tree 6 files changed +101
-0
lines changed Expand file tree Collapse file tree 6 files changed +101
-0
lines changed Original file line number Diff line number Diff line change
1
+ build /
Original file line number Diff line number Diff line change
1
+ Unfortunately even Ant task can't get data from tests:
2
+
3
+ ----
4
+ [ant:jacoco:report] Loading execution data file /Users/evgeny.mandrikov/projects/jacoco/jacoco/example/build/jacoco/test.exec
5
+ [ant:jacoco:report] Got org/example/ExampleKt within org/example/ExampleKt
6
+ [ant:jacoco:report] Got org/example/ExampleKt within org/example/ExampleKt
7
+ [ant:jacoco:report] Got org/example/ExampleKt within org/example/ExampleKt
8
+ [ant:jacoco:report] Writing bundle 'main' with 1 classes
9
+ [ant:jacoco:report] Got org/example/ExampleKt within org/example/ExampleTests
10
+ [ant:jacoco:report] Got org/example/ExampleKt within org/example/ExampleTests
11
+ [ant:jacoco:report] Writing bundle 'test' with 1 classes
12
+ ----
13
+
14
+ * https://github.com/Kotlin/kotlinx-kover/blob/v0.7.3/kover-gradle-plugin/src/main/kotlin/kotlinx/kover/gradle/plugin/tools/jacoco/JacocoAnt.kt#L48-L55
15
+ * https://github.com/gradle/gradle/blob/v8.4.0/subprojects/jacoco/src/main/java/org/gradle/internal/jacoco/AbstractAntJacocoReport.java#L66-L82
Original file line number Diff line number Diff line change
1
+ plugins {
2
+ id ' org.jetbrains.kotlin.jvm' version ' 1.9.10'
3
+ id ' jacoco'
4
+ }
5
+
6
+ repositories {
7
+ mavenLocal()
8
+ mavenCentral()
9
+ }
10
+
11
+ dependencies {
12
+ testImplementation(platform(" org.junit:junit-bom:5.10.0" ))
13
+ testImplementation(" org.junit.jupiter:junit-jupiter" )
14
+ }
15
+
16
+ test {
17
+ useJUnitPlatform()
18
+ }
19
+
20
+ jacoco {
21
+ toolVersion = ' 0.8.12-SNAPSHOT'
22
+ }
23
+
24
+ task report {
25
+ doLast {
26
+ // See
27
+ // https://docs.gradle.org/current/userguide/ant.html
28
+ // https://jacoco.org/jacoco/trunk/doc/ant.html
29
+ ant. taskdef(
30
+ resource : ' org/jacoco/ant/antlib.xml' ,
31
+ classpath : project. configurations. jacocoAnt. asPath,
32
+ uri : ' jacoco'
33
+ )
34
+ ant. ' jacoco:report' () {
35
+ html(destdir : ' build/report' )
36
+ executiondata() {
37
+ fileset(file : ' build/jacoco/test.exec' )
38
+ }
39
+ structure(name : ' Example' ) {
40
+ Group (name : ' combined' ) {
41
+ classfiles() { fileset(dir : ' build/classes/kotlin/' ) }
42
+ sourcefiles() { fileset(dir : ' src/main/kotlin/' ) }
43
+ }
44
+ Group (name : ' separate' ) {
45
+ Group (name : ' main' ) {
46
+ classfiles() { fileset(dir : ' build/classes/kotlin/main' ) }
47
+ sourcefiles() { fileset(dir : ' src/main/kotlin/' ) }
48
+ }
49
+ Group (name : ' test' ) {
50
+ classfiles() { fileset(dir : ' build/classes/kotlin/test' ) }
51
+ sourcefiles() { fileset(dir : ' src/test/kotlin/' ) }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ gradle clean build
4
+ gradle report --info
Original file line number Diff line number Diff line change
1
+ package org.example ;
2
+
3
+ inline fun inlined () {
4
+ }
5
+
6
+ fun callsite () {
7
+ inlined()
8
+ }
9
+
10
+ inline fun inlined2 () {
11
+ }
Original file line number Diff line number Diff line change
1
+ package org.example ;
2
+
3
+ import org.junit.jupiter.api.Test
4
+
5
+ class ExampleTests {
6
+
7
+ @Test
8
+ fun test () {
9
+ callsite()
10
+ inlined2()
11
+ }
12
+
13
+ }
You can’t perform that action at this time.
0 commit comments