Browse Source

Add coveralls support, maybe.

pull/310/head
Chris Smith 9 years ago
parent
commit
8b9cdf7d3d
4 changed files with 60 additions and 0 deletions
  1. 6
    0
      build.gradle
  2. 4
    0
      circle.yml
  3. 12
    0
      gradle/coverage.gradle
  4. 38
    0
      gradle/coveralls.gradle

+ 6
- 0
build.gradle View File

@@ -4,6 +4,8 @@ subprojects {
4 4
     apply plugin: 'findbugs'
5 5
     apply plugin: 'pmd'
6 6
 
7
+    apply from: '../gradle/coverage.gradle'
8
+
7 9
     configurations {
8 10
         bundle
9 11
 
@@ -140,6 +142,7 @@ buildscript {
140 142
 
141 143
     dependencies {
142 144
         classpath group: 'com.dmdirc', name: 'git-version', version: '1.0'
145
+        classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.1.0'
143 146
     }
144 147
 }
145 148
 
@@ -163,3 +166,6 @@ def plugin(name) {
163 166
         println "Couldn't find project $name"
164 167
     }
165 168
 }
169
+
170
+apply from: 'gradle/coveralls.gradle'
171
+

+ 4
- 0
circle.yml View File

@@ -40,6 +40,10 @@ test:
40 40
     - ./gradlew --stacktrace --parallel plugins:jar plugins:test:
41 41
         pwd:
42 42
           ../meta
43
+  post:
44
+    - ./gradlew plugins:coveralls:
45
+        pwd:
46
+          ../meta
43 47
 
44 48
 general:
45 49
   artifacts:

+ 12
- 0
gradle/coverage.gradle View File

@@ -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 View File

@@ -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…
Cancel
Save