|
1 | 1 | apply plugin: 'java' |
2 | 2 | apply plugin: 'eclipse' |
3 | | - |
4 | | -jar.baseName = 'JSON-java' |
| 3 | +apply plugin: 'jacoco' |
5 | 4 |
|
6 | 5 | sourceSets { |
7 | | - test { |
8 | | - java { |
9 | | - srcDir 'src/test' |
| 6 | + // Uncomment main if you have merged JSON-Java and JSON-Java-unit-test code |
| 7 | + main { |
| 8 | + java { |
| 9 | + srcDir 'src' |
| 10 | + exclude 'test/' |
| 11 | + } |
| 12 | + } |
| 13 | + test { |
| 14 | + java { |
| 15 | + srcDir 'src/test' |
| 16 | + } |
10 | 17 | } |
11 | | - } |
12 | 18 | } |
13 | 19 |
|
14 | 20 | repositories { |
15 | | - mavenCentral() |
| 21 | + mavenCentral() |
16 | 22 | } |
17 | 23 |
|
18 | 24 | dependencies { |
19 | | - testCompile group: 'junit', name: 'junit', version: '4.+' |
20 | | - testCompile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.1.0' |
21 | | - testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5' |
22 | | - // Use this line if you are testing a JSON-Java release. |
23 | | - // Otherwise add an external jar from your local repository in Eclipse |
24 | | - // (The gradle build won't work unless you add a main sourceSets entry and a jar.baseName entry |
25 | | - // testCompile group: 'org.json', name: 'json', version: '20151123' |
| 25 | + testCompile group: 'junit', name: 'junit', version: '4.+' |
| 26 | + testCompile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.1.0' |
| 27 | + testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5' |
| 28 | + // Uncomment if you are testing against a JSON-Java release |
| 29 | + // testCompile 'org.json:json:20160212' |
| 30 | + // Uncomment if you have copied a local JSON-Java jar file into this project |
| 31 | + // testCompile files('./JSON-Java.jar') |
26 | 32 | } |
| 33 | + |
| 34 | +test { finalizedBy jacocoTestReport } |
| 35 | +jacocoTestReport{ |
| 36 | + additionalSourceDirs = files(sourceSets.main.allJava.srcDirs) |
| 37 | + reports { |
| 38 | + xml.enabled false |
| 39 | + csv.enabled false |
| 40 | + html.destination "${buildDir}/reports/jacoco/html" |
| 41 | + } |
| 42 | + executionData = files('build/jacoco/test.exec') |
| 43 | +} |
| 44 | + |
0 commit comments