-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.gradle
249 lines (216 loc) · 7.27 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
//import net.serenitybdd.builds.ProjectVersionCounter
/**
* To build a release version with the same version number as the serenity core dependency:
* gradle build -PcoreRelease
* To build a release with a specific version number, use:
* gradle build -PnextVersion=1.2.3
*
* To upload a new release to Nexus:
* gradle clean uploadArchives -PcoreRelease
*
* Requirement environment variables:
* - OSSRHUSERNAME - Nexus username
* - OSSRHPASSWORD - Nexus password
*/
plugins {
/// XXX - 2022-05-10: id 'com.gradle.plugin-publish' version '1.0.0-rc-1' requires changes
// not documented yet. See https://github.com/gradle/gradle/issues/20718
id 'com.gradle.plugin-publish' version '0.21.0'
id 'java-gradle-plugin'
// Building
id 'java'
id 'groovy'
id 'maven-publish'
// Signing
id 'signing'
// Deploying
id 'io.codearte.nexus-staging' version '0.30.0'
}
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/groups/public"
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
// test classes require java 17
tasks.named("compileTestJava", JavaCompile) {
javaCompiler = javaToolchains.compilerFor { languageVersion = JavaLanguageVersion.of(17) }
}
tasks.withType(Test) {
javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(17) }
}
//signing {
// def signingKey = findProperty("signingKey")
// def signingPassword = findProperty("signingPassword")
// useInMemoryPgpKeys(signingKey, signingPassword)
// sign configurations.archives
//}
signing {
def signingKeyId = findProperty("signingKeyId")
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign configurations.archives
}
ext {
projectDescription = 'Serenity Gradle Plugin'
if (!project.hasProperty("nextVersion")) {
if (project.hasProperty("coreRelease")) {
ext.nextVersion = "${serenityCoreVersion}"
} else {
ext.nextVersion = "${serenityCoreVersion}-SNAPSHOT"
}
}
}
group = 'net.serenity-bdd'
archivesBaseName = "serenity-gradle-plugin"
version = nextVersion
println "BUILDING VERSION ${nextVersion}"
task createNewVersionTag(type: Exec) {
executable "sh"
args "-c", "git tag -f -a v$nextVersion -m'release tag'"
}
task pushVersionTag(type: Exec, dependsOn: 'createNewVersionTag') {
executable "sh"
args "-c", "git push -f origin v$nextVersion"
}
task tagNewVersion() {
dependsOn pushVersionTag
}
wrapper {
gradleVersion = '7.4.2'
distributionType = 'all'
}
test {
useJUnitPlatform()
maxParallelForks = Runtime.runtime.availableProcessors() * 4
}
configurations.all {
resolutionStrategy {
// fail fast on dependency convergence problems
// failOnVersionConflict()
force "commons-collections:commons-collections:${commonsCollectionsVersion}",
"xml-apis:xml-apis:${xmlApiVersion}",
"commons-codec:commons-codec:${commonsCodecVersion}",
"com.google.code.gson:gson:${gsonVersion}"
}
}
dependencies {
implementation("net.serenity-bdd:serenity-core:${serenityCoreVersion}")
implementation("net.serenity-bdd:serenity-model:${serenityCoreVersion}")
implementation("net.serenity-bdd:serenity-junit:${serenityCoreVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.0")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.0")
testImplementation("org.assertj:assertj-core:3.25.3")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.0")
}
jar {
manifest {
attributes("Implementation-Title": "Serenity Gradle Plugin",
"Implementation-Version": project.version.toString())
}
}
//
//task sourcesJar(type: Jar, dependsOn: classes) {
//// classifier = 'sources'
// from sourceSets.main.allSource
//}
//
//task javadocJar(type: Jar, dependsOn: javadoc) {
//// classifier = 'javadoc'
// from javadoc.destinationDir
//}
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
//artifacts {
// archives sourcesJar, javadocJar
//}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:-options"
}
//mavenPublish {
// useMavenPublish = true
//}
// Build, sign, and upload
//uploadArchives {
// repositories {
// mavenDeployer {
// // Sign POM
// beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
//
// // Destination
// repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
// authentication(userName: System.getenv("OSSRHUSERNAME"), password: System.getenv("OSSRHPASSWORD"))
// }
// snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
// authentication(userName: System.getenv("OSSRHUSERNAME"), password: System.getenv("OSSRHPASSWORD"))
// }
//
// // Add required metadata to POM
// pom.project {
// name 'Serenity BDD Cucumber 6 Integration'
// packaging 'jar'
// description 'Run Serenity tests and generate Serenity reports using Cucumber 6'
// url 'https://github.com/serenity-bdd/serenity-cucumber6'
//
// scm {
// connection 'scm:git:git://github.com/serenity-bdd/serenity-cucumber6.git'
// developerConnection 'scm:git:ssh://github.com/serenity-bdd/serenity-cucumber6'
// url 'https://github.com/serenity-bdd/serenity-cucumber6/tree/master'
// }
//
// licenses {
// license {
// name 'The Apache License, Version 2.0'
// url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
// }
// }
//
// developers {
// developer {
// id 'johnsmart'
// name 'John Ferguson Smart'
// email '[email protected]'
// }
// developer {
// id "cliviu"
// name "Liviu Carausu"
// email '[email protected]'
// }
// }
// }
// }
// }
//}
//nexusStaging {
// packageGroup = "net.serenity-bdd"
// stagingProfileId = "88ab355676248c"
//}
//task copyDeps(type: Copy) {
// from configurations.runtime + configurations.testCompile
// into project.projectDir.path + "/lib"
//}
gradlePlugin {
plugins {
serenityPlugin {
id = 'net.serenity-bdd.serenity-gradle-plugin'
implementationClass = 'net.serenitybdd.plugins.gradle.SerenityPlugin'
}
}
}
pluginBundle {
website = 'https://www.serenity-bdd.info/'
vcsUrl = 'https://github.com/serenity-bdd/serenity-gradle-plugin'
description = 'Serenity Gradle Plugin'
tags = ['serenity-bdd', 'test-automation']
plugins {
serenityPlugin {
// id is captured from java-gradle-plugin configuration
displayName = 'Gradle Serenity BDD plugin'
}
}
}