-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild.gradle
252 lines (226 loc) · 10.7 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
/* 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.
*/
apply plugin: 'java'
apply plugin: 'org.sonarqube'
apply plugin: 'project-report'
apply plugin: 'application'
sourceSets {
integration {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration/java')
}
resources.srcDir file('src/integration/resources')
}
}
compileTestJava {
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
}
sourceSets {
p2pTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/p2pTest/java')
}
resources.srcDir file('src/p2pTest/resources')
}
}
configurations {
p2pTestImplementation.extendsFrom testImplementation
}
dependencies {
implementation project(':core')
implementation project(':core-rust-bridge')
implementation project(':common')
implementation 'commons-cli:commons-cli'
implementation "com.github.akarnokd:rxjava3-extensions"
implementation 'io.reactivex.rxjava3:rxjava'
implementation 'io.netty:netty-all'
testImplementation 'junit:junit'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.awaitility:awaitility:3.0.0'
testImplementation project(':cli-tools')
}
configurations {
integrationImplementation.extendsFrom testImplementation
}
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
csv.enabled false
}
}
def networkName = project.getProperties().get('networkName', 'testnet')
def enableAWSSecret = project.getProperties().get('enableAWSSecret', false)
def recreateAWSSecret = project.getProperties().get('recreateAWSSecret', false)
def nodeNumber = project.getProperties().get('nodeNumber', 0)
def nodeNamePrefix = project.getProperties().get('nodeNamePrefix', "fullnode")
def secretPasswordKey = project.getProperties().get('secretPasswordKey', "")
def nodeNames = project.getProperties().get('nodeNames', "")
def validators = project.getProperties().get('validators', '0')
def publicKeys = project.getProperties().get('publicKeys', '')
def network = project.getProperties().get('network', '')
task getClassPathForRadixShell {
doLast {
print sourceSets.main.runtimeClasspath.getAsPath()
}
}
task getNativeLibPathForRadixShell {
doLast {
print "${project(':core-rust').projectDir}/target/debug/"
}
}
task generateNodeKey(type: Exec) {
dependsOn compileJava
dependsOn ':common:jar'
dependsOn ':core:jar'
dependsOn ':core-rust-bridge:jar'
group = "Execution"
description = "Generate Node key"
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
commandLine "java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(),
"--enable-preview",
"-Djava.library.path=${project(':core-rust').projectDir}/target/debug/",
"com.radixdlt.cloud.AWSSecrets",
"--enable-aws-secrets=${enableAWSSecret}",
"--recreate-aws-secrets=${recreateAWSSecret}",
"--network-name=${networkName}",
"--node-number=${nodeNumber}",
"--node-name-prefix=${nodeNamePrefix}",
"--node-names=${nodeNames}",
"--secret-password-key=${secretPasswordKey}"
}
task generateDevGenesis(type: Exec) {
dependsOn compileJava
dependsOn ':core:jar'
dependsOn ':common:jar'
dependsOn ':core-rust-bridge:jar'
group = "Execution"
description = "Generate development genesis"
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
commandLine "java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(),
"--enable-preview",
"-Djava.library.path=${project(':core-rust').projectDir}/target/debug/",
"-Dlog4j.configurationFile=${projectDir.path + "/src/main/resources/generate_genesis_log4j2.properties"}",
"com.radixdlt.cli.GenerateGenesis",
"--validator-count=${validators}",
"--network=${network}"
}
task generateGenesisFile(type: Exec) {
dependsOn compileJava
dependsOn ':core:jar'
dependsOn ':common:jar'
dependsOn ':core-rust-bridge:jar'
group = "Execution"
description = "Generate development genesis"
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
commandLine "java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(),
"--enable-preview",
"-Djava.library.path=${project(':core-rust').projectDir}/target/debug/",
"-Dlog4j.configurationFile=${projectDir.path + "/src/main/resources/generate_genesis_log4j2.properties"}",
"com.radixdlt.cli.GenerateGenesis",
"--public-keys=${publicKeys}",
"--network=${network}"
}
task createGenerateGenesisScripts(type: CreateStartScripts) {
mainClassName = 'com.radixdlt.cli.GenerateGenesis'
applicationName = 'generate_genesis'
}
tasks.getByName("createGenerateGenesisScripts").outputDir = tasks.getByName("startScripts").outputDir
tasks.getByName("createGenerateGenesisScripts").classpath = tasks.getByName("startScripts").classpath
tasks.getByName("createGenerateGenesisScripts").optsEnvironmentVar = tasks.getByName("startScripts").optsEnvironmentVar
tasks.getByName("createGenerateGenesisScripts") {
// Make sure all scripts have consistent classpath
doLast {
def windowsScriptFile = file getWindowsScript()
def unixScriptFile = file getUnixScript()
windowsScriptFile.text = windowsScriptFile.text.replace('%APP_HOME%\\lib\\resources', '%RADIXDLT_HOME%')
unixScriptFile.text = unixScriptFile.text.replace('$APP_HOME/lib/resources', '$RADIXDLT_HOME')
}
}
tasks.getByName("startScripts").dependsOn createGenerateGenesisScripts
task runTargetedIntegrationTests(type: Test) {
filter {
includeTestsMatching "com.radixdlt.integration.targeted.*"
}
environment "RADIX_NODE_KEYSTORE_PASSWORD", "supersecret"
testClassesDirs = sourceSets.integration.output.classesDirs
classpath = sourceSets.integration.runtimeClasspath
}
task runAllIntegrationTests(type: Test) {
environment "RADIX_NODE_KEYSTORE_PASSWORD", "supersecret"
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
systemProperty "java.library.path", "${project(':core-rust').projectDir}/target/debug/"
testClassesDirs = sourceSets.integration.output.classesDirs
classpath = sourceSets.integration.runtimeClasspath
}
task runP2pTests(type: JavaExec) {
classpath = sourceSets.p2pTest.runtimeClasspath
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
systemProperty "java.library.path", "${project(':core-rust').projectDir}/target/debug/"
main = "com.radixdlt.p2ptest.LargeMessageTest"
}