-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
201 lines (169 loc) · 6.17 KB
/
Copy pathbuild.gradle
File metadata and controls
201 lines (169 loc) · 6.17 KB
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
// VisualTestingInKatalonStudio/build.gradle
plugins {
id 'groovy'
id "com.katalon.gradle-plugin" version "0.0.7"
}
version = "2.00.0"
ext {
groovyVersion = '2.4.7'
VT_EXTERNAL_LIBRARY_PREFIX = 'VT-'
VT_DIST_GRADLEW_PREFIX = 'distributable-gradlew'
VT_DIST_COMPONENTS_PREFIX = 'vt-components'
VT_DIST_EXAMPLE_PREFIX = 'vt-example'
materialsVersion = '0.80.2'
}
// ---------------------------------------------------------------------
// codes to import external jar files into the Drivers directory
import java.nio.file.Path
import java.nio.file.Paths
task deleteJarsInDriversDir(type: Delete) {
delete fileTree('Drivers') {
include '**/*.jar'
}
}
def downloadFile = { remoteUrl, localDir = 'Drivers' ->
Path outFile = Paths.get(localDir).resolve("${VT_EXTERNAL_LIBRARY_PREFIX}${remoteUrl.tokenize('/')[-1]}")
outFile.toFile().withOutputStream { out ->
new URL(remoteUrl).withInputStream { from ->
out << from
}
}
println "downloaded ${remoteUrl} into ${localDir} directory as ${outFile.getFileName()}"
}
task downloadJarsIntoDriversDir {
doLast {
downloadFile('https://repo1.maven.org/maven2/ru/yandex/qatools/ashot/ashot/1.5.4/ashot-1.5.4.jar')
downloadFile('https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.6/commons-lang3-3.6.jar')
downloadFile('https://repo1.maven.org/maven2/org/apache/commons/commons-math3/3.6.1/commons-math3-3.6.1.jar')
downloadFile('https://github.com/kazurayam/junit4ks/releases/download/1.6/junit4ks-all.jar')
downloadFile('https://github.com/kazurayam/ksbackyard/releases/download/0.41.0/ksbackyard-0.41.0.jar')
downloadFile('https://github.com/kazurayam/TestObjectExtension/releases/download/0.1.1/TestObjectExtension-0.1.1.jar')
downloadFile("https://github.com/kazurayam/Materials/releases/download/${materialsVersion}/Materials-${materialsVersion}.jar")
downloadFile("https://github.com/kazurayam/ExecutionProfilesLoader/releases/download/1.2.0/ExecutionProfilesLoader-1.2.0.jar")
}
}
task drivers {
dependsOn 'deleteJarsInDriversDir'
dependsOn 'downloadJarsIntoDriversDir'
tasks.findByName('downloadJarsIntoDriversDir').mustRunAfter 'deleteJarsInDriversDir'
}
task driversFromMavenLocal(type: Copy) {
from file("${System.getProperty('user.home')}/.m2/repository/com/kazurayam/Materials/${materialsVersion}/Materials-${materialsVersion}.jar")
into file("$projectDir/Drivers")
}
// ---------------------------------------------------------------------
// codes to generate groovydoc
sourceSets {
main {
groovy {
srcDirs = [ 'Keywords', 'Include/scripts/groovy' ]
srcDir 'Libs'
}
}
}
configurations {
generateDocs
}
repositories {
jcenter()
}
dependencies {
generateDocs "org.codehaus.groovy:groovy-all:${groovyVersion}"
}
task groovydoc(type: Groovydoc, overwrite: true) {
source = sourceSets.main.groovy
classpath = configurations.compile
groovyClasspath = project.configurations.generateDocs
include 'com/kazurayam/visualtesting/*'
exclude '**/*Test.groovy'
}
task publishGroovydoc(type: Copy) {
from 'build/docs/groovydoc'
into 'docs/api'
}
groovydoc.finalizedBy publishGroovydoc
// ---------------------------------------------------------------------
String DIST = "${project.buildDir}/dist"
task createDist {
doLast {
project.mkdir "${DIST}"
}
}
task cleanDist(type: Delete) {
def dirName = "${DIST}"
project.file( dirName).list().each { f ->
delete "${dirName}/${f}"
}
}
cleanDist.dependsOn(createDist)
task createDistributableGradlew(type:Zip) {
archiveFileName = "${VT_DIST_GRADLEW_PREFIX}.zip"
destinationDirectory = file("${DIST}")
from(".") {
// include the Gradle Wrapper
include "gradlew"
include "gradlew.bat"
include "gradlewks.bat" // custom launcher that uses Java in %KATALONSTUDIO_HOME%\jre
include "gradle/**/*"
}
}
task createDistributableGradlewWithVersion {
doLast {
new File("${DIST}/${VT_DIST_GRADLEW_PREFIX}.zip")
.renameTo("${DIST}/${VT_DIST_GRADLEW_PREFIX}-${project.version}.zip")
}
}
createDistributableGradlewWithVersion.dependsOn(createDistributableGradlew)
// tasks to create vt-components-X.X.X.zip
task createVTComponents(type:Zip) {
archiveFileName = "${VT_DIST_COMPONENTS_PREFIX}.zip"
destinationDirectory = file("${DIST}")
from(".") {
// include the Visual Testing components
include "Test Cases/VT/**"
include "Scripts/VT/**"
include "Test Listeners/**/VT*"
include "Test Suites/VT/**"
include "Keywords/com/kazurayam/visualtesting/**"
include "Drivers/**"
}
}
task createVTComponentsWithVersion {
doLast {
new File("${DIST}/${VT_DIST_COMPONENTS_PREFIX}.zip")
.renameTo("${DIST}/${VT_DIST_COMPONENTS_PREFIX}-${project.version}.zip")
}
}
createVTComponentsWithVersion.dependsOn(createVTComponents)
// tasks to create vt-example-X.X.X.zip
task createVTExample(type: Zip) {
archiveFileName = "${VT_DIST_EXAMPLE_PREFIX}.zip"
destinationDirectory = file("${DIST}")
from(".") {
// include the sample Visual Testing for the CURA web site
include "Profiles/CURA*"
include "Test Cases/CURA/**"
include "Object Repository/CURA/**"
include "Test Suites/CURA/**"
include "Scripts/CURA/**"
include "vt-config.json"
include "vt-run-CURA*"
}
}
task createVTExampleWithVersion {
doLast {
new File("${DIST}/${VT_DIST_EXAMPLE_PREFIX}.zip")
.renameTo("${DIST}/${VT_DIST_EXAMPLE_PREFIX}-${project.version}.zip")
}
}
createVTExampleWithVersion.dependsOn(createVTExample)
task distributables() {
dependsOn 'cleanDist'
dependsOn 'createDistributableGradlewWithVersion'
dependsOn 'createVTComponentsWithVersion'
dependsOn 'createVTExampleWithVersion'
tasks.findByName('createDistributableGradlewWithVersion').mustRunAfter 'cleanDist'
tasks.findByName('createVTComponents').mustRunAfter 'cleanDist'
tasks.findByName('createVTExample').mustRunAfter 'cleanDist'
}
defaultTasks = [ 'distributables' ]