/
build.gradle
226 lines (179 loc) · 6.63 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
plugins {
id 'java'
id 'idea'
id 'pmd'
id 'checkstyle'
id 'jacoco'
id 'application'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
}
group 'org.radarbase'
version '1.0.4'
mainClassName = 'org.radarbase.redcap.webapp.GrizzlyServer'
targetCompatibility = '11'
sourceCompatibility = '11'
configurations {
codacy
provided
compile.extendsFrom provided
}
repositories {
mavenCentral()
}
sourceSets {
main.kotlin.srcDirs += 'src/main/kotlin'
main.java.srcDirs += 'src/main/kotlin'
test.kotlin.srcDirs += 'src/test/kotlin'
test.java.srcDirs += 'src/test/kotlin'
integrationTest {
java {
compileClasspath += main.output + test.output + test.compileClasspath
runtimeClasspath += main.output + test.output + test.compileClasspath + test.runtimeClasspath + main.runtimeClasspath
srcDir file('src/integration-test/kotlin')
}
resources.srcDir file('src/integration-test/resources')
}
}
ext.apacheCommonsIoVersion = '2.5'
ext.apacheCommonsLangVersion = '3.6'
ext.jerseyVersion = '2.30.1'
ext.jerseymediaVersion = '2.30.1'
ext.junitVersion = '4.12'
ext.logbackVersion = '1.2.3'
ext.okhttp3Version = '3.8.1'
ext.radarOauthClientVersion = '0.8.0'
ext.grizzlyVersion = '2.4.4'
ext.jacksonVersion = '2.11.2'
dependencies {
implementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion
runtimeOnly group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: jerseymediaVersion
implementation group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet', version: jerseyVersion
implementation group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: jerseyVersion
implementation group: 'org.glassfish.grizzly', name: 'grizzly-http-server', version: grizzlyVersion
implementation group: 'org.glassfish.jersey.containers', name: 'jersey-container-grizzly2-http', version: jerseyVersion
implementation group: 'org.radarbase', name: 'oauth-client-util', version: radarOauthClientVersion
implementation group: 'commons-io', name: 'commons-io', version: apacheCommonsIoVersion
implementation group: 'org.apache.commons', name: 'commons-lang3', version: apacheCommonsLangVersion
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: okhttp3Version
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-reflect"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:${jacksonVersion}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}"
implementation "org.json:json:20170516"
testImplementation group: 'junit', name: 'junit', version: junitVersion
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
}
//---------------------------------------------------------------------------//
// Style checking //
//---------------------------------------------------------------------------//
checkstyle {
// codacy version
toolVersion '6.16'
ignoreFailures false
// ignore tests
sourceSets = [sourceSets.main, sourceSets.test, sourceSets.integrationTest]
}
pmd {
// pmd version
toolVersion = '6.0.0'
ignoreFailures = false
sourceSets = [sourceSets.main, sourceSets.test, sourceSets.integrationTest]
consoleOutput = true
ruleSets = []
ruleSetFiles = files("config/pmd/ruleset.xml")
}
pmdTest {
ruleSetFiles = files("config/pmd/test_ruleset.xml")
}
//---------------------------------------------------------------------------//
// Build system metadata //
//---------------------------------------------------------------------------//
idea {
module {
downloadSources = true
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
wrapper {
gradleVersion = '6.4'
}
tasks.withType(Tar) {
compression = Compression.GZIP
extension("tar")
}
//---------------------------------------------------------------------------//
// Testing //
//---------------------------------------------------------------------------//
test {
testLogging {
// Show that tests are run in the command-line output
events "skipped", "failed"
}
}
task downloadApplicationDependencies {
description "Pre-downloads application dependencies"
configurations.compileClasspath.files
configurations.runtimeClasspath.files
}
task integrationTest(type: Test, dependsOn: ['installMP', 'copyConf']) {
description = "Run integration tests (located in src/integrationTest/...)."
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
// Don't run specific test classes as they will be run by the Test Suite
exclude '**/*IntegratorTest*'
exclude '**/*MpClientTest*'
exclude '**/*EntryPointTest*'
// This is not needed, but I like to see which tests have run
testLogging {
events "skipped", "failed", "passed", "STANDARD_OUT", "STANDARD_ERROR"
}
}
integrationTest.finalizedBy 'removeLock'
ext.sudoLinux = System.properties['os.name'].toLowerCase().contains('linux') ? ['sudo'] : []
ext.lock = 'src/integration-test/.RUNNING_INSTANCE_LOCK'
task installMP(type: Exec) {
doFirst {
def lockFile = new File(lock)
if (lockFile.exists()) {
throw new GradleException("A previous instance of the management portal is still running. Please stop it first and then try again.")
} else {
lockFile.createNewFile()
}
}
workingDir 'src/integration-test/'
standardInput = System.in
commandLine sudoLinux + ['docker-compose', 'up', '-d', '--build', '--force-recreate']
doLast {
// wait until the managementportal is ready
sleep(60_000)
}
}
task removeLock(type: Exec) {
workingDir 'src/integration-test/'
commandLine sudoLinux + ['docker-compose', 'down']
doLast {
new File(lock).delete()
}
}
task copyConf(type: Copy) {
from "src/integration-test/resources/radar.yml"
into "/usr/local/etc/radar-redcap-int/"
filter { String line ->
line.replace(" base_url: http://managementportal-app:8090/",
" base_url: http://localhost:8090/")
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "11"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "11"
}
}