-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathbuild.gradle
265 lines (207 loc) · 10.7 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
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
group = 'uk.org.tombolo'
version = '0.1.0'
repositories {
maven { name = "osgeo"; url = "http://download.osgeo.org/webdav/geotools/" }
maven { name = "osm4j"; url = "http://mvn.topobyte.de" }
maven { name = "slimjars"; url = "http://mvn.slimjars.com" }
mavenCentral()
}
dependencies {
//Py4j jars
compile group: 'net.sf.py4j', name: 'py4j', version: '0.10.6'
// Geo Tools
compile group:'org.geotools', name: 'gt-referencing', version: '14.0'
compile group:'org.geotools', name: 'gt-geojson', version: '14.0'
compile group:'org.geotools', name: 'gt-shapefile', version: '14.0'
compile group:'org.geotools', name: 'gt-epsg-extension', version: '14.0'
compile group:'org.geotools', name: 'gt-epsg-hsql', version: '14.0'
compile group:'org.geotools.jdbc', name: 'gt-jdbc-postgis', version: '14.0'
compile group:'org.geotools', name: 'gt-geojsondatastore', version: '15.0'
// POI Excel file manipulation
compile group: 'org.apache.poi', name: 'poi', version: '3.16'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.16'
// JSON handling
compile group: 'javax.json', name: 'javax.json-api', version: '1.1'
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
compile group: 'com.google.code.gson', name: 'gson', version: '2.4'
compile group: 'com.github.fge', name: 'json-schema-validator', version: '2.2.6'
compile 'org.glassfish:javax.json:1.0.4'
// Commons
compile group: 'commons-io', name: 'commons-io', version: '2.4'
compile group: 'org.apache.commons', name: 'commons-compress', version: '1.10'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
compile group: 'org.apache.commons', name: 'commons-csv', version: '1.4'
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
// ORM
compile group: 'org.postgresql', name: 'postgresql', version: '9.4-1200-jdbc41'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.10.Final'
compile group: 'org.hibernate', name: 'hibernate-spatial', version: '5.2.10.Final'
compile group: 'org.hibernate', name: 'hibernate-java8', version: '5.2.10.Final'
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.0.Final'
compile group: 'org.hibernate', name: 'hibernate-ehcache', version: '5.2.10.Final'
// Ehcache
compile group: 'org.ehcache', name: 'ehcache', version: '3.3.1'
// Testing
testCompile group: 'org.skyscreamer', name: 'jsonassert', version: '1.3.0'
testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
// Logging
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.3'
// Reflection
compile group: 'org.reflections', name: 'reflections', version: '0.9.10'
// osm4j
compile 'de.topobyte:osm4j-core:0.1.0'
compile 'de.topobyte:osm4j-utils:0.1.2'
compile 'de.topobyte:osm4j-xml:0.1.2'
compile 'de.topobyte:osm4j-pbf:0.1.1'
compile 'de.topobyte:osm4j-geometry:0.1.0'
// twitter4j
compile group: 'org.twitter4j', name: 'twitter4j-core', version: '4.0.6'
// Read OpenOffice .ods
compile group: 'org.apache.odftoolkit', name: 'simple-odf', version: '0.8.2-incubating'
}
configurations.all {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
task copyDeps(type: Copy) {
from configurations.runtime
into 'build/dependency-cache/'
}
def checkEnv() {
def configured = project.hasProperty('databaseURI') && project.hasProperty('databaseUsername') && project.hasProperty('databasePassword');
if (!configured) throw new GradleException('ENVIRONMENT NOT CONFIGURED. Check the main database info ' +
'in **gradle.properties**.\nSee the README: https://github.com/FutureCitiesCatapult/TomboloDigitalConnector')
}
task runCorrelation(dependsOn: ['classes'], type: JavaExec) {
main = 'uk.org.tombolo.CorrelationAnalysisRunner'
classpath = sourceSets.main.runtimeClasspath
jvmArgs '-disableassertions'
doFirst {
checkEnv()
systemProperty("databaseURI", databaseURI)
systemProperty("databaseUsername", databaseUsername)
systemProperty("databasePassword", databasePassword)
systemProperty("environment", "export")
def argumentsSet = project.hasProperty('recipe') && project.hasProperty('output') && project.hasProperty('correlationAnalysisOutput');
if (!argumentsSet) throw new GradleException('Required properties not specified. See the README.')
if (!project.hasProperty('clearDatabaseCache')) { ext.clearDatabaseCache = false }
if (!project.hasProperty('forceImports')) { ext.forceImports = "None" }
args(recipe, output, correlationAnalysisOutput, forceImports, clearDatabaseCache)
}
}
task exportCatalogue(dependsOn: ['classes'], type: JavaExec) {
maxHeapSize = "8192m"
main = 'uk.org.tombolo.CatalogueExportRunner'
classpath = sourceSets.main.runtimeClasspath
jvmArgs '-disableassertions'
doFirst {
checkEnv()
systemProperty("databaseURI", databaseURI)
systemProperty("databaseUsername", databaseUsername)
systemProperty("databasePassword", databasePassword)
systemProperty("environment", "export")
def argumentsSet = project.hasProperty('output')
if (!argumentsSet) throw new GradleException('Required properties not specified. See the README.')
args(output)
}
}
task info(dependsOn: ['classes'], type: JavaExec) {
maxHeapSize = "4096m"
main = 'uk.org.tombolo.ImporterInfoRunner'
classpath = sourceSets.main.runtimeClasspath
jvmArgs '-disableassertions'
doFirst {
checkEnv()
systemProperty("databaseURI", databaseURI)
systemProperty("databaseUsername", databaseUsername)
systemProperty("databasePassword", databasePassword)
systemProperty("environment", "export")
def importer = project.hasProperty('i')
if (!importer) ext.i = 'None'
ext.s = false
ext.a = false
ext.p = false
if (project.hasProperty('s')) { ext.s = true }
if (project.hasProperty('a')) { ext.a = true }
if (project.hasProperty('p')) { ext.p = true }
args(i, s, a, p)
}
}
test {
maxHeapSize = "2048m"
jvmArgs '-enableassertions', '-disableassertions:org.geotools...'
doFirst {
def configured = project.hasProperty('testDatabaseURI') && project.hasProperty('testDatabaseUsername') && project.hasProperty('testDatabasePassword')
if (!configured) throw new GradleException('TEST ENVIRONMENT NOT CONFIGURED. Check the test database info' +
'in **gradle.properties**.\nSee the README: https://github.com/FutureCitiesCatapult/TomboloDigitalConnector')
systemProperty("databaseURI", testDatabaseURI)
systemProperty("databaseUsername", testDatabaseUsername)
systemProperty("databasePassword", testDatabasePassword)
systemProperty("environment", "test")
}
}
task runExportHelp {
ext.info = """
Project version: ${version}
Gradle version: ${gradle.gradleVersion}
|||||||||| |||||||||
||| ||| ||| |||
||| ||| |||
||| ||| ||| TOMBOLO DIGITAL CONNECTOR
||| ||| |||
||| ||| ||| |||
|||||||||| |||||||||
USAGE: gradle runExport [-Ps] -Precipe -Poutput [-Pcorrelation] [-Pforce] [-Pclear]
------
DESCRIPTION:
------------
-Precipe -Precipe=path/to/recipe/file
Mandatory absolute path to the recipe file.
Recipe is a json file that describes the data or models that we want to get out of the system, without
describing how to generate the data. The recipe language is expressed in JSON format.
-Ps -Ps
Optional property indicating that the recipe contains a recipe string and not the path.
Used primaryly when the command is run from insid code not on the commandline.
-Poutput -Poutput=path/to/output/file
Mandatory absolute path to the output file with the model results.
-Pcorrelation -Pcorrelation=path/to/correlation/analisys/output/file
Optional absolute path to the output file with the correlation analysis' results.
Calculates correlation between all input fields and output the Pearson correlation coefficient,
the pValue and the standard error to a JSON file.
Note: only supports the use of GeoJson as the intermediate data export format.
-Pforce -Pforce=className:datasourceId,...
Optional list of classes to reimport.
It will re-download from the source and update the local file.
-Pclear -Pclear=true/false
Optional boolean triggering the database cache to be cleaned so the data will be persisted again.
Examples:
gradle runExport -Precipe='src/main/resources/executions/examples/greenspace-hertfordshire.json' -Poutput='output.json' -Pforce='uk.org.tombolo.importer.osm.OSMImporter' -Pclear=true
gradle runExport -Precipe='src/main/resources/executions/examples/london-cycle-traffic-air-quality-lsoa.json' -Poutput='output.json'
gradle runExport -Precipe='src/main/resources/executions/examples/london-cycle-traffic-air-quality-lsoa.json' -Poutput='output.json' -Pcorrelation='correlation_output.json'
"""
}
task runExport(dependsOn: ['classes', runExportHelp], type: JavaExec) {
main = 'uk.org.tombolo.DataExportRunner'
classpath = sourceSets.main.runtimeClasspath
jvmArgs '-disableassertions'
doFirst {
checkEnv()
systemProperty("databaseURI", databaseURI)
systemProperty("databaseUsername", databaseUsername)
systemProperty("databasePassword", databasePassword)
systemProperty("environment", "export")
def argumentsSet = project.hasProperty('recipe') && project.hasProperty('output');
if (!argumentsSet) {
print(runExportHelp.info)
throw new StopExecutionException()
}
if (!project.hasProperty('clear')) { ext.clear = false }
if (!project.hasProperty('force')) { ext.force = "None" }
if (!project.hasProperty('correlation')) { ext.correlation = "None" }
ext.s = false
if (project.hasProperty('s')) { ext.s = true }
args(s, recipe, output, correlation, force, clear)
}
}