forked from allure-framework/allure2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
312 lines (281 loc) · 10.6 KB
/
build.gradle.kts
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import java.nio.charset.StandardCharsets.UTF_8
val linkHomepage by extra("https://qameta.io/allure")
val linkCi by extra("https://ci.qameta.io/job/allure2")
val linkScmUrl by extra("https://github.com/allure-framework/allure2")
val linkScmConnection by extra("scm:git:git://github.com/allure-framework/allure2.git")
val linkScmDevConnection by extra("scm:git:ssh://[email protected]:allure-framework/allure2.git")
val root = rootProject.projectDir
val gradleScriptDir by extra("$root/gradle")
val qualityConfigsDir by extra("$gradleScriptDir/quality-configs")
val spotlessDtr by extra("$qualityConfigsDir/spotless")
tasks.wrapper {
gradleVersion = "7.2"
}
plugins {
java
`java-library`
`maven-publish`
signing
id("com.bmuschko.docker-remote-api") version "6.7.0"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("com.diffplug.spotless") version "6.9.1"
id("com.gorylenko.gradle-git-properties") version "2.4.1"
id("io.spring.dependency-management") version "1.0.13.RELEASE"
id("ru.vyarus.quality") version "4.7.0"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
allprojects {
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
}
description = "Allure Report"
group = "io.qameta.allure"
nexusPublishing {
repositories {
sonatype()
}
}
subprojects {
group = if (project.name.endsWith("plugin")) {
"io.qameta.allure.plugins"
} else {
"io.qameta.allure"
}
version = version
apply(plugin = "java")
apply(plugin = "signing")
apply(plugin = "maven-publish")
apply(plugin = "ru.vyarus.quality")
apply(plugin = "com.diffplug.spotless")
apply(plugin = "io.spring.dependency-management")
dependencyManagement {
imports {
mavenBom("com.fasterxml.jackson:jackson-bom:2.13.3")
mavenBom("org.junit:junit-bom:5.9.0")
mavenBom("io.qameta.allure:allure-bom:2.18.1")
}
dependencies {
dependency("ch.qos.logback:logback-classic:1.2.11")
dependency("com.beust:jcommander:1.82")
dependency("com.github.spotbugs:spotbugs-annotations:4.7.1")
dependency("com.opencsv:opencsv:4.6")
dependency("commons-beanutils:commons-beanutils:1.9.4")
dependency("commons-io:commons-io:2.11.0")
dependency("javax.xml.bind:jaxb-api:2.3.1")
dependency("org.allurefw:allure1-model:1.0")
dependency("org.apache.commons:commons-lang3:3.12.0")
dependency("org.apache.httpcomponents:httpclient:4.5.13")
dependency("org.apache.tika:tika-core:2.4.1")
dependency("org.assertj:assertj-core:3.23.1")
dependency("org.eclipse.jetty:jetty-server:9.4.43.v20210629")
dependency("org.freemarker:freemarker:2.3.31")
dependency("org.mockito:mockito-core:4.6.1")
dependency("org.projectlombok:lombok:1.18.24")
dependency("org.zeroturnaround:zt-zip:1.15")
dependencySet("org.slf4j:1.7.32") {
entry("slf4j-api")
entry("slf4j-nop")
entry("slf4j-simple")
}
dependencySet("com.squareup.retrofit2:2.6.1") {
entry("converter-jackson")
entry("retrofit")
}
dependencySet("com.vladsch.flexmark:0.62.2") {
entry("flexmark")
entry("flexmark-ext-tables")
}
}
}
tasks.compileTestJava {
options.compilerArgs.add("-parameters")
}
tasks.jar {
manifest {
attributes(mapOf(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
))
}
}
tasks.test {
systemProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug")
systemProperty("allure.model.indentOutput", "true")
systemProperty("junit.jupiter.execution.parallel.enabled", true)
systemProperty("junit.jupiter.execution.parallel.mode.default", true)
testLogging {
listOf(org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED)
}
maxHeapSize = project.property("test.maxHeapSize").toString()
maxParallelForks = Integer.parseInt(project.property("test.maxParallelForks") as String)
}
tasks.processTestResources {
filesMatching("**/allure.properties") {
filter {
it.replace("#project.description#", project.description ?: project.name)
}
}
}
quality {
configDir = "$gradleScriptDir/quality-configs"
excludeSources = fileTree("build/generated-sources")
exclude("**/*.json")
checkstyleVersion = "8.36.1"
pmdVersion = "6.28.0"
spotbugsVersion = "4.1.2"
codenarcVersion = "1.6"
spotbugs = true
codenarc = true
pmd = true
checkstyle = true
htmlReports = false
afterEvaluate {
val spotbugs = configurations.findByName("spotbugs")
if (spotbugs != null) {
dependencies {
spotbugs("org.slf4j:slf4j-simple")
spotbugs("com.github.spotbugs:spotbugs:4.7.1")
}
}
}
}
spotless {
java {
target("src/**/*.java")
removeUnusedImports()
importOrder("", "jakarta", "javax", "java", "\\#")
licenseHeader(file("$spotlessDtr/allure.java.license").readText(UTF_8))
endWithNewline()
replaceRegex("one blank line after package line", "(package .+;)\n+import", "$1\n\nimport")
replaceRegex("one blank line after import lists", "(import .+;\n\n)\n+", "$1")
replaceRegex("no blank line between jakarta & javax", "(import jakarta.+;\n)\n+(import javax.+;\n)", "$1$2")
replaceRegex("no blank line between javax & java", "(import javax.+;\n)\n+(import java.+;\n)", "$1$2")
replaceRegex("no blank line between jakarta & java", "(import jakarta.+;\n)\n+(import java.+;\n)", "$1$2")
}
format("misc") {
target(
"*.gradle",
"*.gitignore",
"README.md",
"CONTRIBUTING.md",
"config/**/*.xml",
"src/**/*.xml"
)
trimTrailingWhitespace()
endWithNewline()
}
encoding("UTF-8")
}
java {
withJavadocJar()
withSourcesJar()
}
tasks.withType<Javadoc>().configureEach {
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
}
tasks.withType<GenerateModuleMetadata>().configureEach {
enabled = false
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
suppressAllPomMetadataWarnings()
pom {
name.set(project.name)
description.set("Module ${project.name} of Allure Framework.")
url.set("https://github.com/allure-framework/allure2")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("baev")
name.set("Dmitry Baev")
email.set("[email protected]")
}
developer {
id.set("eroshenkoam")
name.set("Artem Eroshenko")
email.set("[email protected]")
}
}
scm {
developerConnection.set("scm:git:git://github.com/allure-framework/allure2")
connection.set("scm:git:git://github.com/allure-framework/allure2")
url.set("https://github.com/allure-framework/allure2")
}
issueManagement {
system.set("GitHub Issues")
url.set("https://github.com/allure-framework/allure2/issues")
}
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
}
}
}
}
// Developers do not always have PGP configured,
// so activate signing for release versions only
// Just in case Maven Central rejects signed snapshots for some reason
if (!version.toString().endsWith("-SNAPSHOT")) {
signing {
sign(publishing.publications["maven"])
}
}
val allurePlugin by configurations.creating {
isCanBeResolved = true
isCanBeConsumed = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named("allure-plugin"))
}
}
val pluginsDir = "$buildDir/plugins/"
val copyPlugins by tasks.creating(Sync::class) {
group = "Build"
dependsOn(allurePlugin)
into(pluginsDir)
from(provider { allurePlugin.map { if (it.isDirectory) it else zipTree(it) } })
eachFile {
val segments = relativePath.segments
segments[0] = segments[0].replace("-${project.version}", "")
}
includeEmptyDirs = false
}
repositories {
mavenLocal()
mavenCentral()
}
}
apply(plugin = "com.bmuschko.docker-remote-api")
val deleteDemoReport by tasks.creating(Delete::class) {
group = "Build"
delete("$root/build/docker/report")
}
val generateDemoReport by tasks.creating(Exec::class) {
group = "Build"
dependsOn("deleteDemoReport", "allure-commandline:build")
executable = "$root/allure-commandline/build/install/allure/bin/allure"
args("generate", "$root/allure-web/test-data/demo", "-o", "$root/build/docker/report")
}
val generateDemoDockerfile by tasks.creating(Dockerfile::class) {
group = "Build"
dependsOn("generateDemoReport")
destFile.set(file("build/docker/Dockerfile"))
from("nginx")
addFile("report", "/usr/share/nginx/html")
}