-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
249 lines (221 loc) · 8.32 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
/*
* Copyright (c) Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
wrapper {
gradleVersion = '6.5.1'
distributionType = Wrapper.DistributionType.ALL
}
buildscript {
ext {
kotlin_version = '1.4.30'
kotlin_coroutines_core_version = '1.4.2'
javalin_version = '3.13.11'
jackson_version = '2.12.1'
testng_version = '7.4.0'
detekt_version = '1.15.0'
jacocoVersion = '0.8.5'
picocli_version = '4.6.1'
mockito_version = '3.8.0'
assertj_version = '3.19.0'
mockk_version = '1.10.6'
logback_version = '1.2.3'
spring_data_commons_version = '2.4.5'
spring_web_version = '5.3.9'
spring_context_version = '5.3.4'
mockito_kotlin_version = '2.2.0'
http_client_version = '4.5.13'
commons_codec_version = '1.15'
coverageOverallReportFile = file("${project.buildDir}/report/overall-coverage/jacocoOverallReport.xml")
}
repositories {
mavenCentral()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
classpath("com.github.jk1:gradle-license-report:1.9")
}
}
group "com.odim"
version '1.0-SNAPSHOT'
// BMC SIMULATOR versions, to override version please use -DimplementationVersion=XXX
final def specificationVersion = getProperty("specificationVersion", "5.3")
final def implementationVersion = getProperty("implementationVersion", "0")
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
sourceCompatibility = VERSION_1_8
sourceSets {
main.kotlin.srcDirs = ['src/main/kotlin', 'src/main/java']
main.java.srcDirs = []
test.kotlin.srcDirs = ['src/test/kotlin', 'src/test/java']
}
compileKotlin {
kotlinOptions.suppressWarnings = true
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.suppressWarnings = true
kotlinOptions.jvmTarget = "1.8"
}
configurations {
detekt
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}") {
force = true
}
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}") {
force = true
}
implementation("io.javalin:javalin:$javalin_version")
implementation("ch.qos.logback:logback-classic:$logback_version")
implementation("org.springframework.data:spring-data-commons:$spring_data_commons_version")
implementation("org.springframework:spring-context:$spring_context_version") {
exclude group: 'org.springframework', module: 'spring-aop'
}
implementation("org.springframework:spring-web:$spring_web_version")
implementation("com.fasterxml.jackson.core:jackson-databind:$jackson_version")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_core_version")
implementation("info.picocli:picocli:$picocli_version")
implementation("org.apache.httpcomponents:httpclient")
constraints {
implementation("org.apache.httpcomponents:httpclient:$http_client_version")
implementation("commons-codec:commons-codec:$commons_codec_version") {
because 'version 1.11 pulled from httpclient has bugs'
}
}
detekt("io.gitlab.arturbosch.detekt:detekt-cli:$detekt_version")
testImplementation("org.testng:testng:$testng_version")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockito_kotlin_version")
testImplementation("io.mockk:mockk:$mockk_version")
testImplementation("org.mockito:mockito-inline:$mockito_version")
testImplementation("org.assertj:assertj-core:$assertj_version")
}
configurations.create("projectFlatClasspath")
configurations.projectFlatClasspath {
extendsFrom(configurations.runtimeClasspath)
transitive = false
}
/////////////////////////////////////////////////////////////////////////////////////////////// custom tasks
task executableJar(type: Jar) {
dependsOn classes
baseName "simulator-runner"
manifest {
attributes 'Main-Class': 'com.odim.simulator.commandline.SimulatorsCmdKt'
attributes 'Specification-Version': specificationVersion
attributes 'Implementation-Version': implementationVersion
}
from { (configurations.compileClasspath).collect { it.isDirectory() ? it : zipTree(it) } }
from sourceSets.main.output
exclude("simulators")
}
/////////////////////////////////////////////////////////////////////////////////////////////// verification
task detekt(type: JavaExec) {
main = "io.gitlab.arturbosch.detekt.cli.Main"
classpath = configurations.detekt
def input = "$projectDir"
def config = "$projectDir/src/main/resources/detekt-config.yml"
def exclude = ".*/build/.*," +
".*/resources/.*," +
"**/test/**," +
"**/*Simulator.kt," +
"**/templates/**," +
"**/VersionedParser.kt," +
"**/Usage.kt," +
"**/*Test.kt," +
"**/*Spec.kt"
def report = "html:$projectDir/build/reports/detekt/detekt-scan-report.html"
def params = ['-i', input, '-c', config, '-ex', exclude, '-r', report]
args(params)
}
test.dependsOn detekt
import org.gradle.api.tasks.testing.logging.TestLogEvent
import static java.lang.System.getProperty
import static org.gradle.api.JavaVersion.VERSION_1_8
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
}
}
test {
useTestNG()
jacoco {
destinationFile = file("${buildDir}/jacoco/test.exec")
}
finalizedBy(jacocoTestReport)
}
jacoco {
toolVersion = "${jacocoVersion}"
}
jacocoTestReport {
reports {
xml.enabled true
xml.destination = coverageOverallReportFile
csv.enabled false
}
}
apply plugin: com.odim.tools.coverage.CoverageLevelPlugin
coverageLevel {
coverageMinThreshold = 0.64
coverageExcessMax = 0.025
counter = "LINE"
xmlReport = coverageOverallReportFile
}
verifyCoverage.dependsOn test
check.dependsOn detekt, verifyCoverage
/////////////////////////////////////////////////////////////////////////////////////////////// license-report
apply plugin: 'com.github.jk1.dependency-license-report'
import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter
import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.render.CsvReportRenderer
import com.github.jk1.license.render.InventoryHtmlReportRenderer
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
licenseReport {
outputDir = "$projectDir/build/licenses"
projects = [project] + project.subprojects
configurations = ['projectFlatClasspath']
excludeOwnGroup = true
filters = [new ExcludeTransitiveDependenciesFilter(), new LicenseBundleNormalizer()]
renderers = [new CsvReportRenderer(), new InventoryHtmlReportRenderer()]
}