forked from testng-team/testng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
231 lines (207 loc) · 6.64 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
object This {
val version = "7.1.1-SNAPSHOT"
val artifactId = "testng"
val groupId = "org.testng"
val description = "Testing framework for Java"
val url = "https://testng.org"
val scm = "github.com/cbeust/testng"
// Should not need to change anything below
val issueManagementUrl = "https://$scm/issues"
}
allprojects {
group = This.groupId
version = This.version
apply<MavenPublishPlugin>()
tasks.withType<Javadoc> {
excludes.add("org/testng/internal/**")
}
}
buildscript {
repositories {
jcenter()
mavenCentral()
maven { setUrl("https://plugins.gradle.org/m2") }
}
dependencies {
classpath("org.hibernate.build.gradle:version-injection-plugin:1.0.0")
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
repositories {
jcenter()
mavenCentral()
maven { setUrl("https://plugins.gradle.org/m2") }
}
plugins {
java
`java-library`
`maven-publish`
signing
groovy
id("org.sonarqube").version("2.8")
id("com.jfrog.bintray").version("1.8.3") // Don't use 1.8.4, crash when publishing
}
dependencies {
listOf("com.google.code.findbugs:jsr305:3.0.1").forEach {
compileOnly(it)
}
listOf("com.beust:jcommander:1.78",
"org.apache.ant:ant:1.10.3",
"junit:junit:4.12",
"com.google.inject:guice:4.2.2:no_aop",
"org.yaml:snakeyaml:1.21").forEach {
api(it)
}
listOf("org.apache.ant:ant-testutil:1.10.3",
"org.assertj:assertj-core:3.10.0",
"org.codehaus.groovy:groovy-all:2.4.7",
"org.spockframework:spock-core:1.0-groovy-2.4",
"org.apache-extras.beanshell:bsh:2.0b6",
"org.mockito:mockito-core:2.12.0",
"org.jboss.shrinkwrap:shrinkwrap-api:1.2.6",
"org.jboss.shrinkwrap:shrinkwrap-impl-base:1.2.6").forEach {
testImplementation(it)
}
}
tasks.jar {
manifest {
attributes(
"Bundle-License" to "https://apache.org/licenses/LICENSE-2.0",
"Bundle-Description" to "TestNG is a testing framework.",
"Import-Package" to """
"bsh.*;version="[2.0.0,3.0.0)";resolution:=optional",
"com.beust.jcommander.*;version="[1.7.0,3.0.0)";resolution:=optional",
"com.google.inject.*;version="[1.2,1.3)";resolution:=optional",
"junit.framework;version="[3.8.1, 5.0.0)";resolution:=optional",
"org.junit.*;resolution:=optional",
"org.apache.tools.ant.*;version="[1.7.0, 2.0.0)";resolution:=optional",
"org.yaml.*;version="[1.6,2.0)";resolution:=optional",
"!com.beust.testng",
"!org.testng.*",
"!com.sun.*",
"*"
""",
"Automatic-Module-Name" to "org.testng"
)
}
}
tasks.register<Copy>("filter") {
from("src/main/resources/Version.java")
into("src/main/java/org/testng/internal")
expand("VERSION" to This.version)
}
tasks["compileJava"].dependsOn("filter")
tasks.test {
useTestNG() {
suiteXmlFiles.add(File("src/test/resources/testng.xml"))
listeners.add("org.testng.reporters.FailedInformationOnConsoleReporter")
testLogging.showStandardStreams = true
systemProperties = mapOf("test.resources.dir" to "build/resources/test")
maxHeapSize = "1500m"
}
}
tasks.withType<Test> {
maxParallelForks = Runtime.getRuntime().availableProcessors().div(2)
}
sonarqube {
properties {
property("sonar.host.url", "https://sonarcloud.io/")
property("sonar.github.repository", "cbeust/testng")
property("sonar.github.login", "testng-bot")
}
}
//
// Releases:
// ./gradlew bintrayUpload (to JCenter)
// ./gradlew publish (to Sonatype, then go to https://oss.sonatype.org/index.html#stagingRepositories to publish)
//
bintray {
user = project.findProperty("bintrayUser")?.toString()
key = project.findProperty("bintrayApiKey")?.toString()
dryRun = false
publish = true
setPublications("custom")
with(pkg) {
repo = "maven"
name = This.artifactId
with(version) {
name = This.version
desc = This.description
with(gpg) {
sign = true
}
}
}
}
val sourcesJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles sources JAR"
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}
val javadocJar by tasks.creating(Jar::class) {
from(tasks.javadoc)
archiveClassifier.set("javadoc")
}
with(publishing) {
publications {
create<MavenPublication>("custom") {
groupId = This.groupId
artifactId = This.artifactId
version = project.version.toString()
afterEvaluate {
from(components["java"])
}
artifact(sourcesJar)
artifact(javadocJar)
pom {
name.set(This.artifactId)
description.set(This.description)
url.set(This.url)
licenses {
license {
name.set("Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
issueManagement {
system.set("Github")
url.set(This.issueManagementUrl)
}
developers {
developer {
id.set("cbeust")
name.set("Cedric Beust")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://${This.scm}.git")
url.set("https://${This.scm}")
}
}
}
}
repositories {
maven {
name = "sonatype"
url = if (This.version.contains("SNAPSHOT"))
uri("https://oss.sonatype.org/content/repositories/snapshots/") else
uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = project.findProperty("sonatypeUser") as? String
password = project.findProperty("sonatypePassword") as? String
}
}
maven {
name = "myRepo"
url = uri("file://$buildDir/repo")
}
}
}
with(signing) {
sign(publishing.publications.getByName("custom"))
}