forked from JohannesLichtenberger/open-dolphin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
355 lines (308 loc) · 11.6 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
/*
* Copyright 2012-2015 Canoo Engineering AG.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
}
}
allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
}
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
subprojects {
apply plugin: 'groovy'
plugins.withType(JavaPlugin) {
configurations {
compileOnly
testCompileOnly
}
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]
}
}
}
configurations { // only needed such that groovydoc can work with groovy core plus groovy-ant module only
groovyAnt.extendsFrom(runtime)
}
groovydoc {
groovyClasspath = project.configurations.groovyAnt
}
archivesBaseName = "dolphin-${project.name}"
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
compile "org.codehaus.groovy:groovy:$groovyVersion"
groovyAnt "org.codehaus.groovy:groovy-ant:$groovyVersion"
testCompile "org.codehaus.groovy:groovy-test:$groovyVersion"
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0', {
exclude group: 'org.codehaus.groovy'
}
}
task makeDirs(description: 'make all dirs for project setup') << {
def sources = [sourceSets.main, sourceSets.test]
sources*.allSource*.srcDirs.flatten().each { File srcDir ->
println "making $srcDir"
srcDir.mkdirs()
}
}
}
def coverageProjects() {
[
project(':client'),
project(':client-javafx'),
project(':shared'),
project(':server'),
project(':combined')
]
}
def mavenizedProjects() {
coverageProjects() + [
project(':logo-javafx'),
project(':demo-javafx-server'), // for testing with dolphin-grails
project(':demo-javafx-shared'), // for testing with dolphin-grails
]
}
List coverageSources = []
Set coverageClasses = [] as Set
coverageProjects().each {
coverageClasses << file("subprojects/${it.name}/build/classes/main")
}
coverageProjects().each {
coverageSources << file("subprojects/${it.name}/src/main/groovy")
coverageSources << file("subprojects/${it.name}/src/main/java")
}
jacoco {
toolVersion = jacocoVersion
}
configure(coverageProjects()) {
apply plugin: 'jacoco'
jacoco {
toolVersion = jacocoVersion
}
test {
jacoco {
excludes = ['org.opendolphin.logo.*']
}
}
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
additionalSourceDirs = project.files(coverageSources)
sourceDirectories = project.files(coverageSources)
classDirectories = files(coverageClasses)
reports {
xml.enabled = true
csv.enabled = false
html.enabled = true
}
}
}
configure(mavenizedProjects()) {
apply plugin: 'maven'
apply plugin: 'signing'
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
javadoc {
failOnError = false
}
task groovydocJar(type: Jar, dependsOn:groovydoc) {
classifier = 'javadoc'
from groovydoc.destinationDir
}
artifacts {
archives sourcesJar
archives groovydocJar
}
signing {
required { gradle.taskGraph.hasTask(uploadArchives) }
sign configurations.archives
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(uploadArchives)) {
uploadArchives {
repositories.mavenDeployer {
def nexusURL = version.endsWith('SNAPSHOT') ? nexusDeployURL : nexusReleaseDelopyURL
def sonatypeURL = version.endsWith('SNAPSHOT') ? sonatypeDeployURL : sonatypeReleaseDeployURL
beforeDeployment { MavenDeployment deployment ->
signing.signPom(deployment)
}
if (project.hasProperty('mavenCentral')) {
repository(url: sonatypeURL) {
authentication(userName: sonatypeUser, password: sonatypePassword)
}
} else {
repository(url: nexusURL) {
authentication(userName: nexusDeployUser, password: nexusDeployPassword)
}
}
pom.project {
name 'Open Dolphin'
packaging 'jar'
description 'Dolphin is a free open-source library that bridges the worlds of enterprise Java and desktop Java.' +
' It uses presentation models to bind client-side views to server-side actions.'
url 'http://open-dolphin.org/'
scm {
url 'https://github.com/canoo/open-dolphin.git'
connection 'scm:[email protected]:canoo/open-dolphin.git'
developerConnection 'scm:[email protected]:canoo/open-dolphin.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'aalmiray'
name 'Andres Almiray'
}
developer {
id 'clipp'
name 'Christoph Lipp'
}
developer {
id 'DieterHolz'
name 'Dieter Holz'
}
developer {
id 'detlef-brendle'
name 'Detlef Brendle'
}
developer {
id 'Dierk'
name 'Dierk Koenig'
}
developer {
id 'svene'
name 'Sven Ehrke'
}
developer {
id 'jporzelt'
name 'Johannes Porzelt'
}
developer {
id 'kunsingh'
name 'Kunal Singh'
}
developer {
id 'Nicolai82'
name 'Nicolai Kilian'
}
developer {
id 'ToddCostella'
name 'Todd Costella'
}
}
}
}
}
}
}
}
def distDir = new File(rootDir, 'dist')
subprojects.each { proj ->
evaluationDependsOn proj.path
proj.jar.doLast { jarTask ->
copy {
from jarTask.archivePath
into distDir
}
}
proj.tasks.create(name: 'sourceZip', type: Zip) {
classifier = 'src'
destinationDir = distDir
from proj.sourceSets*.allSource
}
}
task wrap(type: Wrapper, description: "create a gradlew") {
gradleVersion = '2.0'
}
apply {
from 'buildSrc/scripts/docsDependencies.gradle'
from 'buildSrc/scripts/docs.gradle'
}
task apidoc(group: 'Documentation', type: Groovydoc) {
def coreProjects = subprojects.findAll { !it.name.contains('demo') }
source coreProjects.collect { project -> project.sourceSets.main.allSource }
classpath = files(subprojects.collect { project -> project.sourceSets.main.compileClasspath })
groovyClasspath = classpath
destinationDir = new File(buildDir, 'api')
docTitle = "Open Dolphin API documentation"
footer = "Created ${new java.text.SimpleDateFormat().format(new Date())}"
header = docTitle
windowTitle = docTitle
overview = new File('docs/docOverview.html')
link("http://download.oracle.com/javase/7/docs/api", "java.", "javax.")
link("http://docs.oracle.com/javafx/2/api/", "javafx.")
link("http://groovy.codehaus.org/api", "groovy.", "org.codehaus.groovy.")
}
def demos = new File(rootDir, 'subprojects/demo-javafx/combined/src/main/groovy/org/opendolphin/demo')
.list()
.findAll { it.startsWith('start') && it.endsWith('Demo.groovy') }
.collect { it - 'start' - 'Demo.groovy' }
task listDemos(description: "List all available demos") << { demos.sort().each { println "gradlew ${it}Demo" } }
demos.each { demo ->
task "${demo}DemoPreparation"(description: "internal") << {
project(':demo-javafx-combined').ext.set('demoApplicationName', demo)
}
def group = demo.startsWith('Grails') ? 'Demo (server required)' : 'Demo'
task "${demo}Demo"(group: group, dependsOn: ["${demo}DemoPreparation", ':demo-javafx-combined:run'],
description: "start the ${demo} demo") {}
}
task clean(type: Delete) {
delete 'build'
delete 'dist'
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
group = "Reporting"
description = "Aggregate Jacoco coverage reports."
additionalSourceDirs = files(coverageProjects().sourceSets.main.allSource.srcDirs)
sourceDirectories = files(coverageProjects().sourceSets.main.allSource.srcDirs)
classDirectories = files(coverageProjects().sourceSets.main.output)
executionData = files(coverageProjects().jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
html.destination = "${buildDir}/reports/jacoco/test/html"
xml.destination = "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}