-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.gradle
174 lines (152 loc) · 5.85 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
import java.text.DateFormat
/*
* Copyright 2012 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.
*/
apply plugin: 'idea'
apply plugin: 'eclipse'
ext {
jfxLibDir = locateJfxLibDir()
}
subprojects {
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'eclipse'
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
archivesBaseName = "dolphin-${project.name}"
repositories {
flatDir name: 'javafx', dirs: [jfxLibDir]
mavenCentral()
}
dependencies {
groovy 'org.codehaus.groovy:groovy-all:1.8.8'
testCompile 'org.spockframework:spock-core:0.6-groovy-1.8', {
exclude group:'org.codehaus.groovy', module: 'groovy-all'
}
testRuntime 'net.sourceforge.cobertura:cobertura:1.9.4.1'
}
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()
}
}
if ( ! project.hasProperty('coverage')) return
if ( project.name.startsWith('demo-')) return
apply from: "${rootDir}/gradle/coverage.gradle"
}
String locateJfxLibDir() {
def javaFxHome = System.env['JAVAFX_HOME'] ?: ''
def javaHome = System.env['JAVA_HOME'] ?: ''
def jdk7 = System.getProperty('java.version')[0..2].toDouble() >= 1.7
def jdk7Home = System.properties.'java.home' ?: ''
def result = "$javaFxHome/rt/lib"
if (new File("$result/jfxrt.jar").exists()) {
println "using javafx from explicit JAVAFX_HOME: $result"
return result
}
result = "$jdk7Home/lib/"
if (jdk7 && new File("$result/jfxrt.jar").exists()) {
println "using javafx from current java 7: $result"
return result
}
result = "$javaHome/jre/lib/"
if (new File("$result/jfxrt.jar").exists()) {
println "using javafx from explicit JAVA_HOME: $result"
return result
}
result = "$javaHome/lib/"
if (new File("$result/jfxrt.jar").exists()) {
println "using javafx from explicit JAVA_HOME: $result"
return result
}
println "please use a Java Version 7_06+"
println " or set JAVA_HOME to a dir that contains the jre/lib/jfxrt.jar"
println " or set JAVAFX_HOME to a dir that contains the rt/lib/jfxrt.jar"
System.exit 1
}
def mavenizedProjects() {
[
project(':client'),
project(':client-javafx'),
project(':shared'),
project(':server'),
project(':demo-javafx-server'), // for testing with dolphin-grails
project(':demo-javafx-shared'), // for testing with dolphin-grails
]
}
configure(mavenizedProjects()) {
group = 'com.canoo.dolphin'
apply plugin: 'maven'
}
def distDir = new File(rootDir, 'dist')
def grailsLibDir = new File(rootDir, 'dolphin-grails/lib')
subprojects.each { proj ->
evaluationDependsOn proj.path
proj.jar.doLast { jarTask ->
copy {
from jarTask.archivePath
into distDir
}
if (proj.name.contains('server') || proj.name.contains('shared')) {
copy {
from jarTask.archivePath
into grailsLibDir
}
}
}
//if (proj.name.startsWith('demo-')){ // for the moment, zip all sources, not only the demos
proj.tasks.add(name: 'demoZip', type: Zip) {
classifier = 'src'
destinationDir = distDir
from proj.sourceSets*.allSource
}
//}
}
task wrap(type:Wrapper, description:"create a gradlew") {
gradleVersion = '1.3'
}
apply {
from 'buildSrc/scripts/docsDependencies.gradle'
from 'buildSrc/scripts/docs.gradle'
}
task apidoc(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/com/canoo/dolphin/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)
}
task "${demo}Demo"(dependsOn:["${demo}DemoPreparation", ':demo-javafx-combined:run'],
description:"start the ${demo} demo"){}
}