forked from allure-framework/allure-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
251 lines (221 loc) · 8.32 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
import com.diffplug.gradle.spotless.SpotlessExtension
import io.qameta.allure.gradle.AllureExtension
import io.qameta.allure.gradle.task.AllureReport
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
import org.gradle.jvm.tasks.Jar
import ru.vyarus.gradle.plugin.quality.QualityExtension
buildscript {
repositories {
maven("https://plugins.gradle.org/m2/")
mavenLocal()
jcenter()
}
dependencies {
classpath("com.diffplug.spotless:spotless-plugin-gradle:5.5.1")
classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5")
classpath("io.spring.gradle:dependency-management-plugin:1.0.10.RELEASE")
classpath("ru.vyarus:gradle-quality-plugin:4.3.0")
}
}
val linkHomepage by extra("https://qameta.io/allure")
val linkCi by extra("https://ci.qameta.in/job/allure-java_deploy/")
val linkScmUrl by extra("https://github.com/allure-framework/allure-java")
val linkScmConnection by extra("scm:git:git://github.com/allure-framework/allure-java.git")
val linkScmDevConnection by extra("scm:git:ssh://git@github.com:allure-framework/allure-java.git")
val gradleScriptDir by extra("${rootProject.projectDir}/gradle")
val qualityConfigsDir by extra("$gradleScriptDir/quality-configs")
val spotlessDtr by extra("$qualityConfigsDir/spotless")
tasks.withType(Wrapper::class) {
gradleVersion = "6.6.1"
}
plugins {
java
`java-library`
id("net.researchgate.release") version "2.8.1"
id("io.qameta.allure") version "2.8.1"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType(JavaCompile::class) {
options.encoding = "UTF-8"
}
release {
tagTemplate = "\${version}"
}
val afterReleaseBuild by tasks.existing
configure(listOf(rootProject)) {
description = "Allure Java"
group = "io.qameta.allure"
}
configure(subprojects) {
val project = this
group = "io.qameta.allure"
version = version
apply(plugin = "java")
apply(plugin = "java-library")
apply(plugin = "maven")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "ru.vyarus.quality")
apply(plugin = "com.diffplug.spotless")
apply(plugin = "io.qameta.allure")
apply(from = "$gradleScriptDir/bintray.gradle")
apply(from = "$gradleScriptDir/maven-publish.gradle")
configure<DependencyManagementExtension> {
imports {
mavenBom("com.fasterxml.jackson:jackson-bom:2.11.2")
mavenBom("org.junit:junit-bom:5.7.0")
}
dependencies {
dependency("com.github.tomakehurst:wiremock:2.27.2")
dependency("com.google.inject:guice:4.2.3")
dependency("com.google.testing.compile:compile-testing:0.18")
dependency("com.squareup.retrofit2:retrofit:2.9.0")
dependency("commons-io:commons-io:2.8.0")
dependency("io.github.benas:random-beans:3.9.0")
dependency("io.github.glytching:junit-extensions:2.4.0")
dependency("org.apache.commons:commons-lang3:3.11")
dependency("org.apache.httpcomponents:httpclient:4.5.12")
dependency("org.apache.tika:tika-core:1.24.1")
dependency("org.aspectj:aspectjrt:1.9.6")
dependency("org.aspectj:aspectjweaver:1.9.6")
dependency("org.assertj:assertj-core:3.17.2")
dependency("org.codehaus.groovy:groovy-all:2.5.13")
dependency("org.freemarker:freemarker:2.3.30")
dependency("org.jboss.resteasy:resteasy-client:4.5.6.Final")
dependency("org.jooq:joor-java-8:0.9.13")
dependency("org.mock-server:mockserver-netty:5.11.1")
dependency("org.mockito:mockito-core:3.5.10")
dependencySet("org.slf4j:1.7.30") {
entry("slf4j-api")
entry("slf4j-nop")
entry("slf4j-simple")
}
}
}
tasks.compileJava {
options.encoding = "UTF-8"
}
tasks.compileTestJava {
options.encoding = "UTF-8"
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)
}
}
}
configure<QualityExtension> {
configDir = qualityConfigsDir
checkstyleVersion = "8.36.1"
pmdVersion = "6.27.0"
spotbugsVersion = "4.1.2"
codenarcVersion = "1.6"
enabled = !project.hasProperty("disableQuality")
afterEvaluate {
val spotbugs = configurations.findByName("spotbugs")
if (spotbugs != null) {
dependencies {
spotbugs("org.slf4j:slf4j-simple")
spotbugs("com.github.spotbugs:spotbugs:3.1.12")
}
}
}
}
configure<SpotlessExtension> {
java {
target("src/**/*.java")
removeUnusedImports()
@Suppress("INACCESSIBLE_TYPE")
licenseHeaderFile("$spotlessDtr/header.java", "(package|import|open|module|//startfile)")
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")
}
scala {
target("src/**/*.scala")
@Suppress("INACCESSIBLE_TYPE")
licenseHeaderFile("$spotlessDtr/header.java", "(package|//startfile)")
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")
}
groovy {
target("src/**/*.groovy")
@Suppress("INACCESSIBLE_TYPE")
licenseHeaderFile("$spotlessDtr/header.java", "(package|//startfile) ")
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")
}
format("misc") {
target(
"*.gradle",
"*.gitignore",
"README.md",
"CONTRIBUTING.md",
"config/**/*.xml",
"src/**/*.xml"
)
trimTrailingWhitespace()
endWithNewline()
}
encoding("UTF-8")
}
configure<AllureExtension> {
autoconfigure = false
aspectjweaver = false
}
val sourceJar by tasks.creating(Jar::class) {
from(sourceSets.getByName("main").allSource)
archiveClassifier.set("sources")
}
val javadocJar by tasks.creating(Jar::class) {
from(tasks.getByName("javadoc"))
archiveClassifier.set("javadoc")
}
tasks.withType(Javadoc::class) {
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
}
artifacts.add("archives", sourceJar)
artifacts.add("archives", javadocJar)
val bintrayUpload by tasks.existing
afterReleaseBuild {
dependsOn(bintrayUpload)
}
repositories {
jcenter()
mavenLocal()
}
}
allure {
version = "2.13.5"
autoconfigure = false
aspectjweaver = false
}
val aggregatedReport by tasks.creating(AllureReport::class) {
clean = true
resultsDirs = subprojects.map { file("${it.buildDir}/allure-results") }.filter { it.exists() }
}