-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
246 lines (177 loc) · 6.16 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
import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
//Script for sCoverage task.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.org.scoverage:gradle-scoverage:2.3.0"
classpath "gradle.plugin.com.github.maiflai:gradle-scalatest:0.22"
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.2"
}
}
//List of plugins to apply.
plugins {
id 'java'
id 'scala'
id 'org.scoverage' version '2.3.0'
id 'com.github.maiflai.scalatest' version '0.22'
id 'application'
id 'com.github.johnrengelman.shadow' version '4.0.1'
}
//group and version.
group 'it.unibo.pps2017'
version '1.1.0'
sourceCompatibility = 1.8
//List of variables used in the file.
ext {
//Scala version variables.
scalaBinaryVersion = '2.12'
scalaMajor = '2.12'
scalaMinorVersion = '6'
scalaVersion = "$scalaBinaryVersion.$scalaMinorVersion"
//Version for Vertx.
vertxVersion = '3.5.4'
//Version for Akka.
akkaVersion = '2.5.17'
//Version for ScalaTest library.
scalaTestVersion = '3.0.1'
scalaCheckVersion = '1.14.0'
//Junit Version
jUnitVersion = '4.12'
sCoveragePluginVersion = '1.3.1'
pegDownVersion = '1.5.0'
gradleScalaTestVersion = '0.22'
gradleSCoverageVersion = '3.2.0'
//Cornichon version for REST API Test
cornichonVerison = '0.15.3'
//Circe version
circeVersion = '0.10.0'
// SLF4J
slf4jApiVersion = '1.7.12'
logbackVersion = '1.2.3'
redisScalaVersion = '1.8.0'
}
//create a single Jar with all dependencies
//jar {
// manifest {
// attributes 'Main-Class': 'it.unibo.pps2017.commons.remote.akka.MockDiscovery'
// }
//}
shadowJar {
transform(com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer) {
resource = 'reference.conf'
}
}
runShadow {
mainClassName = 'it.unibo.pps2017.discovery.DiscoveryMain'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
// this makes the scala classes builds alongside the java ones.
sourceSets {
main {
scala {
srcDirs = ['src/main/scala', 'src/main/java']
}
java {
srcDirs = []
}
}
}
dependencies {
//Support to scala language.
implementation "org.scala-lang:scala-library:$scalaVersion"
//Support to Vertx libraries.
implementation "io.vertx:vertx-lang-scala_2.12:$vertxVersion"
implementation "io.vertx:vertx-web-scala_2.12:$vertxVersion"
implementation "io.vertx:vertx-web-client-scala_2.12:$vertxVersion"
// Simple Logging Facade for Java
implementation "org.slf4j:slf4j-api:$slf4jApiVersion"
// Logback Classic
implementation "ch.qos.logback:logback-classic:$logbackVersion"
// JSON4S Json Library
compile group: 'org.json4s', name: 'json4s-native_2.12', version: '3.6.0'
compile group: 'org.json4s', name: 'json4s-jackson_2.12', version: '3.6.0'
//Basic support for Akka.
implementation "com.typesafe.akka:akka-actor_$scalaMajor:$akkaVersion"
implementation "com.typesafe.akka:akka-cluster_$scalaMajor:$akkaVersion"
implementation "com.typesafe.akka:akka-cluster-tools_$scalaMajor:$akkaVersion"
compile group: 'com.typesafe.akka', name: 'akka-cluster-metrics_2.12', version: '2.5.17'
//Dependency for Junit.
testImplementation "junit:junit:$jUnitVersion"
//Dependency for pegdown, a library used in scoverage.
testImplementation "org.pegdown:pegdown:$pegDownVersion"
// Dependency for ScalaTest.
testImplementation "org.scalatest:scalatest_2.12:$scalaTestVersion"
//Dependencies for ScalaCheck.
testImplementation "org.scalacheck:scalacheck_$scalaBinaryVersion:$scalaCheckVersion"
//TestKit for testing akka actors.
testImplementation "com.typesafe.akka:akka-testkit_$scalaMajor:$akkaVersion"
//TestKit for vertx stuff.
testImplementation "io.vertx:vertx-unit:3.5.4"
//Logback for test implementation.
testImplementation "ch.qos.logback:logback-classic:$logbackVersion"
//Cornichon API REST test library
compile group: 'com.github.agourlay', name: 'cornichon_2.12', version: cornichonVerison
//Circe JSON Scala library
compile group: 'io.circe', name: 'circe-core_2.12', version: circeVersion
// Add cli parser support.
compile group: 'org.rogach', name: 'scallop_2.12', version: '3.1.3'
//Dependency for sCoverage.
scoverage "org.scoverage:scalac-scoverage-plugin_2.12:$sCoveragePluginVersion"
scoverage "org.scoverage:scalac-scoverage-runtime_2.12:$sCoveragePluginVersion"
compile "com.github.etaty:rediscala_$scalaMajor:$redisScalaVersion"
compile group: 'redis.clients', name: 'jedis', version: '2.9.0'
}
/**
* This should run tests one at time.
*/
test {
maxParallelForks = 1
}
/**
* This should run tests one at time for SCoverage.
*/
testScoverage {
maxParallelForks = 1
}
defaultTasks 'clean', 'build', 'javadoc', 'scaladoc', 'reportScoverage'
//TO CHANGE FOR SHADOWJAR
mainClassName = 'it.unibo.pps2017.client.ClientMain'
task stage {
dependsOn installDist
}
task serverJar(type: ShadowJar) {
classifier = 'server'
manifest.attributes 'Main-Class': 'it.unibo.pps2017.server.Runner'
from(shadowJar.from())
}
task discoveryJar(type: ShadowJar) {
classifier = 'discovery'
manifest.attributes 'Main-Class': 'it.unibo.pps2017.discovery.DiscoveryMain'
from(shadowJar.from())
}
task clientJar(type: ShadowJar) {
classifier = 'client'
manifest.attributes 'Main-Class': 'it.unibo.pps2017.client.ClientMain'
from(shadowJar.from())
}
task(runClient, dependsOn: 'classes', type: JavaExec) {
main = 'it.unibo.pps2017.client.ClientMain'
classpath = sourceSets.main.runtimeClasspath
}
task(runServer, dependsOn: 'classes', type: JavaExec) {
main = 'it.unibo.pps2017.server.Runner'
classpath = sourceSets.main.runtimeClasspath
}
task(runDiscovery, dependsOn: 'classes', type: JavaExec) {
main = 'it.unibo.pps2017.discovery.DiscoveryMain'
classpath = sourceSets.main.runtimeClasspath
}