forked from selenide/selenide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
265 lines (225 loc) · 7.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
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
buildscript {
repositories { jcenter() }
dependencies {
classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.1.9'
classpath 'de.undercouch:gradle-download-task:2.1.0'
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: "jacoco"
apply plugin: 'findbugs'
apply plugin: 'checkstyle'
apply plugin: 'de.undercouch.download'
group='com.codeborne'
archivesBaseName = 'selenide'
version='3.4-SNAPSHOT'
[compileJava, compileTestJava]*.options.collect {options -> options.encoding = 'UTF-8'}
[compileJava, compileTestJava]*.options.collect {options -> options.debug = true}
compileJava.options.debugOptions.debugLevel = "source,lines,vars"
sourceCompatibility = 1.7
targetCompatibility = 1.7
defaultTasks 'check', 'test', 'install'
repositories {
mavenCentral()
}
configurations {
provided
compile.extendsFrom provided
}
dependencies {
compile('org.seleniumhq.selenium:selenium-java:2.52.0') {
exclude group: 'org.seleniumhq.selenium', module: 'selenium-htmlunit-driver'
exclude group: 'org.seleniumhq.selenium', module: 'selenium-android-driver'
exclude group: 'org.seleniumhq.selenium', module: 'selenium-iphone-driver'
exclude group: 'org.seleniumhq.selenium', module: 'selenium-safari-driver'
exclude group: 'org.webbitserver', module: 'webbit'
exclude group: 'commons-codec', module: 'commons-codec'
exclude group: 'cglib', module: 'cglib-nodep'
}
runtime('com.codeborne:phantomjsdriver:1.2.1') {
exclude group: 'org.seleniumhq.selenium', module: 'selenium-java'
exclude group: 'org.seleniumhq.selenium', module: 'selenium-remote-driver'
}
compile 'com.google.guava:guava:19.0'
runtime 'commons-codec:commons-codec:1.10'
provided group: 'org.seleniumhq.selenium', name: 'selenium-htmlunit-driver', version: '2.52.0', transitive: false
provided group: 'net.sourceforge.htmlunit', name: 'htmlunit', version: '2.19', transitive: false
testRuntime group: 'net.sourceforge.htmlunit', name: 'htmlunit', version: '2.19'
provided 'junit:junit:4.12'
provided 'org.testng:testng:6.9.10'
// For BrowserMob Proxy:
testCompile group: 'net.lightbody.bmp', name: 'browsermob-proxy', version: '2.0.0', transitive: false
testRuntime group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.16'
testRuntime group: 'net.sf.uadetector', name: 'uadetector-resources', version: '2014.10'
testRuntime 'com.fasterxml.jackson.core:jackson-databind:2.7.1-1'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.eclipse.jetty:jetty-server:9.2.13.v20150730'
testCompile 'org.eclipse.jetty:jetty-servlet:9.2.13.v20150730'
testCompile 'commons-fileupload:commons-fileupload:1.3.1'
}
task libs(type: Sync) {
from configurations.compile
from configurations.runtime
from configurations.testCompile
from configurations.testRuntime
into "$buildDir/lib"
}
compileJava.dependsOn libs
findbugs {
toolVersion = "3.0.1"
sourceSets = [sourceSets.main]
effort = "max"
reportsDir = file("$project.buildDir/reports/findbugs")
excludeFilter = file("$rootProject.projectDir/config/findbugs/excludeFilter.xml")
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
task checkstyleHtmlMain << {
ant.xslt(in: checkstyleMain.reports.xml.destination,
style: file('config/checkstyle/checkstyle-noframes-sorted.xsl'),
out: new File(checkstyleMain.reports.xml.destination.parent, 'main.html'))
}
task checkstyleHtmlTest << {
ant.xslt(in: checkstyleTest.reports.xml.destination,
style: file('config/checkstyle/checkstyle-noframes-sorted.xsl'),
out: new File(checkstyleTest.reports.xml.destination.parent, 'test.html'))
}
checkstyleMain.finalizedBy checkstyleHtmlMain
checkstyleTest.finalizedBy checkstyleHtmlTest
jacoco {
toolVersion = "0.7.6.201602180812"
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/reports/jacocoHtml"
}
}
apply plugin: 'info.solidsoft.pitest'
pitest {
targetClasses = ["com.codeborne.selenide*"]
timestampedReports = false
threads = 4
outputFormats = ['XML', 'HTML']
enableDefaultIncrementalAnalysis = true
}
test {
include 'com/codeborne/selenide/**/*'
}
import de.undercouch.gradle.tasks.download.Download
task downloadIEDriverZip(type: Download) {
src 'http://selenium-release.storage.googleapis.com/2.52/IEDriverServer_Win32_2.52.0.zip'
dest new File(buildDir, 'IEDriverServer.zip')
quiet false
overwrite true
onlyIfNewer true
compress false
println "Download IE driver: " + src
}
task downloadAndUnzipIEDriver(dependsOn: downloadIEDriverZip, type: Copy) {
println "Unzip IE driver: " + downloadIEDriverZip.dest
from zipTree(downloadIEDriverZip.dest)
into buildDir
}
task ie(type: Test, dependsOn: downloadAndUnzipIEDriver) {
println 'Use IE driver: ' + buildDir + '/IEDriverServer.exe'
systemProperties['selenide.browser'] = 'ie'
systemProperties['webdriver.ie.driver'] = new File(buildDir, 'IEDriverServer.exe')
systemProperties['selenide.timeout'] = '8000'
include 'integration/**/*'
exclude '**/AlertText.*'
exclude '**/ConfirmTest.*'
exclude 'com/codeborne/selenide/**/*'
}
import org.gradle.internal.os.OperatingSystem;
task downloadChromeDriverZip(type: Download) {
if (OperatingSystem.current().isMacOsX()) {
src 'http://chromedriver.storage.googleapis.com/2.21/chromedriver_mac32.zip'
}
else if (OperatingSystem.current().isLinux()) {
src 'http://chromedriver.storage.googleapis.com/2.21/chromedriver_linux64.zip'
}
else {
src 'http://chromedriver.storage.googleapis.com/2.21/chromedriver_win32.zip'
}
dest new File(buildDir, 'chromedriver.zip')
quiet false
overwrite true
onlyIfNewer true
compress false
println "Download Chrome driver: " + src + " to " + dest
}
task downloadAndUnzipChromeDriver(dependsOn: downloadChromeDriverZip, type: Copy) {
println "Unzip Chrome driver: " + downloadChromeDriverZip.dest
from zipTree(downloadChromeDriverZip.dest)
into buildDir
}
task chrome(type: Test, dependsOn: downloadAndUnzipChromeDriver) {
println 'Use Chrome driver: ' + buildDir + '/chromedriver'
systemProperties['selenide.browser'] = 'chrome'
systemProperties['webdriver.chrome.driver'] = new File(buildDir, 'chromedriver')
include 'integration/**/*'
exclude 'com/codeborne/selenide/**/*'
}
task htmlunit(type: Test) {
systemProperties['selenide.browser'] = 'htmlunit'
include 'integration/**/*'
exclude 'com/codeborne/selenide/**/*'
}
task phantomjs(type: Test) {
systemProperties['selenide.browser'] = 'phantomjs'
include 'integration/**/*'
exclude 'com/codeborne/selenide/**/*'
}
task firefox(type: Test) {
systemProperties['selenide.browser'] = 'firefox'
include 'integration/**/*'
exclude 'com/codeborne/selenide/**/*'
}
tasks.withType(Test).all { testTask ->
testTask.systemProperties['file.encoding'] = 'UTF-8'
testTask.testLogging.showStandardStreams = true
testTask.systemProperties['BUILD_URL'] = System.getenv()['BUILD_URL']
testTask.maxParallelForks = 2
testTask.jacoco {
enabled = true
includes = ['com/codeborne/selenide/**/*']
}
testTask.outputs.upToDateWhen { false }
}
task allTests(dependsOn: ['clean', 'test', 'chrome', 'firefox', 'htmlunit', 'phantomjs']) {}
jar {
manifest {
attributes(
"Implementation-Title": project.group + '.' + project.name,
"Implementation-Version": version,
"Implementation-Vendor": "Codeborne")
}
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
javadoc {
failOnError=false
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
task wrapper(type: Wrapper) {
gradleVersion = '2.11'
jarFile = './gradle-wrapper/gradle-wrapper.jar'
scriptFile = './gradle'
}