forked from haveno-dex/haveno
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
946 lines (857 loc) · 41.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
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.internal.logging.ConsoleRenderer
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17'
classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.3'
classpath 'com.github.johnrengelman:shadow:8.1.1'
classpath 'org.springframework.boot:spring-boot-gradle-plugin:3.2.3'
classpath 'com.gradle:gradle-enterprise-gradle-plugin:3.16.1' // added for windows build verification-metadata.xml error
}
}
configure(rootProject) {
// remove the 'haveno-*' scripts and 'lib' dir generated by the 'installDist' task
task clean {
doLast {
delete fileTree(dir: rootProject.projectDir, include: 'haveno-*'), 'lib'
}
}
}
configure(subprojects) {
apply plugin: 'java'
apply plugin: 'com.google.osdetector'
// Apply the jacoco plugin to add support for test coverage
apply plugin: 'jacoco'
apply plugin: 'jacoco-report-aggregation'
apply plugin: 'checkstyle'
sourceCompatibility = JavaVersion.VERSION_21
ext { // in alphabetical order
bcVersion = '1.63'
bitcoinjVersion = '2a80db4'
codecVersion = '1.13'
cowwocVersion = '1.2'
easybindVersion = '1.0.3'
easyVersion = '4.0.1'
findbugsVersion = '3.0.2'
firebaseVersion = '6.2.0'
fontawesomefxVersion = '8.0.0'
fontawesomefxCommonsVersion = '9.1.2'
fontawesomefxMaterialdesignfontVersion = '2.0.26-9.1.2'
grpcVersion = '1.42.1'
gsonVersion = '2.8.5'
guavaVersion = '32.1.1-jre'
guiceVersion = '7.0.0'
moneroJavaVersion = '0.8.26'
httpclient5Version = '5.0'
hamcrestVersion = '2.2'
httpclientVersion = '4.5.12'
httpcoreVersion = '4.4.13'
ioVersion = '2.6'
jacksonVersion = '2.12.1'
javafxVersion = '21.0.2'
javaxAnnotationVersion = '1.2'
jcsvVersion = '1.4.0'
jetbrainsAnnotationsVersion = '13.0'
jfoenixVersion = '9.0.10'
joptVersion = '5.0.4'
jsonsimpleVersion = '1.1.1'
jsonrpc4jVersion = '1.6.0.bisq.1'
jupiterVersion = '5.9.2'
kotlinVersion = '1.3.41'
langVersion = '3.11'
logbackVersion = '1.1.11'
loggingVersion = '1.2'
lombokVersion = '1.18.30'
mockitoVersion = '5.10.0'
netlayerVersion = '33485b9e57' // Netlayer version "0.7.7" with Tor browser version 13.0.6 and tor binary version: 0.4.8.9
protobufVersion = '3.19.1'
protocVersion = protobufVersion
pushyVersion = '0.13.2'
qrgenVersion = '1.3'
slf4jVersion = '1.7.30'
sparkVersion = '2.5.2'
os = osdetector.os == 'osx' ? 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os
}
repositories {
mavenCentral()
//mavenLocal()
maven { url 'https://jitpack.io' }
maven { url 'https://mvnrepository.com' }
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
checkstyle {
toolVersion = '10.8.1'
// https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-10.8.1/src/main/resources/google_checks.xml
configFile = rootProject.file("$rootDir/config/checkstyle/checkstyle.xml")
}
tasks.withType(Checkstyle) {
minHeapSize.set('200m')
maxHeapSize.set('1g')
}
jacoco {
toolVersion = "0.8.10"
reportsDirectory = file("$rootDir/build/reports/jacoco")
}
test.finalizedBy {
testCodeCoverageReport {
// tests are required to run before generating the report
reports {
xml.required.set(true)
html.required.set(false)
}
}
}
test {
useJUnitPlatform()
}
}
configure([project(':cli'),
project(':daemon'),
project(':desktop'),
project(':monitor'),
project(':relay'),
project(':seednode'),
project(':statsnode'),
project(':inventory'),
project(':apitest')]) {
apply plugin: 'application'
build.dependsOn installDist
installDist.destinationDir = file('build/app')
distZip.enabled = false
// the 'installDist' and 'startScripts' blocks below configure haveno executables to put
// generated shell scripts in the root project directory, such that users can easily
// discover and invoke e.g. ./haveno-desktop, ./haveno-seednode, etc.
// See https://stackoverflow.com/q/46327736 for details.
installDist {
doLast {
// copy generated shell scripts, e.g. `haveno-desktop` directly to the project
// root directory for discoverability and ease of use
copy {
from "$destinationDir/bin"
into rootProject.projectDir
}
// copy libs required for generated shell script classpaths to 'lib' dir under
// the project root directory
copy {
from "$destinationDir/lib"
into "${rootProject.projectDir}/lib"
}
// edit generated shell scripts such that they expect to be executed in the
// project root dir as opposed to a 'bin' subdirectory
def windowsScriptFile = file("${rootProject.projectDir}/haveno-${applicationName}.bat")
windowsScriptFile.text = windowsScriptFile.text.replace(
'set APP_HOME=%DIRNAME%..', 'set APP_HOME=%DIRNAME%')
def unixScriptFile = file("${rootProject.projectDir}/haveno-$applicationName")
unixScriptFile.text = unixScriptFile.text.replace(
'APP_HOME=$( cd "${APP_HOME:-./}.." > /dev/null && pwd -P ) || exit', 'APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit')
if (applicationName == 'desktop') {
windowsScriptFile.text = windowsScriptFile.text.replace(
'DEFAULT_JVM_OPTS=', 'DEFAULT_JVM_OPTS=-XX:MaxRAM=4g ' +
'--add-opens=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED ' +
'--add-opens=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED ' +
'--add-opens=java.base/java.lang.reflect=ALL-UNNAMED ' +
'--add-opens=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED')
unixScriptFile.text = unixScriptFile.text.replace(
'DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="-XX:MaxRAM=4g ' +
'--add-opens=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED ' +
'--add-opens=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED ' +
'--add-opens=java.base/java.lang.reflect=ALL-UNNAMED ' +
'--add-opens=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED"')
}
if (applicationName == 'apitest') {
// Pass the logback config file as a system property to avoid chatty
// logback startup due to multiple logback.xml files in the classpath
// (:daemon & :cli).
def script = file("${rootProject.projectDir}/haveno-$applicationName")
script.text = script.text.replace(
'DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="' +
'-Dlogback.configurationFile=apitest/build/resources/main/logback.xml"')
}
if (osdetector.os != 'windows')
delete fileTree(dir: rootProject.projectDir, include: 'haveno-*.bat')
else
delete fileTree(dir: rootProject.projectDir, include: 'haveno-*', exclude: '*.bat')
}
}
startScripts {
// rename scripts from, e.g. `desktop` to `haveno-desktop`
applicationName = "haveno-$applicationName"
}
}
configure(project(':proto')) {
apply plugin: 'com.google.protobuf'
dependencies {
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "javax.annotation:javax.annotation-api:$javaxAnnotationVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("io.grpc:grpc-protobuf:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
implementation("io.grpc:grpc-stub:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
}
sourceSets.main.java.srcDirs += [
'build/generated/source/proto/main/grpc',
'build/generated/source/proto/main/java'
]
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protocVersion}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all()*.plugins { grpc {} }
}
}
}
configure(project(':assets')) {
dependencies {
implementation("com.github.bisq-network:bitcoinj:$bitcoinjVersion") {
exclude(module: 'bcprov-jdk15on')
exclude(module: 'guava')
exclude(module: 'jsr305')
exclude(module: 'okhttp')
exclude(module: 'okio')
exclude(module: 'protobuf-java')
exclude(module: 'slf4j-api')
}
implementation "com.google.guava:guava:$guavaVersion"
implementation "org.apache.commons:commons-lang3:$langVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
}
}
configure(project(':common')) {
dependencies {
implementation project(':proto')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "javax.annotation:javax.annotation-api:$javaxAnnotationVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation("com.github.bisq-network:bitcoinj:$bitcoinjVersion") {
exclude(module: 'jsr305')
exclude(module: 'slf4j-api')
exclude(module: 'guava')
exclude(module: 'protobuf-java')
exclude(module: 'bcprov-jdk15on')
exclude(module: 'okhttp')
exclude(module: 'okio')
}
implementation "com.google.code.findbugs:jsr305:$findbugsVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation("com.google.inject:guice:$guiceVersion") {
exclude(module: 'guava')
}
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "commons-io:commons-io:$ioVersion"
implementation "net.sf.jopt-simple:jopt-simple:$joptVersion"
implementation "org.apache.commons:commons-lang3:$langVersion"
implementation "org.bouncycastle:bcpg-jdk15on:$bcVersion"
implementation "org.jetbrains:annotations:$jetbrainsAnnotationsVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
runtimeOnly("io.grpc:grpc-netty-shaded:$grpcVersion") {
exclude(module: 'guava')
exclude(module: 'animal-sniffer-annotations')
}
// override transitive dependency version from 1.5 to the same version just identified by commit number.
// Remove this if transitive dependency is changed to something else than 1.5
implementation(group: 'com.github.JesusMcCloud', name: 'jtorctl') { version { strictly "[9b5ba2036b]" } }
implementation "org.openjfx:javafx-base:$javafxVersion:$os"
implementation "org.openjfx:javafx-graphics:$javafxVersion:$os"
}
}
configure(project(':p2p')) {
dependencies {
implementation project(':proto')
implementation project(':common')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "org.fxmisc.easybind:easybind:$easybindVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("com.github.haveno-dex.netlayer:tor.external:$netlayerVersion") {
exclude(module: 'slf4j-api')
}
implementation("com.github.haveno-dex.netlayer:tor.native:$netlayerVersion") {
exclude(module: 'slf4j-api')
}
implementation("com.github.bisq-network:bitcoinj:$bitcoinjVersion") {
exclude(module: 'bcprov-jdk15on')
exclude(module: 'guava')
exclude(module: 'jsr305')
exclude(module: 'okhttp')
exclude(module: 'okio')
exclude(module: 'protobuf-java')
exclude(module: 'slf4j-api')
}
implementation("com.google.inject:guice:$guiceVersion") {
exclude(module: 'guava')
}
implementation("org.apache.httpcomponents:httpclient:$httpclientVersion") {
exclude(module: 'commons-codec')
}
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$jupiterVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
testImplementation "ch.qos.logback:logback-classic:$logbackVersion"
testImplementation "ch.qos.logback:logback-core:$logbackVersion"
testImplementation "org.apache.commons:commons-lang3:$langVersion"
testImplementation("org.mockito:mockito-core:$mockitoVersion")
implementation "org.openjfx:javafx-base:$javafxVersion:$os"
implementation "org.openjfx:javafx-graphics:$javafxVersion:$os"
}
}
configure(project(':core')) {
dependencies {
implementation project(':proto')
implementation project(':assets')
implementation project(':common')
implementation project(':p2p')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "javax.annotation:javax.annotation-api:$javaxAnnotationVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "com.fasterxml.jackson.core:jackson-core:$jacksonVersion"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion"
implementation "com.google.code.findbugs:jsr305:$findbugsVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "commons-codec:commons-codec:$codecVersion"
implementation "commons-io:commons-io:$ioVersion"
implementation "net.sf.jopt-simple:jopt-simple:$joptVersion"
implementation "org.apache.commons:commons-lang3:$langVersion"
implementation "org.apache.httpcomponents:httpcore:$httpcoreVersion"
implementation "org.fxmisc.easybind:easybind:$easybindVersion"
implementation "org.jetbrains:annotations:$jetbrainsAnnotationsVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") {
exclude(module: 'jackson-annotations')
}
implementation("com.github.haveno-dex.netlayer:tor.native:$netlayerVersion") {
exclude(module: 'slf4j-api')
}
implementation("com.github.haveno-dex.netlayer:tor.external:$netlayerVersion") {
exclude(module: 'slf4j-api')
}
implementation("com.github.bisq-network:bitcoinj:$bitcoinjVersion") {
exclude(module: 'bcprov-jdk15on')
exclude(module: 'guava')
exclude(module: 'jsr305')
exclude(module: 'okhttp')
exclude(module: 'okio')
exclude(module: 'protobuf-java')
exclude(module: 'slf4j-api')
}
implementation("com.github.bisq-network:jsonrpc4j:$jsonrpc4jVersion") {
exclude(module: 'base64')
exclude(module: 'httpcore-nio')
}
implementation("com.google.inject:guice:$guiceVersion") {
exclude(module: 'guava')
}
implementation("org.apache.httpcomponents:httpclient:$httpclientVersion") {
exclude(module: 'commons-codec')
}
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testImplementation "com.natpryce:make-it-easy:$easyVersion"
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
implementation "org.openjfx:javafx-base:$javafxVersion:$os"
implementation "org.openjfx:javafx-graphics:$javafxVersion:$os"
implementation("io.github.woodser:monero-java:$moneroJavaVersion") {
exclude(module: 'jackson-core')
exclude(module: 'jackson-annotations')
exclude(module: 'jackson-databind')
exclude(module: 'bcprov-jdk15on')
exclude(group: 'org.slf4j', module: 'slf4j-simple')
}
}
test {
systemProperty 'jdk.attach.allowAttachSelf', true
}
task generateKeypairs(type: JavaExec) {
mainClass = 'haveno.core.util.GenerateKeyPairs'
classpath = sourceSets.main.runtimeClasspath
}
task havenoDeps {
doLast {
// get monero binaries download url
Map moneroBinaries = [
'linux-x86_64' : 'https://github.com/haveno-dex/monero/releases/download/release2/monero-bins-haveno-linux.tar.gz',
'linux-x86_64-sha256' : '3537fe2006997a1065748d27e9513ac3e0c942ab56a97a6e43065ddfd1820394',
'linux-aarch64' : 'https://github.com/haveno-dex/monero/releases/download/release2/monero-bins-haveno-linux-aarch64.tar.gz',
'linux-aarch64-sha256' : '6ff81c61780fe08defbd6576bd93c6711cf5ad3e79be0e3bc2184ff11cc6a472',
'mac' : 'https://github.com/haveno-dex/monero/releases/download/release2/monero-bins-haveno-mac.tar.gz',
'mac-sha256' : 'c7cafe1000a5839f02d02ed2edce5b1df3a06b5c77f4d91eaba106d948347730',
'windows' : 'https://github.com/haveno-dex/monero/releases/download/release2/monero-bins-haveno-windows.zip',
'windows-sha256' : '9b900faefa75f354870646989484978d1fb11add392ffd05eb5abe7e514e395a'
]
String osKey
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
osKey = 'windows'
} else if (Os.isFamily(Os.FAMILY_MAC)) {
osKey = 'mac'
} else {
String architecture = System.getProperty("os.arch").toLowerCase()
if (architecture.contains('aarch64') || architecture.contains('arm')) {
osKey = 'linux-aarch64'
} else {
osKey = 'linux-x86_64'
}
}
String moneroDownloadUrl = moneroBinaries[osKey]
String moneroSHA256Hash = moneroBinaries[osKey + '-sha256']
String moneroArchiveFileName = moneroDownloadUrl.tokenize('/').last()
String localnetDirName = '.localnet'
File localnetDir = new File(project.rootDir, localnetDirName)
localnetDir.mkdirs()
File moneroArchiveFile = new File(localnetDir, moneroArchiveFileName)
ext.downloadAndVerifyDependencies(moneroDownloadUrl, moneroSHA256Hash, moneroArchiveFile)
// extract if dependencies are missing or if archive was updated
File monerodFile
File moneroRpcFile
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
monerodFile = new File(localnetDir, 'monerod.exe')
moneroRpcFile = new File(localnetDir, 'monero-wallet-rpc.exe')
} else {
monerodFile = new File(localnetDir, 'monerod')
moneroRpcFile = new File(localnetDir, 'monero-wallet-rpc')
}
if (ext.dependencyDownloadedAndVerified || !monerodFile.exists() || !moneroRpcFile.exists()) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
ext.extractArchiveZip(moneroArchiveFile, localnetDir)
} else {
ext.extractArchiveTarGz(moneroArchiveFile, localnetDir)
}
// add the current platform's monero dependencies into the resources folder for installation
copy {
from "${monerodFile}"
into "${project(':core').projectDir}/src/main/resources/bin"
}
copy {
from "${moneroRpcFile}"
into "${project(':core').projectDir}/src/main/resources/bin"
}
}
}
ext.extractArchiveTarGz = { File tarGzFile, File destinationDir ->
println "Extracting tar.gz ${tarGzFile}"
// Gradle's tar extraction preserves permissions (crucial for jpackage to function correctly)
copy {
from tarTree(resources.gzip(tarGzFile))
into destinationDir
}
println "Extracted to ${destinationDir}"
}
ext.extractArchiveZip = { File zipFile, File destinationDir ->
println "Extracting zip ${zipFile}..."
ant.unzip(src: zipFile, dest: destinationDir)
println "Extracted to ${destinationDir}"
}
ext.downloadAndVerifyDependencies = { String archiveURL, String archiveSHA256, File destinationArchiveFile ->
ext.dependencyDownloadedAndVerified = false
// if archive exists, check to see if its already up to date
if (destinationArchiveFile.exists()) {
println "Verifying existing archive ${destinationArchiveFile}"
ant.archiveHash = archiveSHA256
ant.checksum(file: destinationArchiveFile, algorithm: 'SHA-256', property: '${archiveHash}', verifyProperty: 'existingHashMatches')
if (ant.properties['existingHashMatches'] != 'true') {
println "Existing archive does not match hash ${archiveSHA256}"
} else {
println "Existing archive matches hash"
return
}
}
println "Downloading ${archiveURL}"
ant.get(src: archiveURL, dest: destinationArchiveFile)
println 'Download saved to ' + destinationArchiveFile
println 'Verifying checksum for downloaded binary ...'
ant.archiveHash = archiveSHA256
// use a different verifyProperty name from existing verification or it will always fail
ant.checksum(file: destinationArchiveFile, algorithm: 'SHA-256', property: '${archiveHash}', verifyProperty: 'downloadedHashMatches')
if (ant.properties['downloadedHashMatches'] != 'true') {
ant.fail('Checksum mismatch: Downloaded archive has a different checksum than expected')
}
println 'Checksum verified'
ext.dependencyDownloadedAndVerified = true
}
}
processResources.dependsOn havenoDeps // before both test and build
}
configure(project(':cli')) {
mainClassName = 'haveno.cli.CliMain'
dependencies {
implementation project(':proto')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "net.sf.jopt-simple:jopt-simple:$joptVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("io.grpc:grpc-core:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
implementation("io.grpc:grpc-stub:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
runtimeOnly("io.grpc:grpc-netty-shaded:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testImplementation "org.bitbucket.cowwoc:diff-match-patch:$cowwocVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$jupiterVersion"
testRuntimeOnly "javax.annotation:javax.annotation-api:$javaxAnnotationVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
}
}
configure(project(':desktop')) {
apply plugin: 'com.github.johnrengelman.shadow'
apply from: 'package/package.gradle'
version = '1.0.2-SNAPSHOT'
jar.manifest.attributes(
"Implementation-Title": project.name,
"Implementation-Version": version,
"CFBundleVersion": version)
mainClassName = 'haveno.desktop.app.HavenoAppMain'
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
sourceSets.main.resources.srcDirs += ['src/main/java'] // to copy fxml and css files
dependencies {
implementation project(':assets')
implementation project(':common')
implementation project(':proto')
implementation project(':p2p')
implementation project(':core')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.googlecode.jcsv:jcsv:$jcsvVersion"
implementation "com.jfoenix:jfoenix:$jfoenixVersion"
implementation "commons-io:commons-io:$ioVersion"
implementation "de.jensd:fontawesomefx-commons:$fontawesomefxCommonsVersion"
implementation "de.jensd:fontawesomefx-materialdesignfont:$fontawesomefxMaterialdesignfontVersion"
implementation "de.jensd:fontawesomefx:$fontawesomefxVersion"
implementation "net.glxn:qrgen:$qrgenVersion"
implementation "org.apache.commons:commons-lang3:$langVersion"
implementation "org.bouncycastle:bcpg-jdk15on:$bcVersion"
implementation "org.fxmisc.easybind:easybind:$easybindVersion"
implementation "org.jetbrains:annotations:$jetbrainsAnnotationsVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("com.github.bisq-network:bitcoinj:$bitcoinjVersion") {
exclude(module: 'bcprov-jdk15on')
exclude(module: 'guava')
exclude(module: 'jsr305')
exclude(module: 'okhttp')
exclude(module: 'okio')
exclude(module: 'protobuf-java')
exclude(module: 'slf4j-api')
}
implementation("com.google.inject:guice:$guiceVersion") {
exclude(module: 'guava')
}
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testImplementation "com.natpryce:make-it-easy:$easyVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
implementation("io.github.woodser:monero-java:$moneroJavaVersion") {
exclude(module: 'jackson-core')
exclude(module: 'jackson-annotations')
exclude(module: 'jackson-databind')
exclude(module: 'bcprov-jdk15on')
exclude(group: 'org.slf4j', module: 'slf4j-simple')
}
implementation "org.openjfx:javafx-controls:$javafxVersion:$os"
implementation "org.openjfx:javafx-fxml:$javafxVersion:$os"
implementation "org.openjfx:javafx-swing:$javafxVersion:$os"
implementation "org.openjfx:javafx-base:$javafxVersion:$os"
implementation "org.openjfx:javafx-graphics:$javafxVersion:$os"
}
test {
systemProperty 'jdk.attach.allowAttachSelf', true
}
}
configure(project(':monitor')) {
mainClassName = 'haveno.monitor.Monitor'
dependencies {
implementation project(':assets')
implementation project(':common')
implementation project(':core')
implementation project(':p2p')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("com.github.haveno-dex.netlayer:tor.external:$netlayerVersion") {
exclude(module: 'slf4j-api')
}
implementation("com.github.haveno-dex.netlayer:tor.native:$netlayerVersion") {
exclude(module: 'slf4j-api')
}
implementation("com.google.inject:guice:$guiceVersion") {
exclude(module: 'guava')
}
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$jupiterVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
implementation "org.openjfx:javafx-base:$javafxVersion:$os"
implementation "org.openjfx:javafx-graphics:$javafxVersion:$os"
}
}
configure(project(':relay')) {
mainClassName = 'haveno.relay.RelayMain'
dependencies {
implementation project(':common')
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation("com.google.firebase:firebase-admin:$firebaseVersion") {
exclude(module: 'commons-logging')
exclude(module: 'grpc-auth')
exclude(module: 'httpclient')
exclude(module: 'httpcore')
}
implementation "com.sparkjava:spark-core:$sparkVersion"
implementation "com.turo:pushy:$pushyVersion"
implementation "commons-codec:commons-codec:$codecVersion"
implementation "io.grpc:grpc-auth:$grpcVersion"
}
}
configure(project(':seednode')) {
apply plugin: 'com.github.johnrengelman.shadow'
mainClassName = 'haveno.seednode.SeedNodeMain'
dependencies {
implementation project(':common')
implementation project(':p2p')
implementation project(':core')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("com.google.inject:guice:$guiceVersion") {
exclude(module: 'guava')
}
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
}
}
configure(project(':statsnode')) {
mainClassName = 'haveno.statistics.StatisticsMain'
dependencies {
implementation project(':common')
implementation project(':p2p')
implementation project(':core')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("com.google.inject:guice:$guiceVersion") {
exclude(module: 'guava')
}
}
}
configure(project(':daemon')) {
mainClassName = 'haveno.daemon.app.HavenoDaemonMain'
dependencies {
implementation project(':proto')
implementation project(':common')
implementation project(':p2p')
implementation project(':core')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "javax.annotation:javax.annotation-api:$javaxAnnotationVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "org.apache.commons:commons-lang3:$langVersion"
implementation "org.jetbrains:annotations:$jetbrainsAnnotationsVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("com.github.bisq-network:bitcoinj:$bitcoinjVersion") {
exclude(module: 'bcprov-jdk15on')
exclude(module: 'guava')
exclude(module: 'jsr305')
exclude(module: 'okhttp')
exclude(module: 'okio')
exclude(module: 'protobuf-java')
exclude(module: 'slf4j-api')
}
implementation("com.google.inject:guice:$guiceVersion") {
exclude(module: 'guava')
}
implementation("io.grpc:grpc-protobuf:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
implementation("io.grpc:grpc-stub:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
runtimeOnly("io.grpc:grpc-netty-shaded:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$jupiterVersion"
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$jupiterVersion")
implementation("io.github.woodser:monero-java:$moneroJavaVersion") {
exclude(module: 'jackson-core')
exclude(module: 'jackson-annotations')
exclude(module: 'jackson-databind')
exclude(module: 'bcprov-jdk15on')
exclude(group: 'org.slf4j', module: 'slf4j-simple')
}
implementation "org.openjfx:javafx-base:$javafxVersion:$os"
implementation "org.openjfx:javafx-graphics:$javafxVersion:$os"
}
}
configure(project(':inventory')) {
apply plugin: 'com.github.johnrengelman.shadow'
mainClassName = 'haveno.inventory.InventoryMonitorMain'
dependencies {
implementation project(':common')
implementation project(':p2p')
implementation project(':core')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "com.sparkjava:spark-core:$sparkVersion"
implementation "org.jetbrains:annotations:$jetbrainsAnnotationsVersion"
implementation("com.google.inject:guice:$guiceVersion") {
exclude(module: 'guava')
}
}
}
configure(project(':apitest')) {
mainClassName = 'haveno.apitest.ApiTestMain'
// We have to disable the :apitest 'test' task by default because we do not want
// to interfere with normal builds. To run JUnit tests in this subproject:
// Run a normal build and install dao-setup files first, then run:
// 'gradle :apitest:test -DrunApiTests=true'
test.enabled = System.getProperty("runApiTests") == "true"
test {
outputs.upToDateWhen { false } // Don't use previously cached test outputs.
testLogging {
showStackTraces = true // Show full stack traces in the console.
exceptionFormat = "full"
// Show passed & failed tests, and anything printed to stderr by the tests in the console.
// Do not show skipped tests in the console; they are shown in the html report.
events "passed", "failed", "standardError"
}
afterSuite { desc, result ->
if (!desc.parent) {
println("${result.resultType} " +
"[${result.testCount} tests, " +
"${result.successfulTestCount} passed, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped] html report contains skipped test info")
// Show report link if all tests passed in case you want to see more detail, stdout, skipped, etc.
if (result.resultType == TestResult.ResultType.SUCCESS) {
DirectoryReport htmlReport = getReports().getHtml()
String reportUrl = new ConsoleRenderer()
.asClickableFileUrl(htmlReport.getEntryPoint())
println("REPORT " + reportUrl)
}
}
}
}
dependencies {
implementation project(':proto')
implementation project(':common')
implementation project(':core')
implementation project(':seednode')
implementation project(':desktop')
implementation project(':daemon')
implementation project(':cli')
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "javax.annotation:javax.annotation-api:$javaxAnnotationVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
implementation "com.google.guava:guava:$guavaVersion"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "net.sf.jopt-simple:jopt-simple:$joptVersion"
implementation "org.apache.commons:commons-lang3:$langVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation("com.github.bisq-network:bitcoinj:$bitcoinjVersion") {
exclude(module: 'bcprov-jdk15on')
exclude(module: 'guava')
exclude(module: 'jsr305')
exclude(module: 'okhttp')
exclude(module: 'okio')
exclude(module: 'protobuf-java')
exclude(module: 'slf4j-api')
}
implementation("io.grpc:grpc-protobuf:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
implementation("io.grpc:grpc-stub:$grpcVersion") {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiterVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$jupiterVersion"
testRuntimeOnly "javax.annotation:javax.annotation-api:$javaxAnnotationVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"
}
}