-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
415 lines (346 loc) · 13.8 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
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
<project name="maltools" default="hello" basedir=".">
<property file="${basedir}/project.properties"/>
<property file="${basedir}/build.properties"/>
<!-- Unmodifable properties (unless you know what you are doing) -->
<property name="source.dir" value="${basedir}/src" />
<property name="source.cpp.dir" value="${source.dir}/cpp" />
<property name="source.java.dir" value="${source.dir}/java" />
<property name="source.perl.dir" value="${source.dir}/perl" />
<property name="resources.dir" value="${basedir}/resources" />
<property name="installer.dir" value="${basedir}/installer" />
<property name="conf.dir" value="${basedir}/conf" />
<property name="debug" value="off" />
<!-- tools && macros -->
<property name="tools.dir" value="${basedir}/tools" />
<property name="svn-get.exec" value="${tools.dir}/svn-get" />
<property name="git-get.exec" value="${tools.dir}/git-get" />
<property name="svn.exec" value="svn" />
<macrodef name="git-get">
<attribute name="url" default=""/>
<attribute name="dir" default=""/>
<attribute name="branch" default="DEFAULT"/>
<attribute name="commit" default="DEFAULT"/>
<attribute name="patch" default="NONE"/>
<sequential>
<exec executable="${git-get.exec}" failonerror="true">
<arg line="-c @{commit}" />
<arg line="-b @{branch}" />
<arg line="-p @{patch}" />
<arg line="-pm .patch_applied" />
<arg line="-bm .built" />
<arg value="@{url}" />
<arg value="@{dir}" />
</exec>
</sequential>
</macrodef>
<macrodef name="svn-info">
<attribute name="output" default="/dev/stdout"/>
<attribute name="url" default="${basedir}"/>
<sequential>
<exec executable="${svn.exec}" failonerror="true" output="@{output}">
<arg value="info" />
<arg value="@{url}" />
</exec>
</sequential>
</macrodef>
<macrodef name="svn-get">
<attribute name="url" default=""/>
<attribute name="dir" default=""/>
<attribute name="revision" default="HEAD" />
<sequential>
<exec executable="${svn-get.exec}" failonerror="true">
<arg line="-r @{revision}" />
<arg value="@{url}"/>
<arg value="@{dir}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="make">
<attribute name="dir" default="${basedir}"/>
<attribute name="target" default="all" />
<element name="options" optional="true" />
<sequential>
<exec dir="@{dir}" executable="${make.exec}" failonerror="true">
<options/>
<arg line="@{target}" />
</exec>
</sequential>
</macrodef>
<macrodef name="cpan">
<element name="packages" optional="false"/>
<sequential>
<exec executable="${cpan.exec}" failonerror="true">
<packages/>
</exec>
</sequential>
</macrodef>
<!-- main targets -->
<target name="hello">
<echo>
Welcome to ${project.name} ${project.version}.
Through this ANT build you should able to perform some set-up task
to get the system work locally.
Peferably you should use the install 'install' target to customize and install the live system
${user.name}@${basedir}$ ant install
</echo>
</target>
<target name="eclipse.setup">
<get src="http://mirror.lividpenguin.com/pub/apache//commons/math/source/commons-math-2.2-src.zip" dest="${3rdparty.dir}/commons-math-2.2-src.zip" />
</target>
<target name="install.config" unless="install.config">
<input message="Select base command and configuration name"
addproperty="install.name"
defaultvalue="${install.name.default}" />
<condition property="install.name.fail">
<not>
<available file="${conf.dir}/${install.name}.json" />
</not>
</condition>
<fail if="install.name.fail">There is no configuration file available as ${conf.dir}/${install.name}.json for '${install.name}'</fail>
<input message="Installation root directory?"
addproperty="install.dir"
defaultvalue="${install.dir.default}" />
<property name="install.config" value="${install.config.default}" />
<propertyfile file="${install.config}">
<entry key="install.dir" value="${install.dir}" />
<entry key="install.name" value="${install.name}" />
</propertyfile>
</target>
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${3rdparty.dir}" />
</target>
<target name="ivy.init" depends="init">
<get src="${ivy.url}" dest="${ivy.jar}" usetimestamp="true" />
<path id="ivy.classpath">
<pathelement location="${ivy.jar}" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.classpath"/>
<taskdef name="ivy-retrieve" classname="org.apache.ivy.ant.IvyRetrieve"/>
<taskdef name="ivy-cachepath" classname="org.apache.ivy.ant.IvyCachePath"/>
</target>
<target name="test.init" depends="ivy.init">
<ivy-retrieve conf="test"/>
<ivy-cachepath pathid="ivy.cachepath.test" conf="test" type="jar" />
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpathref="ivy.cachepath.test" />
</target>
<target name="samtools.init" depends="init">
<svn-get url="${samtools.url}" dir="${samtools.dir}" revision="${samtools.rev}" />
<make dir="${samtools.dir}/samtools" target="all" />
<make dir="${samtools.dir}/samtools/bcftools" target="all" />
</target>
<target name="bwa.init" depends="init">
<svn-get url="${bwa.url}" dir="${bwa.dir}" revision="${bwa.rev}" />
<make dir="${bwa.dir}" target="all" />
</target>
<target name="picard.init" depends="init">
<svn-get url="${picard.url}" dir="${picard.dir}" revision="${picard.rev}" />
<exec executable="ant" failifexecutionfails="true" dir="${picard.dir}">
<arg line="-lib lib/ant"/>
<arg value="package-commands"/>
</exec>
</target>
<target name="vcftools.init" depends="init">
<svn-get url="${vcftools.url}" dir="${vcftools.dir}" revision="${vcftools.rev}" />
</target>
<target name="samtrak.init" depends="init">
<svn-get url="${samtrak.url}" dir="${samtrak.dir}" revision="${samtrak.rev}" />
</target>
<target name="build" depends="cpp.build,java.build" />
<!-- cpp targets -->
<target name="cpp.init" depends="init, samtools.init">
</target>
<target name="cpp.build" depends="cpp.init, bwa.init">
<mkdir dir="${build.cpp.dir}" />
<mkdir dir="${build.cpp.dir}/obj" />
<mkdir dir="${build.cpp.dir}/bin" />
<make dir="${source.cpp.dir}" target="all" >
<options>
<env key="OBJDIR" value="${build.cpp.dir}/obj" />
<env key="BINDIR" value="${build.cpp.dir}/bin" />
<env key="SRCDIR" value="${source.cpp.dir}" />
<env key="SAMTOOLS_DIR" value="${samtools.dir}" />
<env key="CPP" value="g++" />
</options>
</make>
</target>
<!-- java targets -->
<path id="gatk.classpath">
<fileset dir="${gatk.dir}/dist/">
<include name="**/*.jar"/>
<exclude name="**/malariagen.jar"/>
</fileset>
</path>
<target name="gatk.get" depends="init">
<git-get url="${gatk.url}" dir="${gatk.dir}" commit="${gatk.commit}" branch="${gatk.branch}" patch="${gatk.patch}" />
<condition property="gatk.patched">
<or>
<available file="${gatk.dir}/.patch_applied" property="${gatk.patched}" />
<equals arg1="${gatk.patch}" arg2="NONE" />
</or>
</condition>
<fail message="Gatk was not patched (missing ${gatk.dir}/.patch_applied)" unless="gatk.patched"/>
<available file="${gatk.dir}/.built" property="${gatk.built}" />
</target>
<target name="gatk.build" depends="gatk.get" unless="${gatk.built}">
<ant dir="${gatk.dir}" target="core" inheritAll="false" />
<touch file="${gatk.dir}/.built"/>
</target>
<target name="gatk.init" depends="gatk.build" />
<target name="java.init" depends="gatk.init,ivy.init">
<mkdir dir="${build.java.dir}" />
<mkdir dir="${build.java.dir}/classes" />
<mkdir dir="${build.java.dir}/jars" />
<ivy-retrieve conf="devel"/>
<uptodate property="malariagen.jar.utd" targetfile="${build.java.dir}/jars/malariagen.jar">
<srcfiles dir="${source.java.dir}/main" includes="**/*.java"/>
<srcfiles dir="${gatk.dir}/dist" includes="**/*.jar"/>
</uptodate>
</target>
<target name="malariagen.jar" depends="java.init" unless="malariagen.jar.utd">
<javac srcdir="${source.java.dir}/main" debug="${debug}" destdir="${build.java.dir}/classes" classpathref="gatk.classpath" includeantruntime="false" />
<jar basedir="${build.java.dir}/classes" destfile="${build.java.dir}/jars/malariagen.jar" />
</target>
<target name="java.lib" depends="malariagen.jar">
<copy todir="${build.java.dir}/lib" preservelastmodified="true">
<fileset dir="${gatk.dir}/lib" includes="**/*.jar" />
<fileset dir="${build.java.dir}/jars" includes="malariagen.jar" />
</copy>
<uptodate property="Queue.jar.utd" targetfile="${build.java.dir}/dist/Queue.jar">
<srcfiles dir="${build.java.dir}/lib" includes="**/*.jar"/>
</uptodate>
</target>
<target name="java.build" depends="java.lib" unless="Queue.jar.utd" >
<mkdir dir="${build.java.dir}/dist" />
<ant dir="${gatk.dir}" target="core" inheritAll="false">
<property name="lib.dir" value="${build.java.dir}/lib" />
<property name="dist.dir" value="${build.java.dir}/dist" />
</ant>
</target>
<target name="java.test.build" depends="java.lib, test.init">
<mkdir dir="${build.java.dir}/test-classes" />
<javac srcdir="${source.java.dir}/main" destdir="${build.java.dir}/test-classes" includeantruntime="false" debug="true">
<classpath refid="gatk.classpath" />
<classpath refid="ivy.cachepath.test" />
<classpath>
<pathelement location="${build.java.dir}/classes" />
</classpath>
</javac>
</target>
<target name="java.test" depends="java.test.build, test.init">
<mkdir dir="${build.java.dir}/test-reports" />
<junit>
<classpath refid="gatk.classpath" />
<classpath refid="ivy.cachepath.test" />
<classpath>
<pathelement location="${build.java.dir}/test-classes" />
<pathelement location="${build.java.dir}/classes" />
</classpath>
<batchtest haltonerror="true" todir="${build.java.dir}/test-report" >
<fileset dir="${source.java.dir}/test">
<include name="**/*Test.java" />
<exclude name="**/BaseTest.java" />
<exclude name="**/WalkerTest.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="install-devel">
<antcall target="dist.layout">
<param name="dist.layout.dir" value="${dist.dir}/layout-devel" />
<param name="install.config" value="${resources.dir}/devel.config" />
<param file="${resources.dir}/devel.config" />
</antcall>
</target>
<target name="svn-info">
<svn-info output="myass"/>
</target>
<target name="dist.layout" depends="build,samtrak.init,vcftools.init,picard.init">
<mkdir dir="${dist.layout.dir}/bin" />
<mkdir dir="${dist.layout.dir}/lib/java" />
<mkdir dir="${dist.layout.dir}/lib/perl" />
<mkdir dir="${dist.layout.dir}/resources" />
<copy todir="${dist.layout.dir}/bin">
<fileset dir="${resources.dir}/scripts" />
<filterset filtersfile="${install.config}" />
</copy>
<copy todir="${dist.layout.dir}/bin">
<fileset dir="${build.cpp.dir}/bin" />
<fileset dir="${source.perl.dir}/scripts" />
</copy>
<copy todir="${dist.layout.dir}/bin" flatten="true">
<fileset dir="${samtools.dir}">
<include name="**/samtools/samtools" />
<include name="**/samtools/bcftools/bcftools" />
<include name="**/samtools.pl" />
<include name="**/vcfutils.pl" />
</fileset>
<fileset dir="${bwa.dir}" includes="**/bwa" />
</copy>
<!--svn-info output="${dist.layout.dir}/svn-info.txt" /-->
<move file="${dist.layout.dir}/bin/base" tofile="${dist.layout.dir}/bin/${install.name}" />
<copy todir="${dist.layout.dir}/lib/java">
<fileset dir="${build.java.dir}/dist" />
</copy>
<copy todir="${dist.layout.dir}/lib/java/picard-commands">
<fileset dir="${picard.dir}/dist" includes="**/*.jar" />
</copy>
<copy todir="${dist.layout.dir}/lib/perl">
<fileset dir="${vcftools.dir}/perl" includes="**/*.pm" />
<fileset dir="${samtrak.dir}/modules" />
<fileset dir="${source.perl.dir}/modules" />
</copy>
<copy todir="${dist.layout.dir}/lib/perl" flatten="true">
<fileset dir="${resources.dir}/pgv_pipeline/variation_filtering2">
<include name="**/Variation.pm" />
<include name="**/gff2json.pm" />
</fileset>
</copy>
<copy todir="${dist.layout.dir}/resources">
<fileset dir="${resources.dir}" >
<exclude name="**/test/**" />
<exclude name="**/scripts/**" />
<exclude name="**/*.bam*" />
<exclude name="**/*.vcf*" />
<exclude name="**/*.fa*" />
</fileset>
</copy>
<copy todir="${dist.layout.dir}/resources/gatk/R">
<fileset dir="${gatk.dir}/public/R" />
</copy>
<copy todir="${dist.layout.dir}/conf">
<fileset dir="${conf.dir}" />
<filterset filtersfile="${install.config}" />
</copy>
<chmod perm="a+rx" type="file" dir="${dist.layout.dir}/bin" includes="**/*" />
<chmod perm="a+rx" type="file" dir="${dist.layout.dir}/resources/pgv_pipeline/variation_filtering2" includes="**/*.pl" />
</target>
<target name="install" depends="install.config,dist.layout">
<fail message="Cannot find install configuration ${install.config}">
<condition>
<not>
<available file="${install.config}" type="file" />
</not>
</condition>
</fail>
<property file="${install.config}" />
<fail message="Installation directory not specified in configuration" unless="install.dir" />
<mkdir dir="${install.dir}" />
<copy todir="${install.dir}">
<fileset dir="${dist.layout.dir}" />
</copy>
<chmod perm="a+rx" type="file" dir="${install.dir}/bin" includes="**/*" />
<chmod perm="a+rx" type="file" dir="${install.dir}/resources/pgv_pipeline/variation_filtering2" includes="**/*.pl" />
</target>
<target name="java.clean">
<delete dir="${build.java.dir}" />
</target>
<target name="dist.clean">
<delete dir="${dist.dir}" />
</target>
<target name="dist.layout.clean">
<delete dir="${dist.layout.dir}" />
</target>
<target name="clean" depends="java.clean,dist.layout.clean">
</target>
</project>