-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
166 lines (133 loc) · 3.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
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'
classpath 'org.scoverage:gradle-scoverage:1.0.9'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.4.0'
}
}
apply plugin: 'java'
apply plugin: 'scala'
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'scoverage'
apply plugin: 'com.github.kt3k.coveralls'
project.group = 'com.campudus'
project.version = '1.0.0'
def vertxVersion = '3.2.1'
def scalaVersion = '2.11.7'
if (!JavaVersion.current().java8Compatible) {
throw new IllegalStateException("This needs Java 8.")
}
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
configurations {
compileOnly
}
dependencies {
compile "org.scala-lang:scala-library:${scalaVersion}"
compile "io.vertx:vertx-core:${vertxVersion}"
compile "io.vertx:vertx-web:${vertxVersion}"
compile 'joda-time:joda-time:2.9.1'
compile 'com.typesafe.scala-logging:scala-logging_2.11:3.1.0'
compile 'org.slf4j:slf4j-jdk14:1.7.13'
compile 'com.jcabi:jcabi-manifests:1.1'
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:1.1.1'
scoverage 'org.scoverage:scalac-scoverage-runtime_2.11:1.1.1'
testCompile "io.vertx:vertx-unit:${vertxVersion}"
testCompile 'junit:junit:4.12'
}
mainClassName = "io.vertx.core.Launcher"
def mainVerticle = "com.campudus.ffmus.Starter"
checkScoverage {
minimumRate = 0.85
}
test {
maxHeapSize = "512m"
jvmArgs "-Xmx512m"
}
testScoverage {
maxHeapSize = "512m"
jvmArgs "-Xmx512m"
}
run {
args = [
"run",
mainVerticle,
"-conf", "conf.json"
]
}
task runRedeploy(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = mainClassName
args = [
"run",
mainVerticle,
"-conf", "conf.json",
"--redeploy=src/main/**/*.scala",
"--launcher-class=${mainClassName}",
"--on-redeploy=./gradlew shadowJar"
]
}
// activate Zinc incremental compilation
tasks.withType(ScalaCompile) {
scalaCompileOptions.useAnt = false
scalaCompileOptions.useCompileDaemon = true
scalaCompileOptions.daemonServer = "localhost:4243"
}
// let Scala compiler do everything – even java stuff
sourceSets {
main {
compileClasspath += configurations.compileOnly
scala {
srcDirs = ['src/main/scala']
}
java {
srcDirs = []
}
}
test {
compileClasspath += configurations.compileOnly
}
}
def coverageReportPath = "${buildDir}/reports/scoverage/cobertura.xml".toString()
coveralls {
service = "travis-ci"
def sourceDirStrings = new ArrayList()
subprojects.sourceSets.main.allSource.srcDirs.each {
it.each {
java.nio.file.Path absPath = Paths.get(it.toString())
java.nio.file.Path basePath = Paths.get(System.getProperty("user.dir"))
java.nio.file.Path relPath = basePath.relativize(absPath)
sourceDirStrings.add(relPath.toString())
}
}
sourceDirs = sourceDirStrings.flatten()
coberturaReportPath = coverageReportPath
}
jar {
manifest {
attributes 'Main-Class': mainClassName
attributes 'Main-Verticle': mainVerticle
attributes 'Implementation-Vendor': project.group
attributes 'Implementation-Title': project.name
attributes 'Implementation-Version': project.version
}
}
shadowJar {
classifier = 'fat'
mergeServiceFiles {
include 'META-INF/services/io.vertx.core.spi.VerticleFactory'
}
}
assemble.dependsOn shadowJar
task wrapper(type: Wrapper) {
gradleVersion = '2.10'
}