-
Notifications
You must be signed in to change notification settings - Fork 77
/
build.gradle
177 lines (143 loc) · 5.9 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
/*
* Copyright (c) 2015 IBM Corporation and others.
*
* 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.
*/
ext.tomcatHome = System.properties["TOMCAT_HOME"] ?: System.getenv()["TOMCAT_HOME"]
ext.brunelServer = System.properties["BRUNEL_SERVER"] ?: System.getenv()["BRUNEL_SERVER"]
println 'Required environment variable values are: '
println 'TOMCAT_HOME is ' + tomcatHome
println 'BRUNEL_SERVER is ' + brunelServer
if (tomcatHome == null) tomcatHome = "tomcat"
if (brunelServer == null) brunelServer = "http://locahost:8080/brunel-service"
def distName = 'brunel-all'
version = '2.6'
configure([project(":data"), project(":core"), project(":etc"), project(":service")]) {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
version = '2.6'
repositories {
mavenCentral()
flatDir {
dirs '../lib', '../lib/rave'
}
}
uploadArchives {
repositories {
flatDir {
dirs '../out/java'
}
}
}
task brunelJar(dependsOn: [build, uploadArchives]) {
description "Build and Creation of Brunel JAR/WAR artifacts to brunel/out/java"
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.+'
}
jar {
manifest.attributes provider: 'org.brunel'
}
}
repositories {
mavenCentral()
}
configurations {
minification
}
dependencies {
minification 'com.google.javascript:closure-compiler:r2388'
}
// Aggregated Javadocs
task brunelJavadoc(type: Javadoc) {
description 'Create aggregated javadocs for all Java projects'
def doccing = [project(':core'), project(':data'), project(':etc'), project(':service')]
source doccing.collect { project -> project.sourceSets.main.allJava }
classpath = files(doccing.collect { project -> project.sourceSets.main.compileClasspath })
destinationDir = new File(projectDir, 'out/javadocs')
maxMemory='2048M'
options.encoding = "UTF-8"
}
// Copy the javascript resources and translated data files to a central location
task assembleWebFiles(type: Copy, dependsOn: ':data:doTranslate') {
from project(':core').project(':core').file('src/main/resources/javascript')
from project(':data').file('build/translated/BrunelData.js')
into 'out/javascript/readable'
}
task makeCSS(type: Copy, dependsOn: [assembleWebFiles]) {
from('out/javascript/readable')
into('out/javascript/minified')
include('Brunel.css')
rename('Brunel.css', 'brunel.' + version + '.css')
}
task makeMinified(type: JavaExec, dependsOn: [assembleWebFiles, makeCSS]) {
print new File(".").absolutePath
classpath configurations.minification
main = 'com.google.javascript.jscomp.CommandLineRunner'
def closureArgs = []
closureArgs << "--charset" << "utf-8"
closureArgs << "--compilation_level" << "SIMPLE_OPTIMIZATIONS"
closureArgs << "--js_output_file" << "out/javascript/minified/brunel." + version + ".min.js"
closureArgs << "out/javascript/readable/BrunelD3.js"
closureArgs << "out/javascript/readable/BrunelData.js"
args closureArgs
}
task makeMinifiedControls(type: JavaExec, dependsOn: [makeCSS]) {
print new File(".").absolutePath
classpath configurations.minification
main = 'com.google.javascript.jscomp.CommandLineRunner'
def closureArgs = []
closureArgs << "--charset" << "utf-8"
closureArgs << "--compilation_level" << "SIMPLE_OPTIMIZATIONS"
closureArgs << "--js_output_file" << "out/javascript/minified/brunel.controls." + version + ".min.js"
closureArgs << "out/javascript/readable/sumoselect/jquery.sumoselect.min.js"
closureArgs << "out/javascript/readable/BrunelEventHandlers.js"
closureArgs << "out/javascript/readable/BrunelJQueryControlFactory.js"
args closureArgs
}
task makePythonJS (type: Copy, dependsOn: [makeMinified, makeMinifiedControls, makeCSS]) {
description 'Copy minified JS for jupyter installation'
from('out/javascript')
into('python/brunel/brunel_ext')
include ('brunel*.' + version + '*', 'sumoselect.css' )
}
task createOutputDir(dependsOn: [makeCSS, makeMinified, makeMinifiedControls, brunelJavadoc]) {
copy {
from project(':core').file('etc/geo files 2.6.zip')
into 'out'
}
copy {
from project(':gallery').file('src/main/webapp/docs/Brunel Documentation.pdf')
into 'out'
}
}
task makeZip(type: Zip, dependsOn: createOutputDir) {
description 'Create a .zip of the contents of the build output (/out)'
from('out/')
archiveName distName + ".zip"
}
task makeTar(type: Tar, dependsOn: createOutputDir) {
description 'Create a compressed tar of the contents of the build output (/out)'
from('out/')
compression = Compression.GZIP
archiveName distName + ".tar.gz"
}
task makeArchives(dependsOn: [makeZip, makeTar]) {
description 'Create both .zip and compressed tar of the contents of the build output (/out)'
}
task build(dependsOn: [project(':core').brunelJar, project(':etc').brunelJar, project(':data').brunelJar, makePythonJS, 'scala:uploadArchives',
project(':service').brunelJar, 'spark-kernel:uploadArchives', assembleWebFiles, createOutputDir ]) {
}