forked from molgenis/molgenis_apps-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_wormqtl.xml
432 lines (378 loc) · 16.2 KB
/
build_wormqtl.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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<?xml version="1.0" encoding="UTF-8"?>
<project name="build_wormqtl" default="run" basedir=".">
<description>
ANT file for xQTL development. Complete compilation and run script.
Work in progress, may need fixes and will be updated with more doc to
explain things. Includes developer functions and basic tests.
The application can be installed and started using:
svn co http://www.molgenis.org/svn/molgenis/trunk/ molgenis
svn co http://www.molgenis.org/svn/molgenis_apps/trunk/ molgenis_apps
ant -f molgenis_apps/xqtl_dev.xml make_run
</description>
<!--
The properties file supplied to the generator
-->
<property name="app_properties" value="apps/wormqtl/org/molgenis/wormqtl/wormqtl.properties"/>
<!--
Application class path. Describes the location of the app and the modules it consists of.
-->
<path id="app.class.path">
<pathelement location="apps/wormqtl" />
<pathelement location="apps/xgap" />
<pathelement location="generated/java" />
<pathelement location="modules/datamodel" />
<pathelement location="modules/auth" />
<pathelement location="modules/file" />
<pathelement location="modules/import" />
<pathelement location="modules/webserver" />
<pathelement location="modules/settings" />
<pathelement location="modules/pheno" />
<pathelement location="modules/search" />
<pathelement location="modules/matrix" />
<pathelement location="modules/feedback" />
<pathelement location="modules/decorators/core" />
<pathelement location="modules/decorators/auth" />
<pathelement location="modules/decorators/pheno" />
<pathelement location="modules/decorators/data" />
<pathelement location="publicdata" />
</path>
<!-- Path refs to build dirs -->
<property name="mol_build_dir" value="../molgenis/bin" />
<property name="app_build_dir" value="build/classes" />
<!-- Path ref to the molgenis libraries -->
<path id="molgenis-libs">
<fileset dir="../molgenis/lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- Path ref to the application libraries -->
<path id="app-libs">
<fileset dir="WebContent/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
</path>
<!--
CLEAN - Step 1: Delete the content of the app build, app generated and Molgenis build folders.
-->
<target name="clean" description="Delete generated and build content">
<!-- create build dirs if they doesn't exist -->
<mkdir dir="${mol_build_dir}"/>
<mkdir dir="${app_build_dir}"/>
<!-- remove content of build, ${mol_build_dir} and generated -->
<delete includeemptydirs="true">
<fileset dir="${app_build_dir}" includes="**/*" />
</delete>
<delete includeemptydirs="true">
<fileset dir="${mol_build_dir}" includes="**/*" />
</delete>
<delete includeemptydirs="true">
<fileset dir="generated" includes="**/*" />
</delete>
</target>
<!--
MAKE - Step 2: Compile MOLGENIS. This is assumed to be in your 'workspace'. (e.g. you run
this script in '/somedir/molgenis_apps', then molgenis must be in '/somedir/molgenis')
-->
<target name="compile_molgenis" description="Compile MOLGENIS">
<!-- create build dir if it doesn't exist -->
<mkdir dir="${mol_build_dir}"/>
<!-- Run javac on the src dir to be compiled into build, using the molgenis-libs fileset as classpath -->
<javac srcdir="../molgenis/src" destdir="${mol_build_dir}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath>
<path refid="molgenis-libs" />
</classpath>
</javac>
<!-- Copy the res folder to the build dir so it can be found by MolgenisResourceCopyGen -->
<copy todir="${mol_build_dir}/org/molgenis/framework/ui/res" verbose="true">
<fileset dir="../molgenis/src/org/molgenis/framework/ui/res" includes="**/*.*" />
</copy>
<!-- Copy all Freemarker templates anywhere in MOLGENIS too -->
<copy todir="${mol_build_dir}" verbose="true">
<fileset dir="../molgenis/src" includes="**/*.ftl" />
</copy>
<!-- Copy ajaxchosen.properties for XREF box-->
<copy file="../molgenis/src/org/molgenis/framework/ui/html/ajaxchosen.properties" todir="${mol_build_dir}/org/molgenis/framework/ui/html/"/>
</target>
<!--
MAKE - Step 3: Generate the application. This assumes you have compiled molgenis.
The molgenis/build and libraries are used as classpath.
-->
<target name="generate_app" description="Generate the application">
<java classname="org.molgenis.Molgenis" fork="yes" failonerror="true">
<arg value="${app_properties}" />
<classpath>
<path refid="molgenis-libs" />
<path location="${mol_build_dir}" />
</classpath>
</java>
</target>
<!--
MAKE - Step 4: Compile generated datatypes. However we must exclude the
security decorators, which depend on the org.molgenis.auth.service module.
-->
<target name="compile_datatypes" description="Compile generated datatypes">
<!-- create build dir if it doesn't exist -->
<mkdir dir="${app_build_dir}"/>
<!-- Run javac into app_build, using molgenis-libs and molgenis_build -->
<javac srcdir="generated/java/org" excludes="**/*Decorator.java" destdir="${app_build_dir}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath>
<path refid="molgenis-libs" />
<path location="${mol_build_dir}" />
</classpath>
</javac>
</target>
<!--
MAKE - Step 5: Compile the actual application using the components specified in app.class.path.
-->
<target name="compile_app" description="Compile application">
<pathconvert targetos="unix" property="app_src" refid="app.class.path" />
<javac srcdir="${app_src}" destdir="${app_build_dir}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath>
<path refid="molgenis-libs" />
<path refid="app-libs" />
<path location="${mol_build_dir}" />
</classpath>
</javac>
</target>
<!--
MAKE - Step 6: Compile other generated parts that depends on having the application compiled first.
-->
<target name="compile_other" description="Compile other generated">
<javac srcdir="generated/java/app" destdir="${app_build_dir}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath>
<path refid="molgenis-libs" />
<path location="${mol_build_dir}" />
<path location="WebContent/WEB-INF/lib/simplecaptcha-1.2.1.jar" />
</classpath>
</javac>
<javac srcdir="generated/java/test" destdir="${app_build_dir}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath>
<path refid="molgenis-libs" />
<path location="${mol_build_dir}" />
</classpath>
</javac>
</target>
<!--
MAKE - Step 7: Copy resources other than Java files from the locations of app.class.path into the build folder.
-->
<target name="copy_resources">
<!-- Grab the elements of app.class.path and convert to make a fileset pattern
usable by fileset. We concatenate the elements with '/**/*,' to grab all files.
The regexp cuts off everything until the original specified path location. Eg:
"/Users/joerivandervelde/Workspaces/workspace-23-03-2010/molgenis_apps/apps/xgap"
becomes "apps/xgap/**/*".
-->
<pathconvert pathsep="/**/*," refid="app.class.path" property="app_fileset_pattern">
<regexpmapper from=".*/(.*/.*)" to="\1" />
</pathconvert>
<!-- Grab all files from the fileset pattern, excluding Java files -->
<fileset dir="." id="app_fileset" includes="${app_fileset_pattern}/**/*">
<exclude name="**/*.java" />
</fileset>
<!-- Copy to build dir. Use a regexp to remove the leading locations
such as 'apps/xgap' or 'modules/pheno' -->
<copy todir="${app_build_dir}" verbose="true">
<fileset refid="app_fileset" />
<mapper type="regexp" from="^[-_a-zA-Z0-9]*/[-_a-zA-Z0-9]*/(.*)" to="\1" />
</copy>
<!-- Copy SQL files from generated/sql to build root -->
<copy todir="${app_build_dir}" verbose="true">
<fileset dir="generated/sql" includes="**/*.sql" />
</copy>
<!-- Copy WormQTL specific application footer -->
<copy file="apps/wormqtl/org/molgenis/wormqtl/header/WormApplicationView.ftl" tofile="../molgenis/src/org/molgenis/framework/ui/ApplicationView.ftl" overwrite="true"/>
<!-- Copy contact and about pages into place -->
<copy file="WebContent/clusterdemo/wormqtl/wormqtl_contact.html" tofile="WebContent/wormqtl_contact.html" overwrite="true"/>
<copy file="WebContent/clusterdemo/wormqtl/wormqtl_about.html" tofile="WebContent/wormqtl_about.html" overwrite="true"/>
<!-- Copy walkthrough document to downloadable location -->
<copy file="apps/wormqtl/org/molgenis/wormqtl/help/walkthrough.docx" tofile="WebContent/walkthrough.docx" overwrite="true"/>
</target>
<!--
RUN - Step 8: Start the application.
-->
<target name="run" description="Start the application">
<java maxmemory="4g" classname="boot.RunStandalone" fork="yes" failonerror="true">
<classpath>
<path refid="molgenis-libs" />
<path refid="app-libs" />
<path location="${mol_build_dir}" />
<path location="${app_build_dir}" />
</classpath>
</java>
</target>
<!--
Deploy help: run on a specific port, and on that port only
Usage: ant -f xqtl_dev.xml runOn -Dport=9000
-->
<target name="runOn" description="Start the application">
<java maxmemory="4g" classname="boot.RunStandalone" fork="yes" failonerror="true">
<arg value="${port}"/>
<classpath>
<path refid="molgenis-libs" />
<path refid="app-libs" />
<path location="${mol_build_dir}" />
<path location="${app_build_dir}" />
</classpath>
</java>
</target>
<!--
MAKE WRAPPER - All instructions to make the application in one bundle
-->
<target name="make" description="Make the application">
<antcall target="compile_molgenis" />
<antcall target="generate_app" />
<antcall target="compile_datatypes" />
<antcall target="compile_app" />
<antcall target="compile_other" />
<antcall target="copy_resources" />
</target>
<!--
CLEAN, MAKE - Clean and make the application.
Used when setting up the app from scratch, but not starting the webserver
or running any tests. Good for developing and running Selenium web
tests separately later on.
-->
<target name="clean_make" description="Clean and make the application">
<antcall target="clean" />
<antcall target="make" />
</target>
<!--
MAKE, RUN - The complete make & run procedure.
Used when installing the app from a fresh SVN checkout.
-->
<target name="make_run" description="Make and start the application">
<antcall target="make" />
<antcall target="run" />
</target>
<!--
CLEAN, MAKE, TEST - Clean and make the application, then run tests.
Used for project validation on Hudson.
-->
<target name="clean_make_test" description="Clean and make the application">
<antcall target="clean" />
<antcall target="make" />
<antcall target="test" />
</target>
<!--
Dev help: Recompile/copy the app. Basically MAKE without the generation step.
-->
<target name="recompile" description="Recompile/copy the application">
<antcall target="compile_molgenis" />
<antcall target="compile_datatypes" />
<antcall target="compile_app" />
<antcall target="compile_other" />
<antcall target="copy_resources" />
</target>
<!-- Import TestNG as an Ant task -->
<taskdef resource="testngtasks" classpath="../molgenis/lib/testng-5.14.10.jar" />
<!--
Dev help: Run xQTL tests on a compiled application.
-->
<target name="test" description="Run all tests">
<testng haltOnFailure="true">
<classfileset dir="${app_build_dir}" includes="**/*_XqtlTestNG.class" />
<classpath>
<path refid="molgenis-libs" />
<path refid="app-libs" />
<path location="${mol_build_dir}" />
<path location="${app_build_dir}" />
</classpath>
</testng>
</target>
<!--
Dev help: Remove HSQL database
-->
<target name="deletedb" description="Delete generated and build content">
<mkdir dir="hsqldb" />
<delete includeemptydirs="true">
<fileset dir="hsqldb" includes="**/*" />
</delete>
</target>
<!--
Create a Java class with information about this build.
SVN info part: http://stackoverflow.com/questions/166322/obtain-current-svn-revision-in-webapp
Other listing from: http://www.ghidinelli.com/2008/04/01/built-in-ant-properties
-->
<target name="generate_revision_info_class">
<!-- Try to call SVN to get the revision number -->
<exec executable="svnversion" failifexecutionfails="no" outputproperty="revision">
<arg value="."/>
<arg value="-n"/>
</exec>
<!-- If that failed, try a bash script. If ${revision} was already set, this has no effect -->
<exec executable="bash" failifexecutionfails="no" outputproperty="revision">
<arg value="-c"/>
<arg value="head .svn/entries | awk 'NR==4' | sed -e 's/\(.$\)/\1 (from bash, please install SVN)/g'"/>
</exec>
<!-- If that failed, set it to this message -->
<property name="revision" value="ERROR: Could not get revision number. Please install SVN and/or use Linux"/>
<tstamp>
<format property="time" pattern="MM/dd/yyyy hh:mm:ss aa" offset="0" unit="hour"/>
</tstamp>
<echo file="generated/java/app/servlet/BuildInfo.java">
package app.servlet;
import java.util.HashMap;
/**
* BuildInfo contains static build information for this project.
* The class is generated by Ant the moment you compile your app.
* This information can be helpful for provenance, testing or debugging.
*/
public class BuildInfo
{
public static HashMap<String, String> buildInfo = null;
public BuildInfo(){
buildInfo = new HashMap<String, String>();
buildInfo.put("buildBy", "${user.name}");
buildInfo.put("buildRevision", "${revision}");
buildInfo.put("buildDate", "${time}");
buildInfo.put("osName", "${os.name}");
buildInfo.put("osArch", "${os.arch}");
buildInfo.put("osVersion", "${os.version}");
buildInfo.put("javaVersion", "${java.version}");
buildInfo.put("javaVendor", "${java.vendor}");
buildInfo.put("javaSpec", "${java.specification.version}");
buildInfo.put("antVersion", "${ant.version}");
buildInfo.put("antProjectName", "${ant.project.name}");
buildInfo.put("antJavaVersion", "${ant.java.version}");
}
public static final String buildBy = "${user.name}";
public static final String buildRevision = "${revision}";
public static final String buildDate = "${time}";
public static final String osName = "${os.name}";
public static final String osArch = "${os.arch}";
public static final String osVersion = "${os.version}";
public static final String javaVersion = "${java.version}";
public static final String javaVendor = "${java.vendor}";
public static final String javaSpec = "${java.specification.version}";
public static final String antVersion = "${ant.version}";
public static final String antProjectName = "${ant.project.name}";
public static final String antJavaVersion = "${ant.java.version}";
<!-- can't output paths: unescaped backslash for MS Windows breaks the code
printing file and line seps is also dangerous
also put some pointless vars here
public static final String fileSep = "${file.separator}";
public static final String pathSep = "${path.separator}";
public static final String lineSep = "${line.separator}";
public static final String javaClassPath = "${java.class.path}";
public static final String javaExtDirs = "${java.ext.dirs}";
public static final String userHome = "${user.home}";
public static final String userDir = "${user.dir}";
public static final String javaVendorUrl = "${java.vendor.url}";
public static final String javaHome = "${java.home}";
public static final String basedir = "${basedir}";
public static final String antFile = "${ant.file}";
public static final String antHome = "${ant.home}";
public static final String javaSpecVendor = "${java.specification.vendor}";
public static final String javaSpecName = "${java.specification.name}";
public static final String javaClassVersion = "${java.class.version}";
public static final String javaVmSpecVersion = "${java.vm.specification.version}";
public static final String javaVmSpecVendor = "${java.vm.specification.vendor}";
public static final String javaVmSpecName = "${java.vm.specification.name}";
public static final String javaVmVersion = "${java.vm.version}";
public static final String javaVmVendor = "${java.vm.vendor}";
public static final String javaVmName = "${java.vm.name}";
-->
}
</echo>
</target>
</project>