forked from dbfit/dbfit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
184 lines (154 loc) · 4.93 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
import org.apache.tools.ant.filters.ReplaceTokens
ext.dbfitVersion = '3.1.0'
task cleanFitnesseroot(type:Exec) {
def gitArgs = ['clean', '-d', '-x', '-f', 'FitNesseRoot/']
gitArgs += keepUncommitedTests() ? ['-e', 'FitNesseRoot/DbFit/'] : []
executable 'git'
args gitArgs
}
task cleanDist << {
delete 'dist'
delete 'zips'
delete 'docs'
}
task copyLocal(dependsOn: [cleanFitnesseroot, cleanDist, ':dbfit-java:assembleAll', ':dbfit-java:libs']) << {
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]) << {
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 copyConnections(dependsOn: [copyLocal]) << {
copy {
from 'dbfit-java/oracle/TestDbConnectionDbFitOracle.properties.default'
into 'dist'
rename '(.*).default', '$1'
}
copy {
from 'dbfit-java/oracle/TestDbConnectionDbFitOracle.properties.custom'
into 'dist'
rename '(.*).custom', '$1'
}
}
task wikiDocsDir << {
mkdir('docs/Resources/')
}
task fitnesseUpdateList << {
copy {
from zipTree(fitnesseJar()).matching { include 'Resources/updateList' }
into 'docs'
rename 'updateList', 'updateList.fitnesse'
}
}
task dbfitUpdateList(dependsOn: wikiDocsDir) << {
File f = file('docs/Resources/updateList.dbfit')
fileTree('FitNesseRoot').each {
f << "${relativePath(it).toString().replace('\\', '/')}\n"
}
}
task wikiDocsUpdateList(dependsOn: [fitnesseUpdateList, dbfitUpdateList]) << {
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]) << {
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) << {
mkdir 'dist/fitsharp/'
ant.get(src: 'http://cloud.github.com/downloads/jediwhale/fitsharp/release.2.2.net.40.zip',
dest: 'dist/fitsharp/',
verbose: true)
copy {
from zipTree('dist/fitsharp/release.2.2.net.40.zip')
into 'dist/fitsharp/'
}
delete 'dist/fitsharp/release.2.2.net.40.zip'
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')
}
task start(type: Exec, dependsOn: [copyLocal, copyExtraLibs, copyConnections, wikiDocs, bundleFitsharp]) {
workingDir './dist'
description = 'starts fitness with dbfit'
executable onWindows() ? 'startFitnesse.bat' : './startFitnesse.sh'
}
task starthere(type: Exec, dependsOn: [copyLocal, copyExtraLibs, copyConnections]) {
workingDir './dist'
description = 'starts fitness with dbfit on top of real tests sources'
executable onWindows() ? 'startFitnesse.bat' : './startFitnesse.sh'
args '-d', '..', '-o', '-f', 'plugins.properties'
}
task fastbuild(dependsOn: [':dbfit-java:core:check', ':dbfit-java:derby:check'])
def onWindows() {
System.properties['os.name'].toLowerCase().contains('windows')
}
def proprietaryLibs() {
['**/ojdbc*.jar', '**/db2jcc4*.jar', '**/terajdbc*.jar', '**/tdgssconfig*.jar', '**/nzjdbc*.jar'] as Set
}
def experimentalItems() {
[] as Set
}
def keepUncommitedTests() {
project.hasProperty('keepTests') && keepTests != 'false'
}