-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle
320 lines (281 loc) · 13.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
/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands).
*
* Licensed under the Radix License, Version 1.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
*
* radixfoundation.org/licenses/LICENSE-v1
*
* The Licensor hereby grants permission for the Canonical version of the Work to be
* published, distributed and used under or by reference to the Licensor’s trademark
* Radix ® and use of any unregistered trade names, logos or get-up.
*
* The Licensor provides the Work (and each Contributor provides its Contributions) on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
* including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
*
* Whilst the Work is capable of being deployed, used and adopted (instantiated) to create
* a distributed ledger it is your responsibility to test and validate the code, together
* with all logic and performance of that code under all foreseeable scenarios.
*
* The Licensor does not make or purport to make and hereby excludes liability for all
* and any representation, warranty or undertaking in any form whatsoever, whether express
* or implied, to any entity or person, including any representation, warranty or
* undertaking, as to the functionality security use, value or other characteristics of
* any distributed ledger nor in respect the functioning or value of any tokens which may
* be created stored or transferred using the Work. The Licensor does not warrant that the
* Work or any use of the Work complies with any law or regulation in any territory where
* it may be implemented or used or that it will be appropriate for any specific purpose.
*
* Neither the licensor nor any current or former employees, officers, directors, partners,
* trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor
* shall be liable for any direct or indirect, special, incidental, consequential or other
* losses of any kind, in tort, contract or otherwise (including but not limited to loss
* of revenue, income or profits, or loss of use or data, or loss of reputation, or loss
* of any economic or other opportunity of whatsoever nature or howsoever arising), arising
* out of or in connection with (without limitation of any use, misuse, of any ledger system
* or use made or its functionality or any performance or operation of any code or protocol
* caused by bugs or programming or logic errors or otherwise);
*
* A. any offer, purchase, holding, use, sale, exchange or transmission of any
* cryptographic keys, tokens or assets created, exchanged, stored or arising from any
* interaction with the Work;
*
* B. any failure in a transmission or loss of any token or assets keys or other digital
* artefacts due to errors in transmission;
*
* C. bugs, hacks, logic errors or faults in the Work or any communication;
*
* D. system software or apparatus including but not limited to losses caused by errors
* in holding or transmitting tokens by any third-party;
*
* E. breaches or failure of security including hacker attacks, loss or disclosure of
* password, loss of private key, unauthorised use or misuse of such passwords or keys;
*
* F. any losses including loss of anticipated savings or other benefits resulting from
* use of the Work or any changes to the Work (however implemented).
*
* You are solely responsible for; testing, validating and evaluation of all operation
* logic, functionality, security and appropriateness of using the Work for any commercial
* or non-commercial purpose and for any reproduction or redistribution by You of the
* Work. You assume all risks associated with Your use of the Work and the exercise of
* permissions under this License.
*/
plugins {
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'nebula.ospackage' version '8.4.1'
id 'org.sonarqube' version '3.3'
id 'com.adarshr.test-logger' version '2.1.0'
id 'com.moowork.node' version '1.3.1'
id 'maven-publish'
id "com.diffplug.spotless" version "6.0.0"
}
/*
define default value for the rust binary build type
*/
ext.rustBinaryBuildType = project.findProperty('rustBinaryBuildType') ?: 'debug'
/*
* Get the version name from an environment variable (or use the default). Used for built assets;
* This is set to gradle's version property below.
*/
def radixVersion() {
def versionBranchEnvVar = System.getenv('VERSION_BRANCH')
def versionBuildEnvVar = System.getenv('VERSION_BUILD')
def versionTagEnvVar = System.getenv('VERSION_TAG')
def version
if (versionTagEnvVar && !versionTagEnvVar.allWhitespace) {
version = versionTagEnvVar
} else {
if (versionBranchEnvVar == null) {
version = "development"
} else {
version = "$versionBranchEnvVar-$versionBuildEnvVar"
}
// Prepend SNAPSHOT so the tag name is valid regardless of the version
version = "SNAPSHOT-${version}"
}
// Ensure version is safe for gradle's purposes
// (we do further sanitizing for debian's purposes in debSafeVersionName())
version = version.replaceAll('/', '~')
return version
}
group 'com.radixdlt'
version radixVersion()
sonarqube {
properties {
property "sonar.projectKey", "radixdlt_babylon-node"
property "sonar.sourceEncoding", "UTF-8"
property 'sonar.host.url', 'https://sonarcloud.io'
property 'sonar.organization', 'radixdlt-github'
property 'sonar.login', System.env.SONAR_TOKEN
property 'sonar.exclusions', '**/openapitools/**/*,**/generated/**/*'
}
}
allprojects {
dependencyLocking {
// The gradle docs are here, but honestly quite rubbish:
// * https://docs.gradle.org/current/userguide/dependency_locking.html
// * (Rant about them here: https://github.com/gradle/gradle/issues/25293)
//
// If you get an error "Could not resolve all files for configuration" which contains
// "Did not resolve 'XXX' which has been forced / substituted to a different version: 'YYY'"
// Then run `./update-locks.sh`
//
// NOTE: I'm not entirely sure about if --write-locks will redo all locks - we may need to change
// it to not be so greedy if so.
lockAllConfigurations()
lockMode = LockMode.STRICT
}
repositories {
mavenCentral()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/radixdlt/maven-pkg")
credentials {
username = System.getenv("GPR_USER") ?: ''
password = System.getenv("GPR_TOKEN") ?: ''
}
}
maven { url 'https://jitpack.io' }
}
tasks.withType(JavaCompile) {
options.release = 17
options.encoding = "UTF-8"
options.compilerArgs << "--enable-preview"
options.compilerArgs << "-Xlint:all"
//TODO: uncomment once warnings will be cleared
//options.compilerArgs << "-Werror"
options.compilerArgs << "-Xlint:-processing" // Not really a useful warning
options.compilerArgs << "-Xlint:-serial" //TODO: fix code to remove these warnings
options.compilerArgs << "-Xlint:-deprecation" //TODO: fix code to remove these warnings
options.compilerArgs << "-Xlint:-unchecked" //TODO: fix code to remove these warnings
options.compilerArgs << "-Xlint:-rawtypes" //TODO: fix code to remove these warnings
options.compilerArgs << "-Xlint:-preview"
}
tasks.withType(Test) {
systemProperty "file.encoding", "UTF-8"
jvmArgs("--enable-preview")
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
systemProperty "java.library.path", "${project(':core-rust').projectDir}/target/debug"
}
tasks.withType(JavaExec) {
jvmArgs("--enable-preview")
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
systemProperty "java.library.path", "${project(':core-rust').projectDir}/target/debug"
}
}
subprojects {
if (project.name == "core-rust") {
// The below is suitable for a java project, not for a rust project
return
}
apply plugin: "com.diffplug.spotless"
spotless {
format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// Don't need to set target, it is inferred from java. But we add some exclusions.
targetExclude('**/openapitools/**/*.java', '**/generated/**/*.java')
// Apply a specific flavor of google-java-format
// See https://github.com/diffplug/spotless/tree/main/plugin-gradle#google-java-format
googleJavaFormat('1.13.0').reflowLongStrings()
// Make sure every file has the following copyright header
licenseHeaderFile("${project.rootDir}/licence-header.txt")
toggleOffOn()
}
}
apply plugin: "maven-publish"
sonarqube {
properties {
property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}
project.afterEvaluate {
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/radixdlt/maven-pkg")
credentials {
username = System.getenv("GPR_USER") ?: ''
password = System.getenv("GPR_TOKEN") ?: ''
}
}
}
publications {
gpr(MavenPublication) {
from(components.java)
}
if(project.name == "radixdlt"){
gprdist(MavenPublication) {
artifactId = "radixdlt-dist"
artifact distZip
}
}
}
}
}
group 'com.radixdlt'
version rootProject.version
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: 'com.adarshr.test-logger'
dependencyManagement {
overriddenByDependencies = false
dependencies {
dependency "com.github.akarnokd:rxjava3-extensions:3.0.1"
dependency 'io.reactivex.rxjava3:rxjava:3.0.13'
dependency 'com.sleepycat:je:18.3.12'
// LMAX Disruptor for async logging
dependency 'com.lmax:disruptor:3.4.4'
dependency 'commons-cli:commons-cli:1.4'
dependency 'org.xerial.snappy:snappy-java:1.1.10.1'
dependency 'io.netty:netty-all:4.1.115.Final'
dependency('com.google.inject:guice:5.0.1') {
exclude 'com.google.guava:guava'
}
dependency('com.google.inject.extensions:guice-grapher:5.0.1') {
exclude 'com.google.guava:guava'
}
dependency 'io.undertow:undertow-core:2.2.37.Final'
dependency 'com.stijndewitt.undertow.cors:undertow-cors-filter:0.4.0'
dependency 'org.apache.logging.log4j:log4j-api:2.17.1'
dependency 'org.apache.logging.log4j:log4j-core:2.17.1'
dependency 'org.apache.logging.log4j:log4j-slf4j-impl:2.17.1'
dependency('org.reflections:reflections:0.9.12') {
exclude 'com.google.guava:guava'
}
dependency 'org.bouncycastle:bcprov-jdk15on:1.70'
dependency 'org.bouncycastle:bcpkix-jdk15on:1.70'
dependency 'org.json:json:20240303'
dependency 'com.fasterxml.jackson.core:jackson-databind:2.15.4'
dependency 'com.fasterxml.jackson.core:jackson-core:2.15.4'
dependency 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.4'
dependency 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.15.4'
dependency 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.4'
dependency('com.fasterxml.jackson.datatype:jackson-datatype-json-org:2.15.4') {
exclude 'org.json:json'
}
dependency('com.fasterxml.jackson.datatype:jackson-datatype-guava:2.15.4') {
exclude 'com.google.guava:guava'
}
dependency 'com.google.guava:guava:31.1-jre'
dependency 'io.prometheus:simpleclient:0.16.0'
dependency 'io.prometheus:simpleclient_common:0.16.0'
dependency 'io.prometheus:simpleclient_hotspot:0.16.0'
dependency 'org.awaitility:awaitility:4.1.0'
dependency 'org.mockito:mockito-core:3.12.4'
dependency 'nl.jqno.equalsverifier:equalsverifier:3.6.1'
dependency 'org.assertj:assertj-core:3.20.2'
dependency 'junit:junit:4.13.2'
dependency 'pl.pragmatists:JUnitParams:1.1.1'
dependency 'commons-cli:commons-cli:1.4'
}
}
}