-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
263 lines (211 loc) · 9.65 KB
/
build.xml
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
<?xml version="1.0"?>
<project name="mysqldbtae" default="deploy">
<property name="private.buildfile" value="build-resources/private/user-antbuild.properties"/>
<property file="${private.buildfile}"/>
<!--Try to get the private build resources from another place if it's not defined-->
<property name="fallback1.private.buildfile" value="../AEATK/build-resources/private/user-antbuild.properties"/>
<property file="${fallback1.private.buildfile}"/>
<!--Try to get the private build resources from another place if it's not defined-->
<property name="fallback2.private.buildfile" value="../aeatk/build-resources/private/user-antbuild.properties"/>
<property file="${fallback2.private.buildfile}"/>
<property file="build-resources/antbuild.properties"/>
<touch file="${private.buildfile}" mkdirs="true"/>
<fail message="${line.separator}================[ ERROR ] ==============${line.separator}
You must specify the software.dir property in the file ${private.buildfile}${line.separator}
If you are running eclipse you should right click on this project and hit refresh,
so that the file appears.${line.separator}
${line.separator}
You should then put the following two lines in the file:${line.separator}
software.dir=[path to place completed packages]${line.separator}
buildnumberpath=[path to store build numbers]${line.separator}
#Windows users should use \\ or / as path seperators.
">
<condition>
<not>
<isset property="software.dir"/>
</not>
</condition>
</fail>
<mkdir dir="${software.dir}"/>
<mkdir dir="${buildnumberpath}"/>
<property name="version.file" value="${ant.project.name}-version.txt"/>
<property name="version.file.dev" value="version/${version.file}"/>
<!-- If you don't specify a buildnumber file we will use this -->
<property name="buildnumberpath" value="build/classes/"/>
<property name="doc.buildpath" value="doc/build" />
<property name="buildnumberfile" value="${buildnumberpath}/buildnumber-${ant.project.name}"/>
<target name="git-status-init" description="Initialize Git variables">
<echo>If this next call fails, it means you haven't installed git and/or it's not in your PATH</echo>
<exec executable="git" outputproperty="git.branch">
<arg value="rev-parse"/>
<arg value="--abbrev-ref"/>
<arg value="HEAD"/>
</exec>
<exec executable="git" outputproperty="git.commit">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<exec executable="git" outputproperty="git.shortcommit">
<arg value="rev-parse"/>
<arg value="--short=12"/>
<arg value="HEAD"/>
</exec>
<exec executable="git" resultproperty="git.dirty" outputproperty="git.dirty.output">
<arg value="diff"/>
<arg value="--exit-code"/>
</exec>
<echo>Git properties loaded, branch: ${git.branch}
commit: ${git.commit}
shortcommit: ${git.shortcommit}
dirty: ${git.dirty}</echo>
</target>
<target name="init" description="Initialize the project directories" depends="git-status-init">
<mkdir dir="build/classes/"/>
<mkdir dir="dist"/>
<property file="${software.dir}${file.separator}aeatk-${git.branch}.latest"/>
<fail unless="aeatk.location" message="${line.separator}================[ ERROR ] ==============${line.separator}You must check out and build the aeatk project on this branch (${git.branch}) first${line.separator}Expected to find file:${software.dir}${file.separator}aeatk-${git.branch}.latest${line.separator}This file should contain the location of aeatk"/>
<path id="compile.classpath">
<fileset dir="lib" id="lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${aeatk.location}/" id="aeatk">
<include name="**/*"/>
</fileset>
</path>
</target>
<target name="clean">
<delete dir="build"/>
<delete dir="dist"/>
</target>
<target name="compile" depends="init">
<javac srcdir="src" destdir="build/classes" debug="true" target="1.7">
<classpath refid="compile.classpath"/>
</javac>
<copy todir="build/classes">
<fileset dir="src/">
<include name="*.sql"/>
</fileset>
</copy>
<path id="build.classpath">
<path refid="compile.classpath"/>
<path location="build/classes"/>
</path>
</target>
<target name="archive" depends="compile">
<buildnumber file="${buildnumberpath}/buildnumber-${ant.project.name}"/>
<property name="version.string" value="v${version.major}.${version.minor}.${version.revision}${version.beta}-${git.branch}-${build.number}"/>
<property name="version.devstring" value="v${version.major}.${version.minor}.${version.revision}dev-${git.branch}-${build.number}"/>
<echo file="${version.file.dev}">${version.devstring} (${git.shortcommit})</echo>
<echo file="build/classes/${version.file}">${version.string} (${git.shortcommit})</echo>
<property name="outputfilename" value="${ant.project.name}-${version.string}"/>
<mkdir dir="dist/lib/"/>
<jar destfile="dist/lib/${ant.project.name}.jar" basedir="build/classes"/>
<jar destfile="dist/lib/${ant.project.name}-src.jar">
<fileset dir="src/">
<include name="**/*.java"/>
</fileset>
</jar>
<copy todir="dist/">
<fileset dir="">
<include name="conf/**"/>
</fileset>
<fileset dir="deployables"/>
<!--<fileset refid="lib"/>
<fileset refid="aeatk"/>-->
<fileset dir="scripts">
<include name="*"/>
</fileset>
</copy>
<copy todir="dist/lib/" force="true">
<fileset refid="lib"/>
<fileset refid="aeatk"/>
</copy>
<mkdir dir="dist/${ant.project.name}-plugin"/>
<copy todir="dist/${ant.project.name}-plugin">
<fileset refid="lib"/>
<fileset dir="dist/lib/">
<include name="${ant.project.name}*"/>
</fileset>
</copy>
<java classname="ca.ubc.cs.beta.aeatk.ant.execscript.ExecScriptCreator" failonerror="true" classpathref="build.classpath" fork="true">
<arg value="--class"/>
<arg value="ca.ubc.cs.beta.mysqldbtae.worker.MySQLTAEWorker"/>
<arg value="--name"/>
<arg value="mysql-worker"/>
<arg value="--file-to-write"/>
<arg value="dist/"/>
</java>
<java classname="ca.ubc.cs.beta.aeatk.ant.execscript.ExecScriptCreator" failonerror="true" classpathref="build.classpath" fork="true">
<arg value="--class"/>
<arg value="ca.ubc.cs.beta.dzq.exec.DangerZoneQueue"/>
<arg value="--name"/>
<arg value="dzq"/>
<arg value="--file-to-write"/>
<arg value="dist/"/>
</java>
<java classname="ca.ubc.cs.beta.aeatk.ant.execscript.ExecScriptCreator" failonerror="true" classpathref="build.classpath" fork="true">
<arg value="--class"/>
<arg value="ca.ubc.cs.beta.mysqldbtae.migration.MigrationUtilityExecutor"/>
<arg value="--name"/>
<arg value="mysqldbtae-repair"/>
<arg value="--file-to-write"/>
<arg value="dist/"/>
<arg value="--default-mem"/>
<arg value="1500"/>
</java>
<java classname="ca.ubc.cs.beta.aeatk.ant.execscript.ExecScriptCreator" failonerror="true" classpathref="build.classpath" fork="true">
<arg value="--class"/>
<arg value="ca.ubc.cs.beta.mysqldbtae.example.BraninSearch"/>
<arg value="--name"/>
<arg value="branin-search"/>
<arg value="--file-to-write"/>
<arg value="dist/example"/>
<arg value="--print-mem"/>
<arg value="false"/>
<arg value="--default-mem"/>
<arg value="256"/>
</java>
<java classname="ca.ubc.cs.beta.aeatk.ant.execscript.ExecScriptCreator" failonerror="true" classpathref="build.classpath" fork="true">
<arg value="--class"/>
<arg value="ca.ubc.cs.beta.mysqldbtae.worker.MySQLTAEWorker"/>
<arg value="--name"/>
<arg value="mysql-worker"/>
<arg value="--file-to-write"/>
<arg value="dist/${ant.project.name}-plugin/"/>
</java>
<java classname="ca.ubc.cs.beta.aeatk.ant.execscript.ExecScriptCreator" failonerror="true" classpathref="build.classpath" fork="true">
<arg value="--class"/>
<arg value="ca.ubc.cs.beta.dzq.exec.DangerZoneQueue"/>
<arg value="--name"/>
<arg value="dzq"/>
<arg value="--file-to-write"/>
<arg value="dist/${ant.project.name}-plugin/"/>
</java>
</target>
<target name="zip" depends="archive" description="Makes tarball for this release">
<fail message="Cannot deploy a build for the git master branch if it is dirty, please commit all changes">
<condition>
<and>
<equals arg1="${git.branch}" arg2="master" casesensitive="false" trim="true"/>
<equals arg1="${git.dirty}" arg2="1" casesensitive="false" trim="true"/>
</and>
</condition>
</fail>
<tar destFile="${software.dir}/${outputfilename}.tar.gz" longfile="gnu" compression="gzip">
<tarfileset dir="dist/" filemode="755" dirmode="755" prefix="${outputfilename}/">
<include name="**/*"/>
<exclude name="${lastdeployfile}"/>
<exclude name="git-hashes.tex"/>
<exclude name="git-hashes.txt"/>
</tarfileset>
</tar>
</target>
<target name="deploy-release" depends="zip" description="untars tarball in software.dir and creates symlink">
<untar src="${software.dir}${file.separator}${outputfilename}.tar.gz" dest="${software.dir}" compression="gzip"/>
<propertyfile file="${software.dir}${file.separator}${ant.project.name}-${git.branch}.latest" comment="Contains location of most recent ${ant.project.name}">
<entry key="${ant.project.name}.location" value="${software.dir}${file.separator}${outputfilename}"/>
</propertyfile>
<echo>Untar Successful to ${software.dir}${file.separator}${outputfilename}</echo>
</target>
<target name="deploy" depends="zip, deploy-release"/>
</project>