This repository has been archived by the owner on Sep 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
829 lines (731 loc) · 25.5 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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
plugins {
id 'com.mgd.core.gradle.s3' version '1.1.4'
id 'io.mateo.cxf-codegen' version '1.2.1'
id 'java'
id 'application'
id 'idea'
}
idea{
module{
inheritOutputDirs = true
// excludeDirs += file('src/resources/app')
// excludeDirs += file('src/resources/assets/swagger-ui')
//resourceDirs += file('build/resources/main/app')
}
}
import com.mgd.core.gradle.*
import io.mateo.cxf.codegen.wsdl2java.Wsdl2Java
mainClassName = 'com.tramchester.App'
def candidate = System.getenv("CIRCLE_BUILD_NUM") ?: "0"
// override build number if RELEASE_NUMBER set, needed because of way circle ci workflows operate
def buildNumber = System.getenv("RELEASE_NUMBER") ?: candidate
def environment = System.getenv("ENV") ?: "Dev"
def isWindows = System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')
def s3prefix = 'dist/' + buildNumber
def prodConfig = 'config/local.yml'
def railCodeGenOutput = 'main/src/generated-live-rail-api/'
def railLiveDataWSDL = 'config/OpenLDBWS.wsdl'
s3 {
bucket = 'tramchester2dist'
}
// this is used in the generated dist zip filename
version = 1.0
ext {
dropwizardVersion = '4.0.1'
awsCdkVersion = '1.201.0'
jacksonVersion = '2.15.1'
awsSdkVersion = '2.20.69'
}
repositories {
maven {
url "https://repo.osgeo.org/repository/release/"
}
mavenCentral()
maven {
url "https://raw.github.com/neo4j-contrib/m2/master/releases"
}
}
// useful reminder ./gradlew -q dependencyInsight --dependency X.Y:Z
dependencies {
implementation('javax.measure:unit-api:2.1.3')
implementation("io.dropwizard:dropwizard-core:$dropwizardVersion")
// slf4j in governator was causing race condition with dropwizard start up code on initial get of logger
implementation('com.netflix.governator:governator:1.17.12') {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation 'com.google.inject:guice:5.1.0'
// note: exclude of org.glassfish.jersey.inject needed as it clashed with version in DropWizard causing a
// failure to load the DynamicServiceLocator in glassfish
implementation('org.neo4j:neo4j:5.10.0') {
exclude group:'org.slf4j', module:'slf4j-nop'
exclude group: 'org.glassfish.jersey.inject' // , module: 'jersey-hk2'}
exclude group: 'org.glassfish.jersey.containers', module: 'jersey-container-servlet'
exclude group: 'org.eclipse.jetty' }
implementation 'com.github.cliftonlabs:json-simple:4.0.1',
'commons-io:commons-io:2.11.0',
'org.apache.httpcomponents:httpclient:4.5.14',
'org.apache.commons:commons-collections4:4.4',
'com.github.ben-manes.caffeine:caffeine:3.1.5'
implementation "com.fasterxml.jackson.core:jackson-core:$jacksonVersion",
"com.fasterxml.jackson.core:jackson-databind:$jacksonVersion",
"com.fasterxml.jackson.module:jackson-module-afterburner:$jacksonVersion",
"com.fasterxml.jackson.module:jackson-module-blackbird:$jacksonVersion",
"com.fasterxml.jackson.dataformat:jackson-dataformat-csv:$jacksonVersion",
"com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion"
implementation('com.smoketurner:dropwizard-swagger:4.0.0-1') {
exclude group: 'org.glassfish.jersey.containers', module: 'jersey-container-servlet-core'
exclude group: 'org.glassfish.jersey.core', module: 'jersey-server'
exclude group: 'org.glassfish.jersey.core', module: 'jersey-common'
}
implementation 'org.reflections:reflections:0.10.2'
// aws sdk
implementation("software.amazon.awssdk:s3:$awsSdkVersion")
implementation("software.amazon.awssdk:cloudwatch:$awsSdkVersion")
implementation("software.amazon.awssdk:cloudformation:$awsSdkVersion")
// aws cdk
implementation "software.amazon.awscdk:core:$awsCdkVersion",
"software.amazon.awscdk:s3:$awsCdkVersion",
"software.amazon.awscdk:ec2:$awsCdkVersion",
"software.amazon.awscdk:elasticloadbalancingv2:$awsCdkVersion",
"software.amazon.awscdk:autoscaling:$awsCdkVersion",
"software.amazon.awscdk:cdk-cx-api:2.79.1"
implementation('org.geotools:gt-main:28.1')
implementation('org.geotools:gt-epsg-hsql:28.1')
implementation('org.roaringbitmap:RoaringBitmap:0.9.39')
testImplementation("io.dropwizard:dropwizard-testing:$dropwizardVersion")
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2',
'org.junit.platform:junit-platform-launcher:1.9.2',
'org.assertj:assertj-core:3.24.2',
'org.easymock:easymock:5.1.0',
'org.seleniumhq.selenium:selenium-java:3.141.59',
'org.hamcrest:hamcrest:2.2'
// https://ciscoo.github.io/cxf-codegen-gradle/docs/current/user-guide/#dependency-configuration
cxfCodegen 'jakarta.xml.ws:jakarta.xml.ws-api:2.3.3'
cxfCodegen 'jakarta.annotation:jakarta.annotation-api:1.3.5'
cxfCodegen 'ch.qos.logback:logback-classic:1.4.7'
// for compiling the cxf generated code
implementation 'com.sun.xml.ws:jaxws-rt:2.3.3'
// workaround for issues running tests in intellij and glassfish DI, does not occur with running via gradle
testRuntimeOnly 'javax.servlet:javax.servlet-api:3.0.1'
// NOTE: get resources files generated by webpack into path for intellij at test time, but this workaround is not working
//testRuntimeOnly files('build/resources/main/app') // build/resources/main/app => index.html (found)
//testRuntimeOnly fileTree(dir: 'build/resources/main/', include: '*.*')
}
sourceSets {
main {
java {
srcDirs = ['main/src']
}
resources {
srcDirs = ['main/src/resources']
}
}
test {
java {
srcDirs = ['main/test']
}
resources {
srcDirs = ['main/test/resources']
}
}
}
cxfCodegen {
cxfVersion = "3.6.1"
}
tasks.register("railLiveDataCodeGen", Wsdl2Java) {
toolOptions {
wsdl.set(file(railLiveDataWSDL))
outputDir.set(file(railCodeGenOutput))
markGenerated.set(true)
extendedSoapHeaders.set(true)
}
}
distZip {
dependsOn 'queryLiveDataArchiveStartScript'
}
processResources {
dependsOn 'webpack'
exclude('**/app/') // via webpack
//exclude('build/resources/app/**')
}
task npmInstall(type: Exec) {
inputs.file("package.json")
inputs.file("package-lock.json")
outputs.dir("node_modules")
if (isWindows) {
commandLine "npm.cmd", "install"
}
else {
commandLine "npm", "install"
}
}
//jar {
// // TODO
// dependsOn 'webpack'
// // use the output of webpack, not the source files from resources
// into 'app', {
// from 'build/resources/webpack'
// }
// exclude('app/*')
//}
task webpack(type: Exec, dependsOn: npmInstall) {
inputs.file("package.json")
inputs.file("package-lock.json")
inputs.file("webpack.config.js")
inputs.files(fileTree("main/src/resources/app"))
if (isWindows) {
commandLine "./node_modules/.bin/webpack.cmd"
} else {
commandLine "./node_modules/.bin/webpack"
}
}
distributions {
main {
contents {
into ('config') {
from 'config'
}
into ('bin') {
from 'deploy/start.sh'
from 'deploy/nessus_agent_install.sh'
}
}
}
}
// WIP removed, problem with runtime classpath for the apache tool that only happened with circleci build env
compileJava.dependsOn railLiveDataCodeGen
task cfnassist {
doLast {
ant.taskdef(name: 'cfnassist', classname: 'tw.com.ant.CfnAssistAntTask') {
classpath {
fileset(dir: 'lib/cfnassist-1.2.85/lib/', includes: '*.jar')
dirset(dir: 'lib/cfnassist-1.2.85/conf/')
}
}
}
}
tasks.withType(JavaCompile) {
options.deprecation = true
options.compilerArgs.addAll(['-Xlint'])
}
task stage(dependsOn: ['clean', 'installApp'])
task cleanGraph() {
doLast {
delete 'databases/integrationBusTest' ,
'databases/integrationTramTest',
'databases/integrationTrainTest',
'databases/integrationNeighboursTest',
'databases/neighboursTest',
'databases/integrationTramTrainGMTest',
'databases/tramchesterAcceptance.db',
'databases/all.db',
'tramchester.db', 'buses.db', 'trains.db', 'all.db', 'rail.db', 'gm_rail.db'
}
}
clean {
dependsOn cleanGraph
delete 'main/src/resources/app/dist/'
delete fileTree('data/tram') {
include '*.txt'
include '*.zip'
include '*.csv'
}
delete fileTree(railCodeGenOutput) {
include '**.*'
}
delete railCodeGenOutput
delete fileTree('data/bus') {
include '*.txt'
include '*.zip'
include '*.csv'
}
delete fileTree('data/rail') {
include '*.*'
}
delete fileTree('data/naptan') {
include '*.xml'
include '*.zip'
}
delete fileTree('data/nptg') {
include '*.csv'
include '*.zip'
}
delete fileTree('data/postcodes') {
include '**/*.csv'
}
delete('data/postcodes')
delete('testData/cache')
}
run {
// see deploy/setupTramWebServerAWSLinux.sh
maxHeapSize = '700m'
dependsOn 'webpack'
args 'server', prodConfig
}
test {
useJUnitPlatform()
}
task cdkApp(type:JavaExec, dependsOn:classes) {
mainClass = 'com.tramchester.deployment.CdkApp'
classpath = sourceSets.main.runtimeClasspath
}
task buses(type:JavaExec, dependsOn: 'webpack') {
mainClass = mainClassName
classpath = sourceSets.main.runtimeClasspath
maxHeapSize = "3g"
args 'server', 'config/buses.yml'
}
task frequency(type:JavaExec, dependsOn: 'webpack') {
mainClass = mainClassName
classpath = sourceSets.main.runtimeClasspath
maxHeapSize = "3g"
args 'server', 'config/frequency.yml'
}
task rail(type:JavaExec, dependsOn: 'webpack') {
mainClass = mainClassName
classpath = sourceSets.main.runtimeClasspath
maxHeapSize = "3g"
args 'server', 'config/rail.yml'
}
task gm(type:JavaExec, dependsOn: 'webpack') {
mainClass = mainClassName
classpath = sourceSets.main.runtimeClasspath
maxHeapSize = "2g"
args 'server', 'config/gm.yml'
}
task gmProfile(type:JavaExec, dependsOn: 'webpack') {
mainClass = mainClassName
classpath = sourceSets.main.runtimeClasspath
maxHeapSize = "1g"
jvmArgs '-agentpath:/home/ianc/dev/tools/visualvm_213/visualvm/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so=/home/ianc/dev/tools/visualvm_213/visualvm/lib,5140'
args 'server', 'config/gm.yml'
}
task all(type:JavaExec, dependsOn: 'webpack') {
mainClass = mainClassName
classpath = sourceSets.main.runtimeClasspath
maxHeapSize = "3g"
args 'server', 'config/all.yml'
}
task busTest(type: Test) {
useJUnitPlatform {
includeTags 'BusTest'
}
}
task unit(type: Test, dependsOn: compileJava) {
useJUnitPlatform()
filter {
includeTestsMatching "com.tramchester.unit.*"
}
testLogging {
exceptionFormat "full" // default is "short"
}
}
task liveMessages(type: Test, dependsOn: compileJava) {
useJUnitPlatform {
includeTags "liveDataMessages"
}
filter {
includeTestsMatching "com.tramchester.integration.*"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError"
}
}
task integration(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "1750m"
useJUnitPlatform {
// excludeTags "liveDataMessages" // these go away periodically...
//excludeTags "liveData" // also goes away on occasion
//excludeTags "dataExpiry" // can be useful to exclude when big changes to timetable are upcoming
//excludeTags 'liveDataDueTrams' // tfgm api has know issue
excludeTags "postcode" // not needed for tram, but used by buses
excludeTags "BusTest"
excludeTags "TrainTest"
excludeTags "GMTest"
excludeTags "EcclesToWeasteClosure2023Test"
}
filter {
includeTestsMatching "com.tramchester.integration.*"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" //, "standardOut"
}
}
task integrationGM(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "1750m"
useJUnitPlatform {
includeTags "GMTest"
includeTags "dataExpiry"
}
filter {
includeTestsMatching "com.tramchester.integration.*"
}
systemProperty("com.tramchester.config","RailAndTramGreaterManchesterConfig")
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" //, "standardOut"
}
}
task dualTestIntegration(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "1750m"
useJUnitPlatform {
includeTags "DualTest"
}
filter {
includeTestsMatching "com.tramchester.integration.*"
}
systemProperty("com.tramchester.config","RailAndTramGreaterManchesterConfig")
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" //, "standardOut"
}
}
task integrationProfile(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "1750m"
//jvmArgs '-agentpath:/home/ianc/dev/tools/visualvm_213/visualvm/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so=/home/ianc/dev/tools/visualvm_213/visualvm/lib,5140'
jvmArgs '-agentpath:/Users/icartwri/dev/tools/visualvm_213/visualvm/lib/deployed/jdk16/mac/libprofilerinterface.jnilib=/Users/icartwri/dev/tools/visualvm_213/visualvm/lib,5140'
useJUnitPlatform {
excludeTags "postcode" // not needed for tram, but used by buses
excludeTags "BusTest"
excludeTags "TrainTest"
excludeTags "GMTest"
}
filter {
includeTestsMatching "com.tramchester.integration.*"
}
}
task dataUpdated(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "1750m"
useJUnitPlatform {
includeTags "DataUpdateTest"
excludeTags "EcclesToWeasteClosure2023Test"
}
filter {
includeTestsMatching "com.tramchester.integration.*"
}
testLogging {
exceptionFormat "full"
events "failed"
}
}
task s3Test(type: Test, dependsOn: compileJava) {
useJUnitPlatform {
includeTags "S3Test"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" //, "standardOut"
}
}
task integrationBus(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "3000m"
useJUnitPlatform {
includeTags "BusTest"
includeTags "postcode"
}
filter {
includeTestsMatching "com.tramchester.integration.*"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" //, "standardOut"
}
}
task integrationRail(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "8000m"
useJUnitPlatform {
includeTags "TrainTest"
}
filter {
includeTestsMatching "com.tramchester.integration.*"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" //, "standardOut"
}
}
task integrationRailProfile(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "3000m"
useJUnitPlatform {
includeTags "TrainTest"
}
jvmArgs '-agentpath:/home/ianc/dev/tools/visualvm_213/visualvm/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so=/home/ianc/dev/tools/visualvm_213/visualvm/lib,5140'
filter {
includeTestsMatching "com.tramchester.integration.*"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" //, "standardOut"
}
}
task apiTests(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "1750m"
useJUnitPlatform {
// excludeTags "liveDataMessages" // these go away periodically...
//excludeTags "liveData" // also goes away on occasion
//excludeTags "dataExpiry" // can be useful to exclude when big changes to timetable are upcoming
excludeTags "postcode" // not needed for tram, but used by buses
excludeTags "BusTest"
excludeTags "TrainTest"
excludeTags "GMTest"
}
filter {
includeTestsMatching "com.tramchester.integration.resources.*"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" //, "standardOut"
}
}
task graphTests(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "1750m"
useJUnitPlatform()
filter {
includeTestsMatching "com.tramchester.integration.graph.*"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" //, "standardOut"
}
}
// allow re-run of the task to aid in performance tuning
allprojects {
tasks.matching { task -> task.name == "allStationsTest" }.all {
outputs.upToDateWhen { false }
}
}
task allStationsTest(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "1750m"
useJUnitPlatform()
filter {
includeTestsMatching "com.tramchester.integration.graph.RouteCalculatorTestAllJourneys"
}
testLogging {
exceptionFormat "full" // default is "short"
events("passed", "skipped", "failed")
}
}
task buildGraphTest(type: Test, dependsOn: compileJava) {
minHeapSize = "1000m"
maxHeapSize = "1750m"
useJUnitPlatform()
filter {
includeTestsMatching "com.tramchester.integration.graph.GraphBuildAndStartTest"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started" //, "standardError", "standardOut"
}
}
task acceptance(type: Test) {
dependsOn 'allowhost'
dependsOn 'compileJava'
dependsOn 'webpack'
useJUnitPlatform()
filter {
includeTestsMatching "com.tramchester.acceptance.*"
}
testLogging {
exceptionFormat "full" // default is "short"
events "passed", "skipped", "failed", "started", "standardError" , "standardOut"
}
finalizedBy {
blockhost
}
}
// fast feedback on whether acceptance tests run etc
task smokeTest(type: Test, dependsOn: ['webpack', 'compileJava']) {
minHeapSize = "1000m"
maxHeapSize = "2500m"
useJUnitPlatform()
useJUnitPlatform {
includeTags "SmokeTest"
}
filter {
includeTestsMatching "com.tramchester.acceptance.*"
}
testLogging {
events "passed", "skipped", "failed", "started", "standardError" , "standardOut"
}
}
task localAcceptance(type: Test, dependsOn: ['webpack', 'compileJava']) {
minHeapSize = "1000m"
maxHeapSize = "2500m"
useJUnitPlatform()
filter {
includeTestsMatching "com.tramchester.acceptance.*"
}
testLogging {
events "passed", "skipped", "failed", "started", "standardError" , "standardOut"
}
}
task localAcceptanceGeo(type: Test, dependsOn: ['webpack', 'compileJava']) {
minHeapSize = "1000m"
maxHeapSize = "2500m"
useJUnitPlatform()
filter {
includeTestsMatching "com.tramchester.acceptance.geolocation.*"
}
testLogging {
events "passed", "skipped", "failed", "started", "standardError" , "standardOut"
}
}
task diagrams(dependsOn: cfnassist) {
doLast {
ant.cfnassist() {
Diagrams(target: '.')
}
}
}
// gm here so include both sets of data
task pullData(type:JavaExec, dependsOn:classes) {
mainClass = 'com.tramchester.deployment.cli.FetchDataCLI'
classpath = sourceSets.main.runtimeClasspath
args 'config/gm.yml'
}
// gm here so include both sets of data
task queryDueTramStatus(type:JavaExec, dependsOn:classes) {
mainClass = 'com.tramchester.deployment.cli.QueryLiveDataArchiveCLI'
classpath = sourceSets.main.runtimeClasspath
args '2023-01-30', '3', '15', 'config/gm.yml', 'dueTramStatus.txt'
}
// temp additional target while deploying train/tram version to just UAT
task buildDatabaseUAT(type:JavaExec, dependsOn: [classes]) {
mainClass = 'com.tramchester.deployment.cli.BuildGraphCLI'
classpath = sourceSets.main.runtimeClasspath
maxHeapSize = "2g"
args 'config/gm.yml', 'build/distributions/database'
}
task buildDatabase(type:JavaExec, dependsOn: [classes, buildDatabaseUAT]) {
mainClass = 'com.tramchester.deployment.cli.BuildGraphCLI'
classpath = sourceSets.main.runtimeClasspath
args prodConfig, 'build/distributions/database'
}
task upload(dependsOn: ['uploadDataSources', 'uploadApp'])
// gm here so include both sets of data
task uploadDataSources(type:JavaExec, dependsOn: ['pullData','classes']) {
mainClass = 'com.tramchester.deployment.cli.UploadSourceDataCLI'
classpath = sourceSets.main.runtimeClasspath
args 'config/gm.yml', s3prefix
}
task zipDB(type:Zip, dependsOn: 'buildDatabase') {
from 'build/distributions/database'
include '*.db/**'
archiveFileName = 'database.zip'
}
task queryLiveDataArchiveStartScript(type: CreateStartScripts, dependsOn: compileJava) {
classpath = startScripts.classpath
outputDir = startScripts.outputDir
mainClass = 'com.tramchester.deployment.cli.QueryLiveDataArchiveCLI'
applicationName = 'queryLiveData'
}
task copyIntoUploadDir(type: Copy, dependsOn: [zipDB, distZip]) {
from 'build/distributions/database.zip'
from 'build/distributions/tramchester-1.0.zip'
from 'deploy/setupTramWebServerAWSLinux.sh'
from 'deploy/cloudInitAWSLinux.txt'
into 'build/distributions/uploadDir'
}
task uploadApp(type: S3Upload, dependsOn:copyIntoUploadDir) {
keyPrefix = s3prefix
sourceDir = 'build/distributions/uploadDir'
}
// >>>>> https://data.atoc.org/member-area
task uploadRailToS3(type: S3Upload) {
key = 'railData/ttis697.zip'
file = 'data/rail/ttis697.zip'
overwrite = false
}
task infra(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: environment, sns: 'true', capabilityIAM: 'true') {
Templates(target: 'deploy/infra/'+environment )
}
}
}
task deploy(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: environment, buildNumber: buildNumber, sns: 'true') {
Templates(target: 'deploy/servers.json')
}
}
}
task undeploy(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: environment, buildNumber: buildNumber, sns: 'true') {
Delete(target: 'deploy/servers.json')
}
}
}
task deployCDK(type: Exec, dependsOn: [npmInstall, classes]) {
commandLine "./node_modules/.bin/cdk", "deploy"
}
task updateLB(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: environment, buildNumber: buildNumber, sns: 'true') {
ELBUpdate(typeTag: 'web')
}
}
}
task tidy(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: environment) {
TidyStacks(target: 'deploy/servers.json', typeTag: 'web')
}
}
}
task allowHostDev(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: 'Dev') {
WhiteList(port: '443', tag: 'web')
}
}
}
task blockHostDev(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: 'Dev') {
BlackList(port: '443', tag: 'web')
}
}
}
task allowHostUAT(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: 'UAT') {
WhiteList(port: '443', tag: 'web')
}
}
}
task denyHostUAT(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: 'UAT') {
BlackList(port: '443', tag: 'web')
}
}
}
task allowhost(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: environment) {
WhiteList(port: '443', tag: 'web')
}
}
}
task blockhost(dependsOn: cfnassist) {
doLast {
ant.cfnassist(project: 'tramchesterB', env: environment) {
BlackList(port: '443', tag: 'web')
}
}
}