forked from bisq-network/bisq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
517 lines (458 loc) · 17.8 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
buildscript {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17'
classpath 'com.google.gradle:osdetector-gradle-plugin:1.6.0'
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
classpath 'org.openjfx:javafx-plugin:0.0.10'
}
}
configure(rootProject) {
// remove the 'bisq-*' scripts and 'lib' dir generated by the 'installDist' task
task clean {
doLast {
delete fileTree(dir: rootProject.projectDir, include: 'bisq-*'), 'lib'
}
}
}
configure(subprojects) {
apply plugin: 'com.google.osdetector'
ext { // in alphabetical order
grpcVersion = '1.42.1'
javafxVersion = '16'
protocVersion = '3.19.1'
os = osdetector.os == 'osx' ? 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os
}
}
configure([project(':cli'),
project(':daemon'),
project(':desktop'),
project(':seednode'),
project(':statsnode'),
project(':apitest')]) {
apply plugin: 'application'
build.dependsOn installDist
installDist.destinationDir = file('build/app')
distZip.enabled = false
distTar.enabled = false
// the 'installDist' and 'startScripts' blocks below configure bisq executables to put
// generated shell scripts in the root project directory, such that users can easily
// discover and invoke e.g. ./bisq-desktop, ./bisq-seednode, etc.
// See https://stackoverflow.com/q/46327736 for details.
installDist {
doLast {
// copy generated shell scripts, e.g. `bisq-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}/bisq-${applicationName}.bat")
windowsScriptFile.text = windowsScriptFile.text.replace(
'set APP_HOME=%DIRNAME%..', 'set APP_HOME=%DIRNAME%')
def unixScriptFile = file("${rootProject.projectDir}/bisq-$applicationName")
unixScriptFile.text = unixScriptFile.text.replace(
'APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit', 'APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit')
if (applicationName == 'desktop') {
def script = file("${rootProject.projectDir}/bisq-$applicationName")
script.text = script.text.replace(
'DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="-XX:MaxRAM=8g -Xss1280k -XX:+UseG1GC ' +
'-XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:+UseStringDeduplication ' +
'-Djava.net.preferIPv4Stack=true"')
}
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}/bisq-$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: 'bisq-*.bat')
else
delete fileTree(dir: rootProject.projectDir, include: 'bisq-*', exclude: '*.bat')
}
}
startScripts {
// rename scripts from, e.g. `desktop` to `bisq-desktop`
applicationName = "bisq-$applicationName"
}
}
configure(project(':common')) {
apply plugin: 'org.openjfx.javafxplugin'
javafx {
version = "$javafxVersion"
modules = ['javafx.graphics']
}
ext.getHash = {
def p1 = 'git rev-parse HEAD'.execute()
p1.waitFor()
return p1.text
}
jar.manifest.attributes(
"Implementation-Version": getHash())
dependencies {
implementation project(':proto')
annotationProcessor libs.lombok
compileOnly libs.javax.annotation
compileOnly libs.lombok
implementation libs.logback.classic
implementation libs.logback.core
implementation(libs.bitcoinj) {
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 libs.google.findbugs
implementation libs.google.gson
implementation libs.google.guava
implementation(libs.google.guice) {
exclude(module: 'guava')
}
implementation libs.protobuf.java
implementation libs.commons.io
implementation libs.jopt
implementation libs.apache.commons.lang3
implementation libs.bouncycastle.bcpg.jdk15on
implementation libs.kotlin.stdlib.jdk8
implementation libs.jetbrains.annotations
implementation libs.slf4j.api
testImplementation libs.hamcrest
runtimeOnly(libs.grpc.netty.shaded) {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
}
}
configure(project(':p2p')) {
apply plugin: 'org.openjfx.javafxplugin'
javafx {
version = "$javafxVersion"
modules = ['javafx.base']
}
dependencies {
implementation project(':proto')
implementation project(':common')
annotationProcessor libs.lombok
compileOnly libs.lombok
implementation libs.google.guava
implementation libs.protobuf.java
implementation libs.fxmisc.easybind
implementation libs.slf4j.api
implementation(libs.netlayer.tor.external) {
exclude(module: 'slf4j-api')
}
implementation(libs.netlayer.tor.native) {
exclude(module: 'slf4j-api')
}
implementation(libs.bitcoinj) {
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(libs.google.guice) {
exclude(module: 'guava')
}
implementation(libs.apache.httpclient) {
exclude(module: 'commons-codec')
}
testAnnotationProcessor libs.lombok
testCompileOnly libs.lombok
testImplementation libs.logback.classic
testImplementation libs.logback.core
testImplementation libs.apache.commons.lang3
testImplementation libs.mockito
}
}
configure(project(':core')) {
apply plugin: 'org.openjfx.javafxplugin'
javafx {
version = "$javafxVersion"
modules = ['javafx.base']
}
dependencies {
implementation project(':proto')
implementation project(':assets')
implementation project(':common')
implementation project(':p2p')
annotationProcessor libs.lombok
compileOnly libs.javax.annotation
compileOnly libs.lombok
implementation libs.logback.classic
implementation libs.logback.core
implementation libs.jackson.annotations
implementation libs.jackson.core
implementation libs.google.findbugs
implementation libs.google.gson
implementation libs.google.guava
implementation libs.protobuf.java
implementation libs.commons.codec
implementation libs.commons.io
implementation libs.jopt
implementation libs.apache.commons.lang3
implementation libs.apache.httpcore
implementation libs.fxmisc.easybind
implementation libs.jetbrains.annotations
implementation libs.slf4j.api
implementation(libs.jackson.databind) {
exclude(module: 'jackson-annotations')
}
implementation(libs.netlayer.tor.external) {
exclude(module: 'slf4j-api')
}
implementation(libs.netlayer.tor.native) {
exclude(module: 'slf4j-api')
}
implementation(libs.bitcoinj) {
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(libs.jsonrpc4j) {
exclude(module: 'base64')
exclude(module: 'httpcore-nio')
}
implementation(libs.google.guice) {
exclude(module: 'guava')
}
implementation(libs.apache.httpclient) {
exclude(module: 'commons-codec')
}
testAnnotationProcessor libs.lombok
testCompileOnly libs.lombok
testImplementation libs.natpryce.make.it.easy
testImplementation libs.hamcrest
testImplementation libs.mockito
}
test {
systemProperty 'jdk.attach.allowAttachSelf', true
}
}
configure(project(':desktop')) {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.openjfx.javafxplugin'
apply from: 'package/package.gradle'
shadowDistTar.enabled = false
shadowDistZip.enabled = false
javafx {
version = "$javafxVersion"
modules = ['javafx.controls', 'javafx.fxml']
}
version = file("src/main/resources/version.txt").text.trim()
jar.manifest.attributes(
"Implementation-Title": project.name,
"Implementation-Version": version)
mainClassName = 'bisq.desktop.app.BisqAppMain'
jar {
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 libs.lombok
compileOnly libs.lombok
implementation libs.logback.classic
implementation libs.logback.core
implementation libs.google.gson
implementation libs.google.guava
implementation libs.protobuf.java
implementation libs.jcsv
implementation libs.jfoenix
implementation libs.commons.io
implementation libs.fontawesomefx
implementation libs.fontawesomefx.commons
implementation libs.fontawesomefx.materialdesign.font
implementation libs.qrgen
implementation libs.apache.commons.lang3
implementation libs.bouncycastle.bcpg.jdk15on
implementation libs.fxmisc.easybind
implementation libs.jetbrains.annotations
implementation libs.slf4j.api
implementation(libs.bitcoinj) {
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(libs.google.guice) {
exclude(module: 'guava')
}
testAnnotationProcessor libs.lombok
testCompileOnly libs.lombok
testImplementation libs.natpryce.make.it.easy
testImplementation libs.mockito
}
test {
systemProperty 'jdk.attach.allowAttachSelf', true
}
}
configure(project(':seednode')) {
apply plugin: 'com.github.johnrengelman.shadow'
shadowDistTar.enabled = false
shadowDistZip.enabled = false
jar.manifest.attributes(
"Implementation-Title": project.name,
"Implementation-Version": version)
mainClassName = 'bisq.seednode.SeedNodeMain'
dependencies {
implementation project(':common')
implementation project(':proto')
implementation project(':p2p')
implementation project(':core')
implementation libs.protobuf.java
annotationProcessor libs.lombok
compileOnly libs.lombok
implementation libs.google.guava
implementation libs.slf4j.api
implementation(libs.google.guice) {
exclude(module: 'guava')
}
testImplementation libs.mockito
}
}
configure(project(':statsnode')) {
mainClassName = 'bisq.statistics.StatisticsMain'
dependencies {
implementation project(':common')
implementation project(':p2p')
implementation project(':core')
annotationProcessor libs.lombok
compileOnly libs.lombok
implementation libs.slf4j.api
implementation(libs.google.guice) {
exclude(module: 'guava')
}
}
}
configure(project(':apitest')) {
mainClassName = 'bisq.apitest.ApiTestMain'
// The external dao-setup.gradle file contains tasks to install and clean dao-setup
// files downloaded from
// https://github.com/bisq-network/bisq/raw/master/docs/dao-setup.zip
// These tasks are not run by the default build, but they can can be run during
// full or partial builds, or by themselves.
// To run the regular clean + build + test (non api), and install dao-setup files:
// ./gradlew clean build :apitest:installDaoSetup
// To install or re-install dao-setup file only:
// ./gradlew :apitest:installDaoSetup -x test
// To clean installed dao-setup files:
// ./gradlew :apitest:cleanDaoSetup -x test
apply from: 'dao-setup.gradle'
// 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"
sourceSets {
main {
resources {
exclude 'dao-setup'
exclude 'dao-setup.zip'
}
}
}
test {
useJUnitPlatform()
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 org.gradle.internal.logging.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 libs.lombok
compileOnly libs.javax.annotation
compileOnly libs.lombok
implementation libs.logback.classic
implementation libs.logback.core
implementation libs.google.gson
implementation libs.google.guava
implementation libs.protobuf.java
implementation libs.jopt
implementation libs.apache.commons.lang3
implementation libs.slf4j.api
implementation(libs.bitcoinj) {
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(libs.grpc.protobuf) {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
implementation(libs.grpc.stub) {
exclude(module: 'animal-sniffer-annotations')
exclude(module: 'guava')
}
testAnnotationProcessor libs.lombok
testCompileOnly libs.lombok
testImplementation libs.junit.jupiter.api
testImplementation libs.junit.jupiter.params
testRuntimeOnly libs.javax.annotation
testRuntimeOnly(libs.junit.jupiter.engine)
}
}