소스 검색

Merge pull request #59 from csmith/master

Make jacoco/coveralls aggregate reports.
pull/60/head
Greg Holmes 9 년 전
부모
커밋
24359c58b9
4개의 변경된 파일56개의 추가작업 그리고 10개의 파일을 삭제
  1. 5
    9
      build.gradle
  2. 1
    1
      circle.yml
  3. 12
    0
      gradle/coverage.gradle
  4. 38
    0
      gradle/coveralls.gradle

+ 5
- 9
build.gradle 파일 보기

@@ -4,8 +4,8 @@ subprojects {
4 4
     apply plugin: 'com.dmdirc.git-version'
5 5
     apply plugin: 'maven-publish'
6 6
     apply plugin: 'java'
7
-    apply plugin: 'jacoco'
8
-    apply plugin: 'com.github.kt3k.coveralls'
7
+
8
+    apply from: '../gradle/coverage.gradle'
9 9
 
10 10
     sourceSets {
11 11
         main.java.srcDirs = ['src']
@@ -106,13 +106,6 @@ subprojects {
106 106
     artifacts {
107 107
         archives javadocJar, sourcesJar
108 108
     }
109
-
110
-    jacocoTestReport {
111
-        reports {
112
-            xml.enabled = true // coveralls plugin depends on xml format report
113
-            html.enabled = true
114
-        }
115
-    }
116 109
 }
117 110
 
118 111
 task wrapper(type: Wrapper) {
@@ -142,3 +135,6 @@ buildscript {
142 135
         classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.1.0'
143 136
     }
144 137
 }
138
+
139
+apply from: 'gradle/coveralls.gradle'
140
+

+ 1
- 1
circle.yml 파일 보기

@@ -14,4 +14,4 @@ test:
14 14
   override:
15 15
     - ./gradlew check
16 16
   post:
17
-    - ./gradlew jacocoTestReport coveralls
17
+    - ./gradlew coveralls

+ 12
- 0
gradle/coverage.gradle 파일 보기

@@ -0,0 +1,12 @@
1
+apply plugin: 'jacoco'
2
+
3
+jacocoTestReport {
4
+  group = 'Coverage reports'
5
+  description = 'Generates a test coverage report for a project'
6
+
7
+  reports {
8
+    xml.enabled = true
9
+    html.enabled = true
10
+  }
11
+}
12
+

+ 38
- 0
gradle/coveralls.gradle 파일 보기

@@ -0,0 +1,38 @@
1
+apply plugin: 'com.github.kt3k.coveralls'
2
+apply plugin: 'jacoco'
3
+
4
+repositories {
5
+  jcenter()
6
+}
7
+
8
+task jacocoRootReport(type: JacocoReport, group: 'Coverage reports', dependsOn: subprojects.test) {
9
+  description = 'Generates an aggregate report from all subprojects'
10
+
11
+  additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
12
+  sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
13
+  classDirectories = files(subprojects.sourceSets.main.output)
14
+  executionData = files(subprojects.jacocoTestReport.executionData)
15
+
16
+  reports {
17
+    html.enabled = true
18
+    xml.enabled = true
19
+  }
20
+
21
+  doFirst {
22
+    executionData = files(executionData.findAll { it.exists() })
23
+  }
24
+}
25
+
26
+coveralls {
27
+  jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
28
+  subprojects.sourceSets.main.allSource.srcDirs*.path.each { sourceDirs.addAll(it) }
29
+}
30
+
31
+tasks.coveralls {
32
+  group = 'Coverage reports'
33
+  description = 'Uploads the aggregated coverage report to Coveralls'
34
+
35
+  dependsOn jacocoRootReport
36
+  onlyIf { System.env.'CI' }
37
+}
38
+

Loading…
취소
저장