-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
365 lines (319 loc) · 11.3 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
356
357
358
359
360
361
362
363
364
365
plugins {
id "edu.sc.seis.version-class" version "1.1.1"
id 'maven-publish'
}
apply plugin: 'eclipse'
apply plugin: 'project-report'
group = 'edu.sc.seis'
version = '3.2.11-SNAPSHOT8'
// also remember to change in sod.Version class and
// site/velocity/VM_library.vm
// site/velocity/previousReleases.vm
apply plugin:'application'
mainClassName = "edu.sc.seis.sod.Start"
sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
withSourcesJar()
withJavadocJar()
}
publishing {
publications {
myLibrary(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
}
}
repositories {
maven {
name = 'myRepo'
url = "file://${buildDir}/repo"
}
}
}
repositories {
mavenLocal()
maven { url "https://www.seis.sc.edu/software/maven2" }
mavenCentral()
maven { url "https://spring-rich-c.sourceforge.net/maven2repository" }
maven { url "https://oss.sonatype.org/content/groups/public" }
maven { url "https://repository.jboss.org/nexus/content/repositories/public" }
}
sourceSets {
relax {
resources {
srcDir new File(project.buildDir, 'generated-src/relax/resources')
}
}
makedocs {
compileClasspath += sourceSets.main.output
}
}
configurations {
makedocsImplementation.extendsFrom implementation
}
dependencies {
implementation 'edu.sc.seis:bag:0.4.3-SNAPSHOT3'
implementation "edu.sc.seis:fissuresUtil:1.1.15-SNAPSHOT"
implementation "com.fasterxml.woodstox:woodstox-core:5.2.1"
implementation "com.martiansoftware:jsap:2.1"
implementation 'org.python:jython-standalone:2.7.2'
// compile project(':cormorant')
implementation "jline:jline:0.9.94"
implementation "thaiopensource:jing:20091111"
implementation "rngconvUSC:rngconv:20030225"
implementation "de.erichseifert.gral:VectorGraphics2D:0.9"
implementation "de.erichseifert.gral:gral-core:0.9"
implementation "org.slf4j:slf4j-api:1.7.30"
implementation group: "org.slf4j", name: "slf4j-log4j12", version: "1.7.30"
implementation ("org.apache.velocity:velocity-tools:2.0") {
exclude group: 'xml-apis', module: 'xml-apis'
exclude group: 'org.apache.struts', module: 'struts-taglib'
exclude group: 'org.apache.struts', module: 'struts-tiles'
exclude group: 'org.apache.struts', module: 'struts-core'
exclude group: 'javax.servlet', module: 'servlet-api'
}
implementation "edu.sc.seis.mapData:dcwpo_browse:1.0"
implementation "net.sourceforge.javacsv:javacsv:2.0"
implementation "org.codehaus.groovy:groovy-all:2.2.2"
// runtime "org.jruby:jruby:1.7.3
testImplementation group: 'junit', name: 'junit', version: '4.11'
makedocsImplementation "org.apache.velocity:velocity:1.6.4"
}
def sodVelocity = copySpec {
from project.file('site/velocity')
from new File(project.buildDir, 'generated-src/velocity/sod')
}
task copySodVelocity(type: Sync, dependsOn: 'buildSchemaDocs') {
group = 'dist'
with sodVelocity
def outDir = project.file('build/velocity/sod/')
into outDir
doFirst {
println outDir.mkdirs()
}
}
task makeSodSite(type: JavaExec, dependsOn: [ copySodVelocity, classes, compileMakedocsJava ] ) {
jvmArgs ['-Xmx512m']
group = 'dist'
args '--run-once', '-p', 'site/makeSodSite.prop'
classpath = sourceSets.makedocs.runtimeClasspath
setMain "edu.sc.seis.seiswww.MakeSite"
}
//configurations.all {
// resolutionStrategy.dependencySubstitution {
// substitute module("edu.sc.seis:bag") with project(":bag")
// }
//}
def dirName = project.name+'-'+version
def binDistFiles = copySpec {
from(configurations.default) {
into('lib')
}
from(configurations.default.allArtifacts.files) {
into('lib')
}
from('build/scripts') {
fileMode=0755
include('bin/**')
include('bat/**')
}
from('scripts') {
include('cwg.prop')
}
from('.') {
include('etc/**')
}
}
def distFiles = copySpec {
with(binDistFiles)
from('.') {
include('gpl-3.0.txt')
include('defaultProps')
include('externalExample/**')
include('src/**')
include('lib/**')
exclude('**/*.svn')
}
from('scripts') {
include('tutorial/**')
include('CMTReadySeismograms.xml')
include('ammonChannels.xml')
include('breqfast.xml')
include('dmcWebService.xml')
include('preferBroadband.xml')
include('realtime.xml')
include('sAndSKSInTanzania.xml')
include('southAmericanSacFiles.xml')
include('recfunc_ears.xml')
include('variableDataWindow.xml')
include('vector.xml')
include('weed.xml')
include('winston.xml')
into 'recipes'
}
from('build') {
include('doc/**')
}
from('build/docs') {
include('javadoc/**')
into 'doc/documentation'
}
}
task tarBin(type: Tar, dependsOn: ['explodeBin']) {
group = 'dist'
compression = Compression.GZIP
into(dirName) {
with binDistFiles
}
}
task zipDist(type: Zip, dependsOn: ['explodeDist']) {
group = 'dist'
into(dirName) {
with distFiles
}
}
task tarDist(type: Tar, dependsOn: ['explodeDist']) {
group = 'dist'
compression = Compression.GZIP
into(dirName) {
with distFiles
}
}
task explodeBin(type: Sync, dependsOn: ['makeScript', 'buildSchema', 'buildGrouperSchema']) {
group = 'dist'
with binDistFiles
into file("$buildDir/explode")
}
explodeBin.doLast { ant.chmod(dir: "$buildDir/explode/bin", perm: "755", includes: "*") }
task explodeDist(type: Sync, dependsOn: ['explodeBin', 'doc']) {
group = 'dist'
with distFiles
into file("$buildDir/explode")
}
def getDExtras() {
return [ 'seis.name':'sod'+getVersion(),
'org.omg.CORBA.ORBSingletonClass':'org.jacorb.orb.ORBSingleton',
'python.path':'${LIB}',
'java.awt.headless':'true',
'org.omg.CORBA.ORBClass':'org.jacorb.orb.ORB',
'swing.volatileImageBufferEnabled':'false',
'jacorb.connection.client.pending_reply_timeout':'20000',
'jacorb.connection.client.idle_timeout':'90000',
'jacorb.home':'${SOD_HOME}' ,
'jacorb.log.default.verbosity':'2' ]
}
task makeScript() {
doLast {
group = 'build'
def dExtras = getDExtras()
def doBat = true
ScriptBuilder.create('psod', 'edu.sc.seis.sod.Start', project, dExtras:dExtras, yourkit:true)
ScriptBuilder.create('sod', 'edu.sc.seis.sod.Start', project, dExtras:dExtras, bat:true)
ScriptBuilder.create('bgsod', 'edu.sc.seis.sod.Start', project, dExtras:dExtras, bat:doBat, background:true)
ScriptBuilder.create('find_events', 'edu.sc.seis.sod.tools.find_events', project, dExtras:dExtras, bat:doBat)
ScriptBuilder.create('find_stations', 'edu.sc.seis.sod.tools.find_stations', project, dExtras:dExtras, bat:doBat)
ScriptBuilder.create('find_channels', 'edu.sc.seis.sod.tools.find_channels', project, dExtras:dExtras, bat:doBat)
ScriptBuilder.create('find_seismograms', 'edu.sc.seis.sod.tools.find_seismograms', project, dExtras:dExtras, bat:doBat)
ScriptBuilder.create('find_responses', 'edu.sc.seis.sod.tools.find_responses', project, dExtras:dExtras, bat:doBat)
}
}
task copySodSite(dependsOn: ['buildSchemaDocs', 'makeSodSite'], type: Sync) {
group = 'dist'
from project.file('build/sodSite/')
into project.file('build/doc/')
}
task staticSchemaDocs(type: Copy) {
group = 'dist'
def outDir = project.file('build/velocity/sod/ingredients/')
from project.file('site/schemaDocs/docs')
into outDir
doFirst {
outDir.mkdirs()
}
}
task buildSchemaDocs(type: JavaExec, dependsOn: ['staticSchemaDocs', 'buildSchema', 'compileJava']) {
def inRNGFile = new File(project.buildDir.path, 'generated-src/relaxInclude/sod.rng')
// inRNGFile = new File(project.buildDir, 'generated-src/relax/resources/edu/sc/seis/sod/data/sod.rng')
// jvmArgs = ['-agentlib:yjpagent', '-XX:+HeapDumpOnOutOfMemoryError', '-Xmx512m']
jvmArgs ['-Xmx512m']
group = 'dist'
// inputs.files 'site/elementPage.vm', inRNGFile.getParentFile()
inputs.dir inRNGFile.getParentFile()
// outDir = project.file('build/velocity/sod/ingredients')
def outDir = new File(project.buildDir, 'generated-src/velocity/sod/ingredients')
outputs.dir outDir
workingDir = outDir
args inRNGFile, project.projectDir.path, outDir
classpath configurations.runtimeClasspath
classpath project.file("build/classes/java/main")
setMain "edu.sc.seis.sod.validator.documenter.SchemaDocumenter"
doFirst {
if (!outDir.exists() ) {
outDir.mkdirs()
}
}
}
task buildSchema(dependsOn: ['transform', 'compileJava']) {
group = 'build'
def inFile = new File(project.buildDir.path, 'generated-src/relaxInclude/sod.rng')
inputs.dir inFile.getParentFile()
ext.resourcesDir = new File(project.buildDir, 'generated-src/relax/resources')
def outFile = new File(resourcesDir, 'edu/sc/seis/sod/data/sod.rng')
outputs.files outFile
doLast{
outFile.getParentFile().mkdirs()
def relaxArgs = '-s '+inFile
ant.java(dir:outFile.getParentFile(),
classname:'com.thaiopensource.relaxng.util.Driver',
args:relaxArgs,
maxmemory:'1512m',
fork:true,
classpath:configurations.runtimeClasspath.asPath,
output:outFile)
}
}
task buildGrouperSchema(dependsOn: ['transformGrouper', 'compileJava']) {
group = 'build'
def inFile = new File(project.buildDir.path, 'generated-src/relaxInclude/grouper.rng')
inputs.dir inFile.getParentFile()
ext.resourcesDir = new File(project.buildDir, 'generated-src/relax/resources')
def outFile = new File(resourcesDir, 'edu/sc/seis/sod/data/grouper.rng')
outputs.files outFile
doLast{
outFile.getParentFile().mkdirs()
def relaxArgs = '-s '+inFile
ant.java(dir:outFile.getParentFile(),
classname:'com.thaiopensource.relaxng.util.Driver',
args:relaxArgs,
maxmemory:'1512m',
fork:true,
classpath:configurations.runtimeClasspath.asPath,
output:outFile)
}
}
task transform(type: XSLT) {
destDir=new File(project.buildDir, 'generated-src/relaxInclude')
stylesheetFile = new File(project.projectDir, 'src/main/xslt/simpleXInclude.xslt')
def rngFile = new File(project.projectDir, 'src/main/relax/sod.rng')
source rngFile
inputs.dir rngFile.getParentFile()
outputs.dir destDir
}
task transformGrouper(type: XSLT) {
destDir=new File(project.buildDir, 'generated-src/relaxInclude')
stylesheetFile = new File(project.projectDir, 'src/main/xslt/simpleXInclude.xslt')
def rngFile = new File(project.projectDir, 'src/main/relax/grouper.rng')
source rngFile
inputs.dir rngFile.getParentFile()
outputs.dir destDir
}
task doc(dependsOn: 'javadoc') {}
doc.dependsOn(copySodSite)
assemble.dependsOn(tarDist)
assemble.dependsOn(zipDist)
processResources.dependsOn(buildSchema)
processResources.dependsOn(buildGrouperSchema)
processResources{ from(project.sourceSets.main.resources)
from(buildSchema.resourcesDir)}