forked from watson-developer-cloud/java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
157 lines (124 loc) · 3.84 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
plugins {
id 'net.researchgate.release' version '2.4.0'
id 'me.champeau.gradle.japicmp' version '0.2.6'
}
apply from: 'utils.gradle'
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'eclipse'
apply plugin: 'idea'
archivesBaseName = 'parent'
description = 'Client library to use the IBM Watson and Alchemy Services'
javadoc {
source = 'src/main/java'
}
checkstyle {
ignoreFailures = false
}
checkstyleMain {
ignoreFailures = false
}
checkstyleTest {
ignoreFailures = false
}
task docs(type: Javadoc) {
destinationDir = file("$buildDir/docs/all")
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
task copyJars(type: Copy) {
from subprojects.collect { it.tasks.withType(Jar) }
into "$buildDir/allJars"
}
task signJars(type: Copy) {
from subprojects.collect { it.tasks.withType(Sign) }
into "$buildDir/allJars"
}
allprojects {
apply plugin: 'java' // *Compatibility has no effect before the 'java' plug-in is applied
apply plugin: 'jacoco'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
repositories {
maven { url = "http://repo.maven.apache.org/maven2" }
}
}
subprojects {
dependencies {
testCompile group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '3.11.0'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
testCompile group: 'com.google.guava', name: 'guava', version: '20.0'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
checkstyleMain {
ignoreFailures = false
}
checkstyleTest {
ignoreFailures = false
}
test {
testLogging {
events "failed"
exceptionFormat "full"
}
}
afterEvaluate {
if (plugins.hasPlugin(JavaPlugin)) {
rootProject.tasks.docs {
source += files(sourceSets.main.allJava)
classpath += files(sourceSets*.compileClasspath)
}
}
}
}
task codeCoverageReport(type: JacocoReport) {
// Gather execution data from all sub projects
// (change this if you e.g. want to calculate unit test/integration test coverage separately)
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
// Add all relevant source sets from the sub projects
subprojects.each {
sourceSets it.sourceSets.main
}
reports {
xml.enabled true
xml.destination "${buildDir}/reports/jacoco/report.xml"
html.enabled true
html.destination "${buildDir}/reports/jacoco"
csv.enabled false
}
}
// always run the tests before generating the report
codeCoverageReport.dependsOn {
subprojects*.test
testReport
}
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
// Include the results from the `test` task in all subprojects
reportOn subprojects*.test
}
release {
tagTemplate = 'java-sdk-$version'
}
task startmessage {
doLast {
println 'starting build'
}
}
task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask) {
ext.oldJarVersion = project.hasProperty('oldJarVersion') ? project.getProperty('oldJarVersion') : "pass-in-older-jar-version"
ext.newJarVersion = project.hasProperty('newJarVersion') ? project.getProperty('newJarVersion') : "pass-in-newer-jar-version"
ext.oldJarPath = project.hasProperty('oldJarPath') ? project.getProperty('oldJarPath') : "pass/in/path/to/older/version.jar"
ext.newJarPath = project.hasProperty('newJarPath') ? project.getProperty('newJarPath') : "pass/in/path/to/newer/version.jar"
oldClasspath = files(oldJarPath)
newClasspath = files(newJarPath)
onlyModified = true
failOnModification = true
htmlOutputFile = file("$buildDir/reports/java-sdk-api-diff-" + oldJarVersion + "-to-" + newJarVersion + ".html")
}
beforeReleaseBuild.dependsOn startmessage