forked from dbfit/dbfit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
269 lines (233 loc) · 7.19 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
import org.apache.tools.ant.filters.ReplaceTokens
ext {
dbfitVersion = '4.0.0-SNAPSHOT'
isReleaseVersion = !version.endsWith("SNAPSHOT")
fitSharpVersion = '2.5'
}
task cleanFitnesseroot(type:Exec) {
def gitArgs = ['clean', '-d', '-x', '-f', 'FitNesseRoot/']
gitArgs += keepUncommitedTests() ? ['-e', 'FitNesseRoot/DbFit/'] : []
executable 'git'
args gitArgs
}
task cleanDist {
doLast {
delete 'dist'
delete 'zips'
delete 'docs'
}
}
task copyLocal(dependsOn: [cleanFitnesseroot, cleanDist, ':dbfit-java:assembleAll', ':dbfit-java:libs']) {
doLast {
copy {
from 'LICENSE', 'README.md'
into 'dist'
}
copy {
from 'bin'
include 'encrypt.*'
into 'dist'
}
copy {
from 'templates'
include 'startFitnesse.*'
into 'dist'
rename '(.+)\\.tmpl$', '$1'
filter(ReplaceTokens,
tokens: ['dbfitVersion': dbfitVersion, 'fitNesseVersion': project(':dbfit-java').fitNesseVersion])
}
copy {
from 'files'
into 'dist'
}
copy {
from 'dbfit-java'
include '**/*.jar'
exclude 'build/**/*.jar'
exclude proprietaryLibs()
exclude experimentalItems()
into 'dist/lib'
eachFile {details ->
details.path = flattenPath(details.path)
}
includeEmptyDirs = false
}
}
}
task copyExtraLibs(dependsOn: [copyLocal]) {
doLast {
copy {
from 'dbfit-java'
include proprietaryLibs()
into 'dist/lib'
eachFile {details ->
details.path = flattenPath(details.path)
}
includeEmptyDirs = false
}
copy {
from project(':dbfit-java:derby').configurations.derby
into 'dist/lib'
}
}
}
task copyTestLibs(dependsOn: ':dbfit-java:derby:integrationTestJar') {
doLast {
copy {
from 'dbfit-java'
include '**/*integration-test*.jar'
exclude 'build/**/*.jar'
exclude proprietaryLibs()
exclude experimentalItems()
into 'dist/lib'
eachFile { details ->
details.path = flattenPath(details.path)
}
includeEmptyDirs = false
}
}
}
task copyConnections(dependsOn: [copyLocal]) {
doLast {
subprojects.each { prj ->
if (prj.hasProperty('connectionPropertiesFiles')) {
prj.copyConnectionProperties new File(project.rootDir, 'dist')
}
}
}
}
task wikiDocsDir {
doLast {
mkdir('docs/Resources/')
}
}
task fitnesseUpdateList {
doLast {
copy {
from zipTree(fitnesseJar()).matching { include 'Resources/updateList' }
into 'docs'
rename 'updateList', 'updateList.fitnesse'
}
}
}
task dbfitUpdateList(dependsOn: wikiDocsDir) {
doLast {
File f = file('docs/Resources/updateList.dbfit')
fileTree('FitNesseRoot').each {
f << "${relativePath(it).toString().replace('\\', '/')}\n"
}
}
}
task wikiDocsUpdateList(dependsOn: [fitnesseUpdateList, dbfitUpdateList]) {
doLast {
File f = file('docs/Resources/updateList')
f << file('docs/Resources/updateList.dbfit').text
f << file('docs/Resources/updateList.fitnesse').text
delete 'docs/Resources/updateList.fitnesse'
delete 'docs/Resources/updateList.dbfit'
}
}
task wikiDocs(dependsOn: [wikiDocsUpdateList]) {
doLast {
copy {
from 'FitNesseRoot'
into 'docs/Resources/FitNesseRoot'
}
ant.jar(destfile: 'dist/lib/dbfit-docs-' + dbfitVersion + '.jar', basedir: 'docs', level: 9)
}
}
def fitnesseJar() {
fileTree(dir: 'dist/lib', include: 'fitnesse-*.jar').getSingleFile()
}
def flattenPath(def path) {
path.replaceAll('.*/([^/]*?\\.jar)', {"${it[1]}"})
}
task bundleFitsharp(dependsOn: copyLocal) {
doLast {
def fitSharpFileName = "release.${fitSharpVersion}.net.40.zip"
mkdir 'dist/fitsharp/'
ant.get(src: "http://github.com/jediwhale/fitsharp/releases/download/${fitSharpVersion}/${fitSharpFileName}",
dest: 'dist/fitsharp/',
verbose: true)
copy {
from zipTree("dist/fitsharp/${fitSharpFileName}")
into 'dist/fitsharp/'
}
delete "dist/fitsharp/${fitSharpFileName}"
file('dist/fitsharp/Runner.exe.config') << '<configuration><runtime><loadFromRemoteSources enabled="true"/></runtime></configuration>'
}
}
task bundle(type: Zip, dependsOn: [copyLocal, wikiDocs, bundleFitsharp]) {
description = 'creates the zip file for distributing dbfit'
from 'dist'
baseName 'dbfit-complete'
version dbfitVersion
destinationDir new File('zips')
}
List cmdLine () {
onWindows() ? ['cmd', '/c', 'startFitnesse.bat'] : ['./startFitnesse.sh']
}
task start(type: Exec, dependsOn: [copyLocal, copyExtraLibs, copyTestLibs, copyConnections, wikiDocs, bundleFitsharp]) {
workingDir './dist'
description = 'starts fitness with dbfit'
commandLine = cmdLine()
}
task starthere(type: Exec, dependsOn: [copyLocal, copyExtraLibs, copyTestLibs, copyConnections]) {
workingDir './dist'
description = 'starts fitness with dbfit on top of real tests sources'
commandLine = cmdLine() + ['-d', '..', '-o', '-f', 'plugins.properties']
}
task fastbuild(dependsOn: [
':dbfit-java:core:check',
':dbfit-java:db2:check',
':dbfit-java:derby:check',
':dbfit-java:hsqldb:check',
':dbfit-java:informix:check',
':dbfit-java:mysql:check',
':dbfit-java:netezza:check',
':dbfit-java:oracle:check',
':dbfit-java:postgres:check',
':dbfit-java:sqlserver:check',
':dbfit-java:teradata:check',
':dbfit-java:derby:integrationTest',
':dbfit-java:hsqldb:integrationTest'
])
task travisbuild(dependsOn: [
fastbuild,
':dbfit-java:db2:integrationTest',
':dbfit-java:mysql:integrationTest',
':dbfit-java:oracle:integrationTest',
':dbfit-java:postgres:integrationTest'
])
if (!project.hasProperty('excludeIntegrationTests')) {
project.ext.set('excludeIntegrationTests', '')
}
Set excludedIntegrationBuildDbTypes() {
(["dbfit-java", "core"] + project.excludeIntegrationTests.tokenize(",").collect { it.trim() })
}
assert (excludedIntegrationBuildDbTypes() - subprojects.collect { it.name }).empty
def integrationBuildTasks() {
(subprojects.collect { it.name } - excludedIntegrationBuildDbTypes()).collect {
":dbfit-java:${it}:integrationTest"
}
}
task integrationBuild(dependsOn: [integrationBuildTasks()])
def onWindows() {
System.properties['os.name'].toLowerCase().contains('windows')
}
def proprietaryLibs() {
['**/ojdbc*.jar',
'**/db2jcc4*.jar',
'**/terajdbc*.jar',
'**/tdgssconfig*.jar',
'**/nzjdbc*.jar',
'**/sqljdbc*.jar',
'**/ifxjdbc*.jar'
] as Set
}
def experimentalItems() {
[] as Set
}
def keepUncommitedTests() {
project.hasProperty('keepTests') && keepTests != 'false'
}