-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
346 lines (304 loc) · 17 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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<project name="sormula" basedir="." default="help">
<!-- ******* examples ******* -->
<target name="BenchmarkSuite" description="Runs comparisons of Sormula vs. plain JDBC (small size)">
<antcall target="run-example">
<param name="class" value="org.sormula.examples.benchmark.BenchmarkSuite"/>
<param name="maxmem" value="1000M"/>
<param name="arg1" value="50"/>
<param name="arg2" value="500"/>
</antcall>
</target>
<target name="BenchmarkSuite-medium" description="Runs comparisons of Sormula vs. plain JDBC (medium size)">
<antcall target="run-example">
<param name="class" value="org.sormula.examples.benchmark.BenchmarkSuite"/>
<param name="maxmem" value="1000M"/>
<param name="arg1" value="100"/>
<param name="arg2" value="1000"/>
</antcall>
</target>
<target name="BenchmarkSuite-large" description="Runs comparisons of Sormula vs. plain JDBC (large size)">
<antcall target="run-example">
<param name="class" value="org.sormula.examples.benchmark.BenchmarkSuite"/>
<param name="maxmem" value="2000M"/>
<param name="arg1" value="200"/>
<param name="arg2" value="2000"/>
</antcall>
</target>
<target name="PaginationInsert" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.pagination.PaginationInsert"/></antcall>
</target>
<target name="PaginationSelect" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.pagination.PaginationSelect"/></antcall>
</target>
<target name="BasicInsert" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.basic.BasicInsert"/></antcall>
</target>
<target name="BasicSelect" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.basic.BasicSelect"/></antcall>
</target>
<target name="BasicUpdate" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.basic.BasicUpdate"/></antcall>
</target>
<target name="BasicDelete" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.basic.BasicDelete"/></antcall>
</target>
<target name="BasicInsert2" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.basic2.BasicInsert2"/></antcall>
</target>
<target name="BasicSelect2" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.basic2.BasicSelect2"/></antcall>
</target>
<target name="BuilderInsert" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.builder.BuilderInsert"/></antcall>
</target>
<target name="BuilderSelect" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.builder.BuilderSelect"/></antcall>
</target>
<target name="BuilderUpdate" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.builder.BuilderUpdate"/></antcall>
</target>
<target name="BuilderDelete" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.builder.BuilderDelete"/></antcall>
</target>
<target name="NameInsert" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.name.NameInsert"/></antcall>
</target>
<target name="NameSelect" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.name.NameSelect"/></antcall>
</target>
<target name="NameUpdate" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.name.NameUpdate"/></antcall>
</target>
<target name="NameDelete" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.name.NameDelete"/></antcall>
</target>
<target name="HierarchyInsert" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.hierarchy.HierarchyInsert"/></antcall>
</target>
<target name="HierarchySelect" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.hierarchy.HierarchySelect"/></antcall>
</target>
<target name="HierarchyUpdate" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.hierarchy.HierarchyUpdate"/></antcall>
</target>
<target name="ComplexInsert" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.complex.ComplexInsert"/></antcall>
</target>
<target name="ComplexSelect" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.complex.ComplexSelect"/></antcall>
</target>
<target name="ComplexUpdate" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.complex.ComplexUpdate"/></antcall>
</target>
<target name="ComplexDelete" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.complex.ComplexDelete"/></antcall>
</target>
<target name="CascadeInsert" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.cascade.CascadeInsert"/></antcall>
</target>
<target name="CascadeSelect" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.cascade.CascadeSelect"/></antcall>
</target>
<target name="CascadeUpdate" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.cascade.CascadeUpdate"/></antcall>
</target>
<target name="CascadeDelete" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.cascade.CascadeDelete"/></antcall>
</target>
<target name="IdentityInsert" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.identity.IdentityInsert"/></antcall>
</target>
<target name="FilterSelect" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.filter.FilterSelect"/></antcall>
</target>
<target name="ManyToManyInsert1" description="Runs example in org.sormula.examples.manytomany.inherited">
<antcall target="run-example"><param name="class" value="org.sormula.examples.manytomany.inherited.ManyToManyInsert1"/></antcall>
</target>
<target name="ManyToManySelect1" description="Runs example in org.sormula.examples.manytomany.inherited">
<antcall target="run-example"><param name="class" value="org.sormula.examples.manytomany.inherited.ManyToManySelect1"/></antcall>
</target>
<target name="ManyToManyInsert2" description="Runs example in org.sormula.examples.manytomany.named">
<antcall target="run-example"><param name="class" value="org.sormula.examples.manytomany.named.ManyToManyInsert2"/></antcall>
</target>
<target name="ManyToManySelect2" description="Runs example in org.sormula.examples.manytomany.named">
<antcall target="run-example"><param name="class" value="org.sormula.examples.manytomany.named.ManyToManySelect2"/></antcall>
</target>
<target name="NamedParameterInsert" description="Sets up tables for examples in org.sormula.examples.np">
<antcall target="run-example"><param name="class" value="org.sormula.examples.np.NamedParameterInsert"/></antcall>
</target>
<target name="NamedParameterSelect" description="Runs example to select using named parameters in org.sormula.examples.np">
<antcall target="run-example"><param name="class" value="org.sormula.examples.np.NamedParameterSelect"/></antcall>
</target>
<target name="BlobExample" description="Runs example">
<antcall target="run-example"><param name="class" value="org.sormula.examples.blob.BlobExample"/></antcall>
</target>
<target name="run-example" description="called by other task to run an example" depends="compile-main, compile-examples">
<echo>Run ${class} ${args}</echo>
<java classname="${class}" maxmemory="${maxmem}">
<arg value="${arg1}"/>
<arg value="${arg2}"/>
<sysproperty key="dbdir" value="${db.dir}"/>
<sysproperty key="seed" value="${seed}"/>
<sysproperty key="timings" value="${timings}"/>
<sysproperty key="logger.class" value="${logger.class}"/>
<sysproperty key="cache.statistics" value="${cache.statistics}"/>
<sysproperty key="java.library.path" value="jdbc/${db.dir}"/> <!-- for type 2 JDBC drivers -->
<classpath refid="examples.libpath"/>
<classpath>
<path path="${target}"/>
<path path="${examples.srcdir}/resources"/>
</classpath>
<classpath>
<fileset dir="jdbc/${db.dir}" includes="*.jar"/>
</classpath>
</java>
</target>
<!-- ******* tests ******* -->
<target name="tests" description="Runs tests for groups in ${groups} for database ${db.dir} defined in build.properties" depends="compile-tests">
<testng verbose="${testng.verbose}" groups="${testng.groups}">
<sysproperty key="dbdir" value="${db.dir}"/>
<sysproperty key="seed" value="${seed}"/>
<sysproperty key="timings" value="${timings}"/>
<sysproperty key="logger.class" value="${logger.class}"/>
<sysproperty key="cache.statistics" value="${cache.statistics}"/>
<classpath refid="tests.libpath"/>
<classpath>
<path path="${target}"/>
<path path="${tests.srcdir}/resources"/>
</classpath>
<classpath>
<fileset dir="jdbc/${db.dir}" includes="*.jar"/>
</classpath>
<classfileset dir="${target}/org/sormula/tests" includes="${class}"/>
</testng>
</target>
<!-- ******* compiles ******* -->
<target name="compile-main" description="Compiles all main Java source into target directory" depends="init">
<antcall target="compile"><param name="type" value="main"/></antcall>
</target>
<target name="compile-examples" description="Compiles all examples Java source into target directory" depends="init, compile-main">
<antcall target="compile"><param name="type" value="examples"/></antcall>
</target>
<target name="compile-tests" description="Compiles all tests Java source into target directory" depends="init, compile-main">
<antcall target="compile"><param name="type" value="tests"/></antcall>
</target>
<target name="compile" description="called by other tasks to compile" depends="init">
<javac
destdir="${target}"
source="${javac.version}"
target="${javac.version}"
bootclasspath="${javac.bootclasspath}"
optimize="${optimize}"
debug="${debug}"
listfiles="true"
includeAntRuntime="false"
>
<src refid="${type}.srcpath"/>
<classpath refid="${type}.libpath"/>
<!-- <compilerarg value="-Xlint"/> -->
</javac>
</target>
<!-- ******* other ******* -->
<target name="init" description="Creates directories and paths">
<tstamp/>
<property file="build.properties"/>
<mkdir dir="${target}"/>
<!-- required if custom SormulaLogger is used -->
<!-- point to valid dir if not set to avoid ant error -->
<property name="logger.impl" value="doc" />
<path id="main.srcpath">
<pathelement path="${main.srcdir}/java"/>
<pathelement path="${logger.impl}"/>
</path>
<path id="examples.srcpath">
<pathelement path="${examples.srcdir}/java"/>
</path>
<path id="tests.srcpath">
<pathelement path="${tests.srcdir}/java"/>
</path>
<path id="main.libpath">
<fileset dir="${main.srcdir}/resources" includes="*.jar"/>
<fileset dir="${logger.impl}" includes="*.jar"/>
</path>
<path id="examples.libpath">
<fileset dir="${examples.srcdir}/resources" includes="*.jar"/>
<fileset dir="${logger.impl}" includes="*.jar"/>
</path>
<path id="tests.libpath">
<fileset dir="${tests.srcdir}/resources" includes="*.jar"/>
<fileset dir="${logger.impl}" includes="*.jar"/>
</path>
<taskdef name="testng" classpathref="tests.libpath" classname="org.testng.TestNGAntTask"/>
</target>
<target name="help">
<echo>List all tasks:</echo>
<echo>ant -p</echo>
<echo></echo>
<echo>Run tests defined in build.properties:</echo>
<echo>ant test</echo>
</target>
<target name="clean" description="Deletes all generated files in target directory" depends="init">
<delete dir="${target}"/>
<delete dir="javadoc"/>
<delete dir="test-output"/>
<delete>
<fileset dir="." includes="*.log* sormula*.zip example*.zip"/>
</delete>
<mkdir dir="test-output"/> <!-- sqlite needs this -->
</target>
<target name="lib" description="Creates sormula.jar" depends="compile-main">
<property name="lib.jar" value="sormula-${version}${dist.suffix}.jar"/>
<jar jarfile="${lib.jar}" basedir="${target}"
excludes="org/sormula/examples/**/*
org/sormula/tests/**/*"
/>
<!-- keep examples up-to-date -->
<copy preservelastmodified="true" file="${lib.jar}" todir="${examples.solo}/ActiveRecordExample" />
<copy preservelastmodified="true" file="${lib.jar}" todir="${examples.solo}/SimpleExample" />
<copy preservelastmodified="true" file="${lib.jar}" todir="${examples.solo}/ZeroConfigExample" />
</target>
<target name="dist" description="Creates sormula.zip for distribution" depends="lib, javadoc">
<property name="p" value="sormula"/>
<property name="d" value="sormula-${version}${dist.suffix}.zip"/>
<zip destfile="${d}" basedir=".."
includes="${p}/**/*"
excludes="${p}/${d}
${p}/.hg/**/*
${p}/target/**
${p}/test-output/**
${p}/*.log*
${p}/solo-examples/**/db.*"
/>
</target>
<target name="javadoc" description="Generates javadoc to javadoc directory" depends="compile-main">
<echo file="${main.srcdir}/java/overview.html" message="<body>Version ${version}</body>"/>
<javadoc
sourcepathref="main.srcpath"
packagenames="*"
windowtitle="${ant.project.name}"
doctitle="${ant.project.name}"
destdir="javadoc"
protected="true"
use="true"
source="${javac.version}"
overview="${main.srcdir}/java/overview.html"
>
<classpath refid="main.libpath"/>
</javadoc>
</target>
<target name="active-record-example" description="Creates active-record-example.zip for distribution" depends="init">
<zip zipfile="active-record-example-${version}${dist.suffix}.zip" basedir="${examples.solo}"
includes="ActiveRecordExample/**/*"
excludes="ActiveRecordExample/.classpath ActiveRecordExample/.project **/ActiveRecordExample/.settings/**"/>
</target>
<target name="simple-example" description="Creates example.zip for distribution" depends="init">
<zip zipfile="simple-example-${version}${dist.suffix}.zip" basedir="${examples.solo}"
includes="SimpleExample/**/*"
excludes="SimpleExample/.classpath SimpleExample/.project **/SimpleExample/.settings/**"/>
</target>
<target name="zero-config-example" description="Creates zero-config-example.zip for distribution" depends="init">
<zip zipfile="zero-config-example-${version}${dist.suffix}.zip" basedir="${examples.solo}"
includes="ZeroConfigExample/**/*"
excludes="ZeroConfigExample/.classpath ZeroConfigExample/.project **/ZeroConfigExample/.settings/**"/>
</target>
</project>