-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
269 lines (231 loc) · 7.52 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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
import org.gradle.internal.os.OperatingSystem
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java-library'
id 'eclipse'
id 'maven-publish'
id 'jacoco'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'pl.allegro.tech.build.axion-release' version '1.13.14'
}
group = 'com.nordstrom.ui-tools'
description = 'Selenium Foundation'
if (!project.hasProperty('profile')) {
ext.profile = 'selenium4'
} else {
assert ['selenium3', 'selenium4'].contains(profile)
}
apply from: "${profile}Deps.gradle"
if (project.hasProperty('browsers')) {
ext.browsers.split(',').each {
def browser = it.trim()
if (browser) {
apply from: "${browser}Deps.gradle"
}
}
}
if (project.hasProperty('personality')) {
System.setProperty('selenium.browser.name', ext.personality)
}
def archiveVer = null
def verBits = scmVersion.version.split('-')
def seleniumApi = 's' + profile.charAt(8)
if (verBits.length > 1) {
if (verBits[1].equals(seleniumApi)) {
archiveVer = project.version
} else {
archiveVer = verBits[0] + '-' + seleniumApi + '-' + verBits[1]
}
} else {
archiveVer = verBits[0] + '-' + seleniumApi
}
project.version = archiveVer
def archiveBase = rootProject.name + '-' + archiveVer
java {
withJavadocJar()
withSourcesJar()
}
clean {
delete 'logs'
delete 'target'
}
jacoco {
toolVersion = '0.8.8'
reportsDirectory = file("${buildDir}/customJacocoReportDir")
}
//jacocoTestReport {
// reports {
// xml.enabled false
// csv.enabled false
// html.destination file("${buildDir}/jacocoHtml")
// }
//}
jar {
group 'Build'
description "Assembles a jar archive containing the '${profile}' classes, POM and Maven properties."
def destPath = "META-INF/maven/${project.group}/${rootProject.name}"
def timestamp = Long.valueOf(System.currentTimeMillis()).toString()
def pomTokens = [projectVersion: archiveVer, projectTimestamp: timestamp, seleniumApi: seleniumApi]
def propTokens = [projectVersion: archiveVer, projectGroupId: project.group, projectArtifactId: rootProject.name]
from('.') {
include('pom.xml')
into(destPath)
filter(ReplaceTokens, tokens: pomTokens)
}
from('.') {
include('pom.properties')
into(destPath)
filter(ReplaceTokens, tokens: propTokens)
}
archiveFileName = archiveBase + '.jar'
destinationDirectory = libsDir
}
clean {
delete buildRoot
}
sourcesJar {
group 'Build'
description "Assembles a jar archive containing the '${profile}' source files."
archiveClassifier = 'sources'
from sourceSets.main.allSource
archiveFileName = archiveBase + '-sources.jar'
destinationDirectory = libsDir
}
javadocJar {
dependsOn javadoc
group 'Build'
description "Assembles a jar archive containing the '${profile}' JavaDoc files."
archiveClassifier = 'javadoc'
from javadoc.destinationDir
archiveFileName = archiveBase + '-javadoc.jar'
destinationDirectory = libsDir
}
task testNG(type: Test) {
useTestNG()
reports.html.destination = file("${buildDir}/reports/testng")
testLogging.showStandardStreams = true
systemProperty 'selenium.grid.plugins', System.getProperty('selenium.grid.plugins')
systemProperty 'selenium.browser.name', System.getProperty('selenium.browser.name')
systemProperty 'selenium.browser.caps', getBrowserCaps()
systemProperty 'selenium.context.platform', System.getProperty('selenium.context.platform', 'support')
systemProperty 'selenium.grid.examples', System.getProperty('selenium.grid.examples', 'true')
systemProperty 'appium.with.pm2', System.getProperty('appium.with.pm2', 'false')
}
test {
dependsOn testNG
reports.html.destination = file("${buildDir}/reports/junit")
testLogging.showStandardStreams = true
systemProperty 'selenium.grid.plugins', System.getProperty('selenium.grid.plugins')
systemProperty 'selenium.browser.name', System.getProperty('selenium.browser.name')
systemProperty 'selenium.browser.caps', getBrowserCaps()
systemProperty 'selenium.context.platform', System.getProperty('selenium.context.platform', 'support')
systemProperty 'selenium.grid.examples', System.getProperty('selenium.grid.examples', 'true')
systemProperty 'appium.with.pm2', System.getProperty('appium.with.pm2', 'false')
}
scmVersion {
hooks {
pre 'fileUpdate', [file: 'README.md', pattern: {v, p -> /(<version>)\d+\.\d+\.\d+(-s[34]<\/version>)/}, replacement: {v, p -> "\$1$v\$2"}]
pre 'fileUpdate', [file: 'README.md', pattern: {v, p -> /(selenium-foundation:)\d+\.\d+\.\d+(-s[34])/}, replacement: {v, p -> "\$1$v\$2"}]
pre 'commit'
post 'push'
}
}
artifacts {
archives tasks['sourcesJar']
archives tasks['javadocJar']
}
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
pom {
name = 'Selenium Foundation'
groupId = project.group
artifactId = rootProject.name
version = archiveVer
packaging = 'jar'
description = 'Selenium Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium (WebDriver).'
url = 'https://github.com/sbabcoc/Selenium-Foundation'
scm {
connection = 'scm:git:https://github.com/sbabcoc/Selenium-Foundation.git'
developerConnection = 'scm:git:https://github.com/sbabcoc/Selenium-Foundation.git'
url = 'https://github.com/sbabcoc/Selenium-Foundation/tree/master'
tag = 'HEAD'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'scoba'
name = 'Scott Babcock'
email = 'scoba@hotmail.com'
organization = 'Nordstrom'
organizationUrl = 'https://shop.nordstrom.com'
}
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
task install {
dependsOn publishToMavenLocal
group publishToMavenLocal.group
description '[alias] ' + publishToMavenLocal.description
}
nexusPublishing {
packageGroup = 'com.nordstrom'
repositories {
ossrh {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
if (project.hasProperty('ossrhStagingProfileId')) {
stagingProfileId = ossrhStagingProfileId
}
}
}
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://repo1.maven.org/maven2' }
maven { url 'https://repo.maven.apache.org/maven2' }
maven { url "${projectDir}/repo" }
}
dependencies {
constraints {
api 'com.nordstrom.tools:java-utils:3.3.1'
api 'com.nordstrom.tools:settings:3.0.5'
api 'com.nordstrom.tools:junit-foundation:17.1.1'
api 'com.github.sbabcoc:logback-testng:2.0.0'
api 'org.hamcrest:hamcrest-core:2.2'
api 'org.yaml:snakeyaml:1.33'
}
api 'com.nordstrom.tools:java-utils'
api 'com.nordstrom.tools:settings'
api 'com.nordstrom.tools:junit-foundation'
api('com.github.sbabcoc:logback-testng') {
exclude group: 'org.testng', module: 'testng'
}
api 'org.hamcrest:hamcrest-core'
api 'org.yaml:snakeyaml'
}
test {
jvmArgs = [
"-javaagent:${classpath.find { it.name.contains('junit-foundation') }.absolutePath}"
]
}
def getBrowserCaps() {
def browserCaps = System.getProperty('selenium.browser.caps')
if (browserCaps && OperatingSystem.current().isWindows()) {
return browserCaps.replaceAll('"', '\\\\"')
}
return browserCaps
}