-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
220 lines (176 loc) · 6.49 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
import org.gradle.api.internal.file.FileOperations
import org.gradle.internal.jacoco.JacocoAgentJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
buildscript {
apply from: "./gradle/versions.gradle"
repositories {
gradlePluginPortal()
mavenCentral()
}
}
plugins {
id "com.gradle.plugin-publish" version "$gradlePublishVersion"
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
id "org.jetbrains.dokka" version "$dokkaVersion"
id "io.gitlab.arturbosch.detekt" version "$detektVersion"
id "org.jlleitschuh.gradle.ktlint" version "$ktlintPluginVersion"
id "com.github.ben-manes.versions" version "$gradleVersionsVersion"
id "java-gradle-plugin"
id "java-library"
id "maven-publish"
id "jacoco"
}
group = "de.smartsquare"
version = squitVersion
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinHtmlVersion"
api "org.dom4j:dom4j:$dom4jVersion"
api "com.google.code.gson:gson:$gsonVersion"
api "com.typesafe:config:$typesafeConfigVersion"
implementation "jaxen:jaxen:$jaxenVersion"
implementation "pull-parser:pull-parser:$pullParserVersion"
implementation "org.apache.santuario:xmlsec:$xmlSecVersion"
implementation "org.xmlunit:xmlunit-core:$xmlUnitVersion"
implementation "net.javacrumbs.json-unit:json-unit:$jsonUnitVersion"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "se.sawano.java:alphanumeric-comparator:$alphanumericComparatorVersion"
implementation("com.github.wumpz:diffutils:$diffUtilsVersion") {
exclude group: "org.eclipse.jgit", module: "*"
}
implementation "org.webjars.npm:jquery:$jqueryVersion"
implementation "org.webjars.npm:bootstrap:$bootstrapVersion"
implementation "org.webjars.npm:popper.js:$popperVersion"
implementation "org.webjars:font-awesome:$fontAwesomeVersion"
implementation "org.webjars.npm:marked:$markedVersion"
implementation("org.webjars.npm:diff2html:$diff2htmlVersion") {
exclude group: "org.webjars.npm", module: "*"
}
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testImplementation "org.amshove.kluent:kluent:$kluentVersion"
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttpVersion"
testImplementation "com.h2database:h2:$h2Version"
testImplementation "io.mockk:mockk:$mockkVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testRuntimeOnly "net.bytebuddy:byte-buddy:$byteBuddyVersion"
}
sourceSets {
test {
resources {
srcDir "$buildDir/testkit"
}
}
}
jacoco {
toolVersion = jacocoVersion
}
kotlin {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(project.ext.javaVersion.majorVersion)
}
}
tasks.withType(KotlinCompile).all {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
allWarningsAsErrors = true
jvmTarget = project.ext.javaVersion
}
}
// Generates a Gradle properties file with the jacoco javaagent as a jvmarg for Gradle runner tests.
// This allows to generate coverage for code run in the forked JVM.
task generateTestkitFiles {
def jacocoJar = configurations[JacocoPlugin.AGENT_CONFIGURATION_NAME].asPath.toString()
def jacocoAgentJar = new JacocoAgentJar(project.services.get(FileOperations)).tap {
agentConf = project.files(jacocoJar)
}
def javaagent = jacocoAgentJar.getJar()
def destfile = new File(buildDir, "jacoco/testkit.exec")
def jvmArgs = "org.gradle.jvmargs=-javaagent:$javaagent=destfile=$destfile".replace("\\", "\\\\")
def outputDir = file("$buildDir/testkit")
inputs.files jacocoJar
outputs.dir outputDir
doLast {
outputDir.mkdirs()
file("$outputDir/testkit-gradle.properties").text = jvmArgs
}
}
test {
useJUnitPlatform()
dependsOn generateTestkitFiles
finalizedBy jacocoTestReport
}
jacocoTestReport {
getExecutionData().setFrom(fileTree(buildDir).include("/jacoco/*.exec"))
}
tasks.named("processTestResources") {
dependsOn generateTestkitFiles
}
ktlint {
disabledRules = ["import-ordering"]
reporters {
reporter ReporterType.CHECKSTYLE
}
}
detekt {
config = files("${rootProject.projectDir}/detekt.yml")
input = files("$projectDir/src/main/kotlin")
buildUponDefaultConfig = true
}
dokkaHtml {
outputDirectory.set(javadoc.destinationDir)
dokkaSourceSets {
configureEach {
jdkVersion.set(8)
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(new URL("https://github.com/SmartsquareGmbH/squit/blob/master/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
externalDocumentationLink {
url.set(new URL("https://dom4j.github.io/javadoc/$dom4jVersion/"))
}
externalDocumentationLink {
url.set(new URL("https://lightbend.github.io/config/latest/api/"))
}
externalDocumentationLink {
url.set(new URL("https://www.javadoc.io/doc/com.google.code.gson/gson/$gsonVersion/com.google.gson/"))
}
}
}
}
dependencyUpdates {
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}
static def isNonStable(String version) {
def stableKeyword = ["RELEASE", "FINAL", "GA"].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.withType(Javadoc).all {
it.dependsOn dokkaHtml
}
gradlePlugin {
website = "https://github.com/SmartsquareGmbH/squit"
vcsUrl = "https://github.com/SmartsquareGmbH/squit"
plugins {
squit {
displayName = "Squit"
id = "de.smartsquare.squit"
implementationClass = "de.smartsquare.squit.SquitPlugin"
description = "Gradle plugin for simple testing of JSON/XML/SOAP/etc APIs."
tags.set(["testing", "soap", "xml" ,"automation"])
}
}
}
wrapper {
gradleVersion = project.ext.gradleVersion
}