forked from serenity-bdd/serenity-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
207 lines (173 loc) · 5.77 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
//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 {
// Building
id 'java'
id 'groovy'
// Signing
id 'signing'
// Deploying
id 'maven'
id 'io.codearte.nexus-staging' version '0.22.0'
id "com.gradle.plugin-publish" version "0.12.0"
id "java-gradle-plugin"
}
repositories {
mavenCentral()
mavenLocal()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
//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 = '6.4'
}
test {
include '**/When*'
include '**/Cucumber*'
include '**/ScenarioLineCount*'
exclude '**/*$*'
exclude '**/integration/**'
exclude '**/samples/**'
exclude '**/*Sample*'
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 {
compile("net.serenity-bdd:serenity-core:${serenityCoreVersion}")
compile("net.serenity-bdd:serenity-model:${serenityCoreVersion}")
compile("net.serenity-bdd:serenity-junit:${serenityCoreVersion}")
}
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"
}
// 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"
}