-
Notifications
You must be signed in to change notification settings - Fork 208
/
build.gradle
194 lines (167 loc) · 4.94 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
plugins {
id 'java'
id 'distribution'
id 'org.hidetake.ssh' version '2.10.1'
}
group 'BFT-SMaRt'
version '2.0'
java {
sourceCompatibility = JavaLanguageVersion.of(8)
targetCompatibility = JavaLanguageVersion.of(8)
}
repositories {
mavenCentral()
}
jar {
archivesBaseName='BFT-SMaRt'
project.version=""
}
ssh.settings {
fileTransfer = 'scp'
}
remotes {
master {
//Create a gradle.properties and set the following properties: remoteDeployMasterHost, remoteDeployMasterUser,
// remoteDeployMasterPrivateKeyFile
if (project.hasProperty("remoteDeployMasterHost")) {
host = remoteDeployMasterHost
}
if (project.hasProperty("remoteDeployMasterUser")) {
user = remoteDeployMasterUser
}
if (project.hasProperty("remoteDeployMasterPrivateKeyFile")) {
identity = file(remoteDeployMasterPrivateKeyFile)
}
}
}
task remoteDeploy(dependsOn: installDist) {
doLast {
def fileSeparator = System.getProperty("file.separator")
def src = project.buildDir.name + fileSeparator + "install" + fileSeparator + project.name
def target = '~/'
ssh.run {
session(remotes.master) {
put from: src, into: target
}
}
}
}
task localDeploy(dependsOn: installDist) {
doLast {
int nServers = 4
int nClients = 1
def fileSeparator = System.getProperty("file.separator")
def src = project.buildDir.name + fileSeparator + "install" + fileSeparator + project.name
def workingDirectory = project.buildDir.name + fileSeparator + "local" + fileSeparator
println ("Deploying project into ${workingDirectory}")
for (i in 0..<nServers) {
def target = workingDirectory + "rep${i}"
copy {
from src
into target
}
}
for (i in 0..<nClients) {
def target = workingDirectory + "cli${i}"
copy {
from src
into target
}
}
}
}
def setupIntegrationTestingEnvironment(nWorkers, workingDirectory) {
println("Creating folders for ${nWorkers} workers")
def fileSeparator = System.getProperty("file.separator")
def src = project.buildDir.name + fileSeparator + "install" + fileSeparator + project.name
copy {
from src + fileSeparator + "lib"
into workingDirectory + fileSeparator + "lib"
}
copy {
from project.projectDir.absolutePath + fileSeparator + "config" + fileSeparator + "benchmark.config"
into workingDirectory
}
for (i in 0..<nWorkers) {
def target = workingDirectory + "worker${i}"
copy {
from src
into target
}
}
}
task setupIntegrationTestingEnvironment(dependsOn: installDist) {
doFirst {
def f = 1
def nWorkers = 3 * f + 2
println("Creating folders for ${nWorkers} workers")
def fileSeparator = System.getProperty("file.separator")
def src = project.buildDir.name + fileSeparator + "install" + fileSeparator + project.name
def workingDirectory = project.buildDir.name + fileSeparator + "integration" + fileSeparator
copy {
from src + fileSeparator + "lib"
into workingDirectory + fileSeparator + "lib"
}
copy {
from project.projectDir.absolutePath + fileSeparator + "config" + fileSeparator + "benchmark.config"
into workingDirectory
}
for (i in 0..<nWorkers) {
def target = workingDirectory + "worker${i}"
copy {
from src
into target
}
}
}
}
task runIntegrationTest(type: JavaExec, dependsOn: installDist) {
int f = 1
int nWorkers = 3 * f + 2;
def fileSeparator = System.getProperty("file.separator")
String workingDirectory = project.buildDir.absolutePath + fileSeparator + "integration" + fileSeparator
doFirst {
setupIntegrationTestingEnvironment(nWorkers, workingDirectory)
}
classpath = sourceSets.main.runtimeClasspath
args(workingDirectory, project.getPath() + fileSeparator + "src", f, true)
mainClass = 'bftsmart.tests.IntegrationTestsExecutor'
}
distributions {
main {
contents {
into('config') {
from 'config'
}
into('lib') {
from jar
from(configurations.runtimeClasspath)
}
from 'runscripts/smartrun.sh'
from 'runscripts/smartrun.cmd'
}
}
}
tasks.withType(Javadoc) {
failOnError false
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
dependencies {
implementation fileTree('lib'){include '*.jar'}
// https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk15on
implementation 'org.bouncycastle:bcpkix-jdk15on:1.69'
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
implementation 'org.bouncycastle:bcprov-jdk15on:1.69'
// https://mvnrepository.com/artifact/commons-codec/commons-codec
implementation 'commons-codec:commons-codec:1.15'
// https://mvnrepository.com/artifact/ch.qos.logback/logback-core
implementation 'ch.qos.logback:logback-core:1.2.5'
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
implementation 'ch.qos.logback:logback-classic:1.2.5'
// https://mvnrepository.com/artifact/io.netty/netty-all
implementation 'io.netty:netty-all:4.1.67.Final'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
implementation 'org.slf4j:slf4j-api:1.7.32'
}