-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
222 lines (189 loc) · 5.71 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
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java-library'
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.6'
}
group = 'com.nordstrom.ui-tools'
description = 'Selenium Foundation'
if (!project.hasProperty('profile')) {
ext.profile = 'selenium2'
} else {
assert ['selenium2', 'selenium3'].contains(profile)
}
apply from: "${profile}Deps.gradle"
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.5'
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."
classifier = '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."
classifier = '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
}
test {
dependsOn testNG
reports.html.destination = file("${buildDir}/reports/junit")
testLogging.showStandardStreams = true
}
scmVersion {
hooks {
pre 'fileUpdate', [file: 'README.md', pattern: {v, p -> /<version>)\d+\.\d+\.\d+(-s[23]<\/version>)/}, replacement: {v, p -> "\$1$v\$2"}]
pre 'fileUpdate', [file: 'README.md', pattern: {v, p -> /(selenium-foundation:)\d+\.\d+\.\d+(-s[23])/}, replacement: {v, p -> "\$1$v\$2"}]
pre 'commit'
post 'push'
}
}
artifacts {
archives tasks['sourcesJar']
archives tasks['javadocJar']
}
signing {
sign configurations.archives
}
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'
}
}
}
}
}
}
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 {
api 'com.nordstrom.tools:java-utils:2.1.0'
api 'com.nordstrom.tools:settings:2.3.10'
api 'com.nordstrom.tools:junit-foundation:15.3.4'
api('com.github.sbabcoc:logback-testng:1.3.4') {
exclude group: 'org.testng', module: 'testng'
}
api('org.hamcrest:hamcrest-core') { version { strictly '2.2' } }
api('org.yaml:snakeyaml') { version { strictly '1.28' } }
}
test {
jvmArgs "-javaagent:${classpath.find { it.name.contains('junit-foundation') }.absolutePath}"
}