forked from miho/VWorkflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
199 lines (163 loc) · 6.23 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
import java.text.SimpleDateFormat
apply from: 'gradle/idea.gradle'
apply from: 'gradle/jdkdetect.gradle'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.0'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath 'org.kordamp.gradle:stats-gradle-plugin:0.1.5'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0'
classpath 'net.nemerosa:versioning:1.7+'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}
Date buildTimeAndDate = new Date()
ext {
buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
macosx = System.getProperty('os.name').contains('Mac OS')
jacocoMergeExecFile = "${buildDir}/jacoco/root.exec"
jacocoRootReportPath = "${buildDir}/reports/jacoco/root/"
projectsWithCoverage = []
projectsToPublish = []
}
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
jacoco {
toolVersion = jacocoVersion
}
println("Gradle uses JDK " + project.jdk)
allprojects {
apply plugin: 'base'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'com.github.ben-manes.versions'
repositories {
jcenter()
}
// JDK 8 is way too strict about Javadoc style
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
subprojects { subproj ->
subproj.apply plugin: 'java'
configurations {
compileOnly
testCompileOnly
}
subproj.tasks.withType(JavaCompile) {
sourceCompatibility = subproj.sourceCompatibility
targetCompatibility = subproj.targetCompatibility
options*.encoding = 'UTF-8'
}
sourceSets {
main {
compileClasspath += [configurations.compileOnly]
}
test {
compileClasspath += [configurations.testCompileOnly]
}
}
javadoc {
classpath += [configurations.compileOnly]
}
idea {
module {
scopes.PROVIDED.plus += [configurations.compileOnly]
scopes.PROVIDED.plus += [configurations.testCompileOnly]
}
}
tasks.withType(AbstractCompile) {
if (rootProject.hasProperty('lint') && rootProject.lint.toBoolean()) {
options.compilerArgs = [
'-Xlint:all', '-Xlint:deprecation', '-Xlint:unchecked'
]
}
}
subproj.apply from: rootProject.file('gradle/jdkdetect.gradle')
subproj.apply from: rootProject.file('gradle/version-info.gradle')
subproj.apply from: rootProject.file('gradle/code-quality.gradle')
subproj.apply plugin: 'org.kordamp.gradle.stats'
if (subproj.publishJars.toBoolean()) {
task sourceJar(type: Jar) {
group 'Build'
description 'An archive of the source code'
classifier 'sources'
from sourceSets.main.allSource
}
subproj.apply from: rootProject.file('gradle/code-coverage.gradle')
subproj.apply from: rootProject.file('gradle/publishing.gradle')
subproj.apply from: rootProject.file('gradle/javafx.gradle')
projectsToPublish << subproj
projectsWithCoverage << subproj
dependencies {
compileOnly project.files(project.jfxrtLocation)
testCompile 'junit:junit:4.+'
}
test {
// set heap size for the test JVM(s)
minHeapSize = "64m"
maxHeapSize = "256m"
testLogging {
afterSuite { desc, result ->
if (!desc.parent) {
println "Test results ${project.name}: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
}
}
}
}
javadoc {
excludes = ['**/*.html', 'META-INF/**']
options.addBooleanOption('javafx', true)
options.use = true
options.splitIndex = true
options.encoding = 'UTF-8'
options.author = true
options.version = true
options.windowTitle = "$subproj.name $version"
options.docTitle = "$subproj.name $version"
options.footer = rootProject.javadocFooter
options.links = ['http://junit.org/javadoc/latest/',
'http://docs.oracle.com/javase/8/docs/api/',
'http://docs.oracle.com/javase/8/javafx/api/']
}
}
}
evaluationDependsOnChildren()
task jacocoRootMerge(type: org.gradle.testing.jacoco.tasks.JacocoMerge) {
dependsOn = projectsWithCoverage.test
dependsOn = projectsWithCoverage.jacocoTestReport
executionData = files(projectsWithCoverage.jacocoTestReport.executionData)
destinationFile = file(jacocoMergeExecFile)
}
task jacocoRootReport(dependsOn: jacocoRootMerge, type: JacocoReport, overwrite: true) {
executionData files(projectsWithCoverage.jacocoTestReport.executionData)
sourceDirectories = files(projectsWithCoverage.sourceSets.main.allSource.srcDirs)
classDirectories = files(projectsWithCoverage.sourceSets.main.output)
reports {
xml.enabled = true
csv.enabled = false
html.enabled = true
html.destination = "${jacocoRootReportPath}/html"
xml.destination = "${jacocoRootReportPath}/root.xml"
}
}
coveralls {
sourceDirs = projectsWithCoverage.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${jacocoRootReportPath}/root.xml"
}
tasks.coveralls {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Coveralls'
dependsOn jacocoRootReport
onlyIf { System.env.'CI' }
}