source: build.gradle @ 19016ed

Last change on this file since 19016ed was 19016ed, checked in by str4d <str4d@…>, 2 years ago

Gradle: Add code coverage reporting, upload from Travis CI to Codecov

  • Property mode set to 100644
File size: 1.6 KB
Line 
1// Exclude apps/ dir itself, but include its subdirs
2def javaProjects = subprojects - project(':apps')
3
4configure(javaProjects) {
5    apply plugin: 'java'
6    apply plugin: 'jacoco'
7    apply plugin: 'eclipse'
8    apply plugin: 'idea'
9
10    repositories {
11        jcenter()
12    }
13
14    dependencies {
15        testCompile 'junit:junit:4.+'
16        testCompile 'org.hamcrest:hamcrest-library:1.3'
17        testCompile 'org.mockito:mockito-core:2.11.0'
18    }
19
20    jar {
21        manifest {
22            attributes 'Implementation-Version': '0.9.31-7'
23        }
24    }
25
26    sourceCompatibility = 1.7
27    // Set i2pBootClasspath=/path/to/rt.jar:/path/to/jce.jar in ~/.gradle/gradle.properties if needed
28    if (i2pBootClasspath) {
29        tasks.withType(AbstractCompile, { AbstractCompile ac ->
30            ac.options.bootstrapClasspath = files(i2pBootClasspath)
31        })
32    }
33}
34
35task codeCoverageReport(type: JacocoReport) {
36    dependsOn(javaProjects.test)
37
38    jacocoClasspath = project(':core').configurations.jacocoAnt
39    additionalSourceDirs = files(javaProjects.sourceSets.main.allSource.srcDirs)
40    sourceDirectories = files(javaProjects.sourceSets.main.allSource.srcDirs)
41    classDirectories = files(javaProjects.sourceSets.main.output)
42    executionData = files(javaProjects.jacocoTestReport.executionData)
43
44    doFirst {
45        executionData = files(executionData.findAll { it.exists() })
46    }
47
48    reports {
49        xml.enabled true
50        xml.destination "${buildDir}/reports/jacoco/report.xml"
51        html.enabled true
52        html.destination "${buildDir}/reports/jacoco/html"
53    }
54}
55
56//apply from: file('gradle/update.gradle')
Note: See TracBrowser for help on using the repository browser.