forked from molgenis/molgenis_apps-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxqtl_jar.xml
281 lines (243 loc) · 12.4 KB
/
xqtl_jar.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
<?xml version="1.0" encoding="UTF-8"?>
<project name="xqtl_jar" default="create_zip" basedir=".">
<description>
Build a runnable JAR with a standalone xQTL application.
Work in progress, but must be kept stable to ensure the dependencies don't break.
Needs a properly connected Selenium test: right now we test on the folder that
is JARred instead of the JAR itself, because TestNG does not support this.
</description>
<!-- Import development script for reuse -->
<import file="xqtl_dev.xml" />
<!-- Import TestNG as an Ant task -->
<taskdef resource="testngtasks" classpath="../molgenis/lib/testng-5.14.10.jar" />
<!-- Path of Molgenis libs -->
<property name="mlibs" value="../molgenis/lib/"/>
<!-- Path of application libs -->
<property name="alibs" value="WebContent/WEB-INF/lib/"/>
<!-- Path of all unjarred and build content, to be JARred at the end -->
<property name="jarme" value="${app_build_dir}/jarme"/>
<!-- Path of dist folder where the resulting JAR will be put -->
<property name="dist" value="dist"/>
<!-- Delete content of jarme dir -->
<target name="clean_jarme" description="Delete stuff">
<!-- create dir if it doesn't exist -->
<mkdir dir="${jarme}"/>
<!-- remove content -->
<delete includeemptydirs="true">
<fileset dir="${jarme}" includes="**/*" />
</delete>
</target>
<target name="unjar" description="Unjar all Molgenis and application jars">
<!-- Molgenis jars -->
<unjar src="${mlibs}hibernate/hibernate-jpa-2.0-api-1.0.0.Final.jar" dest="${jarme}" overwrite="false"/> <!-- JPA common -->
<unjar src="${mlibs}hibernate/hibernate3.jar" dest="${jarme}" overwrite="false"/> <!-- JPA common -->
<unjar src="${mlibs}hibernate/hibernate-search-3.4.1.Final.jar" dest="${jarme}" overwrite="false"/> <!-- JPA search-->
<unjar src="${mlibs}hibernate-validator-4.1.0.Final/validation-api-1.0.0.GA.jar" dest="${jarme}" overwrite="false"/> <!-- JPA validation-->
<unjar src="${mlibs}lucene-core-3.0.2.jar" dest="${jarme}" overwrite="false"/> <!-- JPA search -->
<unjar src="${mlibs}gridgain/spring-2.5.6.jar" dest="${jarme}" overwrite="false"/> <!-- Spring framework -->
<unjar src="${mlibs}ganymed-ssh2-build250.jar" dest="${jarme}" overwrite="false"/> <!-- SSH utils -->
<unjar src="${mlibs}ant-1.8.1.jar" dest="${jarme}" overwrite="false"/> <!-- ProjectHelper Molgenis.java -->
<unjar src="${mlibs}ant-apache-log4j.jar" dest="${jarme}" overwrite="false"/> <!-- Log4jListener Molgenis.java -->
<unjar src="${mlibs}commons-dbcp-1.2.1.jar" dest="${jarme}" overwrite="false"/> <!-- BasicDataSource -->
<unjar src="${mlibs}commons-fileupload-1.1.jar" dest="${jarme}" overwrite="false"/> <!-- HttpServletRequestTuple files -->
<unjar src="${mlibs}commons-io-2.4.jar" dest="${jarme}" overwrite="false"/> <!-- File I/O helpers -->
<unjar src="${mlibs}cxf-bundle-minimal-2.5.2.jar" dest="${jarme}" overwrite="false"/> <!-- CXFNonSpringJaxrsServlet -->
<unjar src="${mlibs}freemarker.jar" dest="${jarme}" overwrite="false"/> <!-- Template processing -->
<unjar src="${mlibs}jxl.jar" dest="${jarme}" overwrite="false"/> <!-- Excel import/export -->
<unjar src="${mlibs}log4j-1.2.15.jar" dest="${jarme}" overwrite="false"/> <!-- org.apache.log4j.Logger -->
<unjar src="${mlibs}mail.jar" dest="${jarme}" overwrite="false"/> <!-- Email utils -->
<unjar src="${mlibs}tar.jar" dest="${jarme}" overwrite="false"/> <!-- TarGz utils -->
<unjar src="${mlibs}testng-5.14.10.jar" dest="${jarme}" overwrite="false"/> <!-- TestNG -->
<unjar src="${mlibs}jsr311-api-1.1.1.jar" dest="${jarme}" overwrite="false"/> <!-- Rest API JSON -->
<unjar src="${mlibs}selenium-server-standalone-2.19.0.jar" dest="${jarme}" overwrite="false" /> <!-- Selenium webtests -->
<unjar src="${mlibs}hsqldb.jar" dest="${jarme}" overwrite="false"/> <!-- RUNTIME ??: HyperSQL database-->
<unjar src="${mlibs}commons-pool-1.5.2.jar" dest="${jarme}" overwrite="false"/> <!-- RUNTIME FrontController only??: GenericObjectPool -->
<unjar src="${mlibs}wsdl4j-1.6.2.jar" dest="${jarme}" overwrite="false"/><!-- RUNTIME AbstractServlet only??: WSDL Locator -->
<unjar src="${mlibs}quartz-1.6.0.jar" dest="${jarme}" overwrite="false"/><!-- Scheduling -->
<unjar src="${mlibs}gson-2.2.1.jar" dest="${jarme}" overwrite="false"/><!-- GSON for XrefService-->
<unjar src="${mlibs}tjws-1.98.jar" dest="${jarme}" overwrite="false"/><!-- Webserver -->
<!-- Application jars -->
<unjar src="${alibs}jaxrpc.jar" dest="${jarme}" overwrite="false" /> <!-- xQTL: KEGG tools -->
<unjar src="${alibs}axis.jar" dest="${jarme}" overwrite="false" /> <!-- xQTL: KEGG tools -->
<unjar src="${alibs}keggapi.jar" dest="${jarme}" overwrite="false" /> <!-- xQTL: KEGG tools -->
<unjar src="${alibs}mindterm.jar" dest="${jarme}" overwrite="false" /> <!-- xQTL: Mindterm SSH -->
<unjar src="${alibs}commons-math-2.2.jar" dest="${jarme}" overwrite="false" /> <!-- xQTL: Report builder statistics -->
<unjar src="${alibs}simplecaptcha-1.2.1.jar" dest="${jarme}" overwrite="false" /> <!-- Auth captcha service -->
<unjar src="${alibs}jopenid-1.07.jar" dest="${jarme}" overwrite="false" /> <!-- Auth OpenID login -->
<unjar src="${alibs}spssw-1.66.jar" dest="${jarme}" overwrite="false" /> <!-- SPSS writer -->
<unjar src="${alibs}pircbot.jar" dest="${jarme}" overwrite="false" /> <!-- IRC client -->
<unjar src="${alibs}lambdaj-2.3.3-with-dependencies.jar" dest="${jarme}" overwrite="false" /> <!-- Used in: matrix/component/sqlbackend/EAVBackend.java -->
</target>
<!-- Compile Molgenis on the unjarred content in jarme -->
<target name="compile_molgenis_jarme" description="Compile MOLGENIS on unjarred classes">
<!-- Run javac on molgenis, using the unjarred content as classpath -->
<javac srcdir="../molgenis/src" destdir="${jarme}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath path="{jarme}" />
<exclude name="**/org/molgenis/framework/db/lifewise**" />
</javac>
<!-- Copy the res folder to the build dir so it can be found by MolgenisResourceCopyGen -->
<copy todir="${jarme}/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="${jarme}" verbose="true">
<fileset dir="../molgenis/src" includes="**/*.ftl" />
</copy>
</target>
<!-- Generate app on the unjarred content in jarme -->
<target name="generate_app_jarme" description="Generate the application">
<java classname="org.molgenis.Molgenis" fork="yes" failonerror="true">
<arg value="apps/xgap/org/molgenis/xgap/xqtlworkbench/xqtl.properties" />
<classpath path="${jarme}" />
</java>
</target>
<target name="compile_datatypes_jarme" description="Compile generated datatypes">
<javac srcdir="generated/java/org" excludes="**/*Decorator.java" destdir="${jarme}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath path="${jarme}" />
</javac>
</target>
<target name="compile_app_jarme" description="Compile application">
<pathconvert targetos="unix" property="app_src" refid="app.class.path" />
<javac srcdir="${app_src}" destdir="${jarme}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath path="${jarme}" />
</javac>
</target>
<target name="compile_other_jarme" description="Compile other generated">
<javac srcdir="generated/java/app" destdir="${jarme}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath path="${jarme}" />
</javac>
<javac srcdir="generated/java/test" destdir="${jarme}" includeantruntime="false" debug="true" debuglevel="lines,vars,source">
<classpath path="${jarme}" />
</javac>
</target>
<target name="copy_resources_jarme">
<pathconvert pathsep="/**/*," refid="app.class.path" property="app_fileset_pattern">
<regexpmapper from=".*/(.*/.*)" to="\1" />
</pathconvert>
<fileset dir="." id="app_fileset" includes="${app_fileset_pattern}/**/*">
<exclude name="**/*.java" />
</fileset>
<copy todir="${jarme}" verbose="true">
<fileset refid="app_fileset" />
<mapper type="regexp" from="^[-_a-zA-Z0-9]*/[-_a-zA-Z0-9]*/(.*)" to="\1" />
</copy>
<copy todir="${jarme}" verbose="true">
<fileset dir="generated/sql" includes="**/*.sql" />
</copy>
</target>
<target name="build_jarme">
<antcall target="clean_jarme" />
<antcall target="unjar" />
<antcall target="compile_molgenis_jarme" />
<antcall target="generate_app_jarme" />
<antcall target="compile_datatypes_jarme" />
<antcall target="compile_app_jarme" />
<antcall target="compile_other_jarme" />
<antcall target="copy_resources_jarme" />
</target>
<target name="jar_jarme">
<mkdir dir="${dist}" />
<!-- copy resources to JAR specific locations -->
<copy todir="${dist}">
<fileset dir="handwritten/standalone">
<include name="**/*.*" />
</fileset>
</copy>
<copy todir="${dist}/WebContent">
<fileset dir="WebContent">
<exclude name="META-INF/**" />
<exclude name="WEB-INF/**" />
<exclude name="animaldb/**" />
<exclude name="designgg/**" />
<include name="**/*.*" />
</fileset>
</copy>
<copy todir="${jarme}">
<fileset dir="publicdata/xqtl">
<include name="**/*.*" />
</fileset>
</copy>
<!-- JAR the jarme folder into dist/Application.jar -->
<jar jarfile="${dist}/Application.jar" basedir="${jarme}" update="false">
<manifest>
<attribute name="Built-By" value="GCC" />
<attribute name="Main-Class" value="boot.RunStandalone" />
</manifest>
</jar>
</target>
<target name="zip_jarme" description="Package the distribution into a ZIP">
<mkdir dir="${dist}" />
<!-- copy resources to ZIP specific locations -->
<copy todir="${jarme}/WebContent">
<fileset dir="WebContent">
<exclude name="META-INF/**" />
<exclude name="WEB-INF/**" />
<exclude name="animaldb/**" />
<exclude name="designgg/**" />
<include name="**/*.*" />
</fileset>
</copy>
<copy todir="${jarme}/publicdata/xqtl">
<fileset dir="publicdata/xqtl">
<include name="**/*.*" />
</fileset>
</copy>
<!-- Windows/Unix startup scripts-->
<echo file="${jarme}/run.sh">java -Xmx512m boot/RunStandalone</echo>
<echo file="${jarme}/run.bat">java -Xmx512m boot/RunStandalone</echo>
<zip destfile="${dist}/xqtl_workbench.zip" basedir="${jarme}" update="false" />
</target>
<target name="create_zip">
<antcall target="build_jarme" />
<antcall target="zip_jarme" />
</target>
<target name="create_jar">
<antcall target="build_jarme" />
<antcall target="jar_jarme" />
</target>
<!--
Run webtest on the directory that was JARred because it's not possible
to run TestNG from inside a jar. (needs ref to class or XML files)
TODO: find a way to make it possible? it's a bit silly now..
-->
<target name="webtest_jar" description="Start the Selenium test">
<testng haltOnFailure="true">
<classfileset dir="${app_build_dir}" includes="**/XqtlSeleniumTest.class"/>
<classpath path="${jarme}" />
</testng>
</target>
<!-- Unzip and run webtest -->
<target name="webtest_zip" description="Start the Selenium test on unzipped app">
<unzip src="${dist}/xqtl_workbench.zip" dest="${dist}/xqtl_unzipped" />
<testng haltOnFailure="true">
<classfileset dir="${dist}/xqtl_unzipped" includes="**/XqtlSeleniumTest.class"/>
<classpath path="${dist}/xqtl_unzipped" />
</testng>
</target>
<!-- Wrapper to make the JAR and run the webtest -->
<target name="create_jar_webtest">
<antcall target="create_jar" />
<antcall target="webtest_jar" />
</target>
<!-- Wrapper to make the ZIP and run the webtest -->
<target name="create_zip_webtest">
<antcall target="create_zip" />
<antcall target="webtest_zip" />
</target>
<!-- Run the application from JAR file. Not efficient because
when running from here we need to make a copy first. (JAR needs
to find stuff from the basedir where it was launched) -->
<target name="run_jar" description="Start the application">
<!-- in order to work properly, JAR must be started from basedir -->
<echo message="moving application files from ${dist} to ${basedir}" />
<copy todir="${basedir}" overwrite="true">
<fileset dir="${dist}">
<include name="**/*.*" />
</fileset>
</copy>
<!--delete includeemptydirs="true">
<fileset dir="${dist}" includes="**/*" />
</delete-->
<java maxmemory="512m" jar="Application.jar" fork="yes" failonerror="true" />
</target>
</project>