forked from broadgsa/gatk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1489 lines (1248 loc) · 68.9 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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!--
~ Copyright (c) 2012, The Broad Institute
~
~ Permission is hereby granted, free of charge, to any person
~ obtaining a copy of this software and associated documentation
~ files (the "Software"), to deal in the Software without
~ restriction, including without limitation the rights to use,
~ copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the
~ Software is furnished to do so, subject to the following
~ conditions:
~
~ The above copyright notice and this permission notice shall be
~ included in all copies or substantial portions of the Software.
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
~ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
~ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
~ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
~ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
~ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
~ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
~ OTHER DEALINGS IN THE SOFTWARE.
-->
<project name="Sting" default="dist" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant"
xmlns:ivy="antlib:org.apache.ivy.ant">
<description>Compile and distribute the Sting toolkit</description>
<!-- ******************************************************************************** -->
<!-- Properties -->
<!-- ******************************************************************************** -->
<!-- The system classpath should take precedence over classpaths specified in this file -->
<property name="build.sysclasspath" value="first" />
<!-- Use this prefix to access environment variables -->
<property environment="env"/>
<!-- Build defaults: -->
<property name="default.build.target" value="all" /> <!-- can be "all", "public" (public only), or "protected" (public + protected) -->
<property name="compile.scala.by.default" value="true" /> <!-- compile Scala by default? "true" or "false" -->
<property name="use.contracts.by.default" value="false" /> <!-- should contracts be built by default? "true" or "false -->
<!-- Top-level directories -->
<property name="build.dir" value="build" />
<property name="dist.dir" value="dist" />
<property name="lib.dir" value="lib" />
<property name="public.dir" value="public" />
<property name="private.dir" value="private" />
<property name="protected.dir" value="protected" />
<property name="external.dir" value="external" />
<!-- Source directories -->
<property name="java.public.source.dir" value="${public.dir}/java/src" />
<property name="java.private.source.dir" value="${private.dir}/java/src" />
<property name="java.protected.source.dir" value="${protected.dir}/java/src" />
<property name="scala.public.source.dir" value="${public.dir}/scala/src" />
<property name="scala.private.source.dir" value="${private.dir}/scala/src" />
<property name="scala.protected.source.dir" value="${protected.dir}/scala/src" />
<property name="queue-extensions.source.dir" value="${build.dir}/queue-extensions/src" />
<property name="R.public.scripts.dir" value="${public.dir}/R/scripts" />
<property name="R.private.scripts.dir" value="${private.dir}/R/scripts" />
<property name="R.protected.scripts.dir" value="${protected.dir}/R/scripts" />
<property name="R.public.src.dir" value="${public.dir}/R/src" />
<!-- Build directories -->
<property name="java.classes" value="${build.dir}/java/classes" />
<property name="scala.classes" value="${build.dir}/scala/classes" />
<property name="R.library.dir" value="${public.dir}/R" /> <!-- TODO: Installing libraries back into the source directory: intentionally avoids ant clean?? -->
<property name="R.tar.dir" value="${build.dir}/R/src" />
<property name="R.package.path" value="org/broadinstitute/sting/utils/R" />
<property name="R.script.staging.dir" value="${build.dir}/R/stage" />
<!-- Packaging system properties -->
<property name="package.xml.dir" value="${public.dir}/packages" />
<property name="package.output.dir" value="${dist.dir}/packages" />
<property name="staging.dir" value="staging" />
<property name="default.executable" value="none" />
<!-- GATKDocs/Javadoc/Scaladoc directories -->
<property name="gatkdocs.dir" value="gatkdocs" />
<property name="javadoc.dir" value="javadoc" />
<property name="scaladoc.dir" value="scaladoc" />
<!-- Resource file used for help text and version information -->
<property name="resource.file" value="StingText.properties" />
<property name="resource.path" value="${java.classes}/StingText.properties" />
<!-- Directory containing cryptographic keys used by the GATK -->
<property name="key.dir" value="${public.dir}/keys" />
<!-- Contracts for Java -->
<!-- Disabled by default -->
<!-- To enable, run with -Duse.contracts=true -->
<property name="java.contracts.dir" value="${build.dir}/java/contracts" />
<property name="contracts.version" value="1.0-r139" />
<property name="cofoja.jar" value="${lib.dir}/cofoja-${contracts.version}.jar"/>
<property name="contract.dump.dir" value="dump" />
<!-- do we want to halt on failure of a unit test? default to yes (Bamboo uses 'no') -->
<property name="halt" value="yes" />
<!-- should our unit test output go to a file or the screen? false means it goes to the screen (default) true to file -->
<property name="usefile" value="false" />
<!-- To run tests with debugging, use -Dtest.debug=true -Dtest.debug.port=XXXX on the command line -->
<property name="test.debug.port" value="5005" /> <!-- override on the command line if desired -->
<property name="test.default.maxmemory" value="4g"/>
<!-- clover parameters -->
<property name="clover.jar" location="private/resources/clover/lib/clover.jar"/>
<property name="clover.instrument.level" value="method"/>
<taskdef resource="cloverlib.xml" classpath="${clover.jar}"/>
<!-- ******************************************************************************** -->
<!-- Filesets and paths -->
<!-- ******************************************************************************** -->
<!-- All the complexity of selecting among public/private/protected should be up here, not down in the targets -->
<patternset id="java.source.directories.pattern">
<include name="${java.public.source.dir}" />
<include name="${java.private.source.dir}" if="include.private" />
<include name="${java.protected.source.dir}" if="include.protected" />
</patternset>
<patternset id="java.source.files.pattern">
<include name="${java.public.source.dir}/**/*.java" />
<include name="${java.private.source.dir}/**/*.java" if="include.private" />
<include name="${java.protected.source.dir}/**/*.java" if="include.protected" />
</patternset>
<patternset id="scala.source.directories.pattern">
<include name="${scala.public.source.dir}" />
<include name="${scala.private.source.dir}" if="include.private" />
<include name="${scala.protected.source.dir}" if="include.protected" />
</patternset>
<patternset id="scala.source.files.pattern">
<include name="${scala.public.source.dir}/**/*.scala" />
<include name="${scala.private.source.dir}/**/*.scala" if="include.private" />
<include name="${scala.protected.source.dir}/**/*.scala" if="include.protected" />
</patternset>
<patternset id="R.script.source.directories.pattern">
<include name="${R.public.scripts.dir}" />
<include name="${R.private.scripts.dir}" if="include.private" />
<include name="${R.protected.scripts.dir}" if="include.protected" />
</patternset>
<patternset id="R.script.source.files.pattern">
<include name="${R.public.scripts.dir}/**/*.R" />
<include name="${R.private.scripts.dir}/**/*.R" if="include.private" />
<include name="${R.protected.scripts.dir}/**.*.R" if="include.protected" />
</patternset>
<path id="java.source.path">
<dirset dir="${basedir}">
<patternset refid="java.source.directories.pattern" />
</dirset>
</path>
<path id="scala.source.path">
<dirset dir="${basedir}">
<patternset refid="scala.source.directories.pattern" />
</dirset>
</path>
<path id="R.script.source.path">
<dirset dir="${basedir}">
<patternset refid="R.script.source.directories.pattern" />
</dirset>
</path>
<fileset id="java.source.files" dir="${basedir}">
<patternset refid="java.source.files.pattern" />
</fileset>
<fileset id="scala.source.files" dir="${basedir}">
<patternset refid="scala.source.files.pattern" />
</fileset>
<fileset id="R.script.source.files" dir="${basedir}">
<patternset refid="R.script.source.files.pattern" />
</fileset>
<fileset id="java.class.files" dir="${java.classes}" erroronmissingdir="false">
<include name="**/*.class"/>
</fileset>
<patternset id="dependency.mask" includes="*.jar" />
<path id="external.dependencies">
<fileset dir="${lib.dir}" erroronmissingdir="false">
<patternset refid="dependency.mask" />
</fileset>
</path>
<path id="scala.dependencies">
<path refid="external.dependencies" />
<pathelement location="${java.classes}" />
<!-- Need the resources as we will be running a command line program which needs the help text. -->
<pathelement location="${resource.path}" />
<!-- Add any previously compiled scala classes to the path. -->
<pathelement location="${scala.classes}" />
</path>
<path id="build.results">
<!-- Ensure that GenomeAnalysisTK.jar comes first in the path, as it contains overrides for certain classes in our dependencies -->
<pathelement location="${dist.dir}/GenomeAnalysisTK.jar" />
<!-- After GenomeAnalysisTK.jar we include all of the other jars in the dist directory -->
<fileset dir="${dist.dir}" erroronmissingdir="false">
<patternset refid="dependency.mask" />
<exclude name="GenomeAnalysisTK.jar" />
</fileset>
</path>
<fileset id="external.source.files" dir="${external.dir}" erroronmissingdir="false">
<include name="**/*.java" />
</fileset>
<path id="external.build.dir">
<path path="${java.classes}" />
</path>
<path id="external.dist.dir">
<path path="${dist.dir}" />
</path>
<!-- GATK dependencies consist of 3rd party plugins plus compiled GATK classes -->
<path id="external.gatk.classpath">
<path path="${java.classes}"/>
<path refid="external.dependencies" />
</path>
<!-- the path for resources that need to go into the GATK jar;
any additional resources should go into this set. -->
<path id="gatk.resources">
<fileset dir="${java.public.source.dir}">
<include name="**/resources/*" />
<include name="**/templates/*" />
</fileset>
<fileset dir="${java.private.source.dir}" erroronmissingdir="false">
<include name="**/resources/*" if="include.private" />
<include name="**/templates/*" if="include.private" />
</fileset>
<fileset dir="${java.protected.source.dir}" erroronmissingdir="false">
<include name="**/resources/*" if="include.protected" />
<include name="**/templates/*" if="include.protected" />
</fileset>
</path>
<!-- ******************************************************************************** -->
<!-- Ivy Retrieve -->
<!-- ******************************************************************************** -->
<target name="init.resolve" unless="init.resolve.done">
<!-- ivy properties -->
<property name="ivy.install.version" value="2.2.0"/>
<property name="ivy.home" value="${user.home}/.ant"/>
<property name="ivy.jar.dir" value="${ivy.home}/${lib.dir}"/>
<property name="ivy.jar.file" value="ivy-${ivy.install.version}.jar"/>
<property name="ivy.settings.dir" value="settings"/>
<property file="${ivy.settings.dir}/ivysettings.properties"/>
<property name="maven-ant-tasks.install.version" value="2.1.3"/>
<property name="maven-ant-tasks.jar.file" value="maven-ant-tasks-${maven-ant-tasks.install.version}.jar"/>
<mkdir dir="${lib.dir}"/>
<mkdir dir="${ivy.jar.dir}"/>
<!-- Comment out the following lines to build the GATK without a network connection, assuming you have all of the libraries cached already -->
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/${ivy.jar.file}"
dest="${ivy.jar.dir}/${ivy.jar.file}"
usetimestamp="true"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
classpath="${ivy.jar.dir}/${ivy.jar.file}"/>
<get src="http://repo1.maven.org/maven2/org/apache/maven/maven-ant-tasks/${maven-ant-tasks.install.version}/${maven-ant-tasks.jar.file}"
dest="${ivy.jar.dir}/${maven-ant-tasks.jar.file}"
usetimestamp="true"/>
<taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:antlib:org.apache.maven.artifact.ant"
classpath="${ivy.jar.dir}/${maven-ant-tasks.jar.file}"/>
<!-- End network lines -->
<ivy:settings file="${ivy.settings.dir}/ivysettings.xml"/>
<property name="init.resolve.done" value="true"/>
</target>
<target name="resolve" depends="init.resolve,init" description="locate and download library dependencies">
<property name="ivy.conf" value="default"/>
<ivy:retrieve file="ivy.xml" conf="${ivy.conf}" />
<!-- Remove old versions of ivy jars AFTER the ivy:retrieve has been class loaded. -->
<delete file="${ivy.jar.dir}/ivy-2.0.0.jar"/>
<delete file="${ivy.jar.dir}/ivy-2.2.0-rc1.jar"/>
</target>
<!-- ******************************************************************************** -->
<!-- Initialization -->
<!-- ******************************************************************************** -->
<!-- Targets for generating the build version -->
<target name="git.describe">
<exec executable="git" outputproperty="git.describe.output" resultproperty="git.describe.exit.value" failonerror="false">
<arg line="describe --long" />
</exec>
<condition property="git.describe.succeeded">
<equals arg1="${git.describe.exit.value}" arg2="0" />
</condition>
</target>
<target name="tagged.build.version" depends="git.describe" if="git.describe.succeeded">
<property name="build.version" value="${git.describe.output}" />
</target>
<target name="git.rev-parse" depends="git.describe" unless="git.describe.succeeded">
<exec executable="git" outputproperty="git.rev-parse.output" resultproperty="git.rev-parse.exit.value" failonerror="false">
<arg line="rev-parse --short HEAD" />
</exec>
<condition property="git.rev-parse.succeeded">
<equals arg1="${git.rev-parse.exit.value}" arg2="0" />
</condition>
</target>
<target name="untagged.build.version" depends="git.rev-parse" if="git.rev-parse.succeeded">
<property name="build.version" value="${git.rev-parse.output}" />
</target>
<target name="generate.build.version" depends="tagged.build.version, untagged.build.version">
<!-- Set build.version to exported if no other value has been set -->
<property name="build.version" value="exported" />
</target>
<!-- INIT OVERRIDES: call these targets BEFORE init to override build defaults -->
<target name="init.build.publiconly">
<property name="build.target" value="public" />
</target>
<target name="init.build.publicprotectedonly">
<property name="build.target" value="protected" />
</target>
<target name="init.build.all">
<property name="build.target" value="all" />
</target>
<target name="init.javaonly">
<property name="compile.scala" value="false" />
</target>
<target name="init.javaandscala">
<property name="compile.scala" value="true" />
</target>
<target name="init.usecontracts">
<property name="use.contracts" value="true" />
</target>
<!-- INIT -->
<target name="init" depends="generate.build.version">
<tstamp>
<format property="build.timestamp" pattern="yyyy/MM/dd HH:mm:ss"/>
</tstamp>
<!-- These properties should be overridden before init is called if the defaults are not desired -->
<property name="build.target" value="${default.build.target}" />
<property name="compile.scala" value="${compile.scala.by.default}" />
<property name="use.contracts" value="${use.contracts.by.default}" />
<property name="executable" value="${default.executable}" />
<!-- Determine what should be built -->
<condition property="include.scala">
<equals arg1="${compile.scala}" arg2="true" />
</condition>
<condition property="include.private">
<and>
<available file="${private.dir}" />
<equals arg1="${build.target}" arg2="all" />
</and>
</condition>
<condition property="include.protected">
<and>
<available file="${protected.dir}" />
<or>
<equals arg1="${build.target}" arg2="all" />
<equals arg1="${build.target}" arg2="protected" />
</or>
</and>
</condition>
<condition property="include.contracts">
<equals arg1="${use.contracts}" arg2="true" />
</condition>
<condition property="include.external">
<available file="${external.dir}"/>
</condition>
<!-- Construct display strings for the build properties print out -->
<condition property="include.scala.display.string" value="yes" else="no">
<isset property="include.scala" />
</condition>
<condition property="include.private.display.string" value="yes" else="no">
<isset property="include.private" />
</condition>
<condition property="include.protected.display.string" value="yes" else="no">
<isset property="include.protected" />
</condition>
<condition property="include.external.display.string" value="yes" else="no">
<isset property="include.external" />
</condition>
<condition property="include.contracts.display.string" value="yes" else="no">
<isset property="include.contracts" />
</condition>
<!-- Print out build properties -->
<echo message="BUILD PROPERTIES" />
<echo message="Include Scala? : ${include.scala.display.string}" />
<echo message="Include Private? : ${include.private.display.string}" />
<echo message="Include Protected? : ${include.protected.display.string}" />
<echo message="Include External? : ${include.external.display.string}" />
<echo message="Include Contracts? : ${include.contracts.display.string}" />
<echo message="Source revision : ${build.version}" />
<echo message="Build time : ${build.timestamp}" />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${lib.dir}"/>
<mkdir dir="${java.classes}"/>
<mkdir dir="${java.contracts.dir}"/>
</target>
<!-- ******************************************************************************** -->
<!-- Java Compilation -->
<!-- ******************************************************************************** -->
<target name="gatk.compile.internal.source" depends="init,resolve">
<javac fork="true" memoryMaximumSize="512m" destdir="${java.classes}" debug="true" debuglevel="lines,vars,source" classpathref="external.dependencies" tempdir="${java.io.tmpdir}">
<src refid="java.source.path" />
<compilerarg value="-proc:none" />
</javac>
</target>
<target name="gatk.compile.external.source" depends="gatk.compile.internal.source" if="include.external">
<subant target="compile" genericantfile="build.xml">
<property name="build.dir" refid="external.build.dir" />
<property name="dist.dir" refid="external.dist.dir" />
<property name="gatk.classpath" refid="external.gatk.classpath" />
<fileset dir="${external.dir}" includes="*/build.xml" erroronmissingdir="false" />
</subant>
</target>
<target name="gatk.compile.source" depends="gatk.compile.internal.source,gatk.compile.external.source" description="Compile the GATK source" />
<target name="gatk.contracts" depends="gatk.compile.source" if="include.contracts">
<javac fork="true" memoryMaximumSize="512m" destdir="${java.contracts.dir}" debug="true" debuglevel="lines,vars,source" tempdir="${java.io.tmpdir}" >
<src refid="java.source.path" />
<classpath>
<path refid="external.dependencies" />
<pathelement path="${java.classes}" />
</classpath>
<compilerarg value="-Acom.google.java.contract.debug"/>
<compilerarg value="-Acom.google.java.contract.dump=${contract.dump.dir}"/>
<compilerarg value="-proc:only"/>
</javac>
</target>
<target name="gatk.compile" depends="init,resolve,gatk.compile.source,gatk.contracts" />
<!-- ******************************************************************************** -->
<!-- Scala Compilation -->
<!-- ******************************************************************************** -->
<target name="init.queue-extensions.generate" depends="gatk.compile">
<condition property="uptodate.queue-extensions.generate">
<or>
<not>
<isset property="include.scala"/>
</not>
<uptodate targetfile="${queue-extensions.source.dir}">
<srcfiles refid="java.class.files"/>
<srcfiles file="${queue-extensions.gatk.jar}"/>
</uptodate>
</or>
</condition>
</target>
<!-- NOTE: Extracting help first to avoid "Unable to load help text. Help output will be sparse." warning message. -->
<target name="queue-extensions.generate" depends="gatk.compile,extracthelp,init.queue-extensions.generate" unless="uptodate.queue-extensions.generate" description="generate GATK modules for Queue">
<mkdir dir="${queue-extensions.source.dir}"/>
<echo>Generating Queue GATK extensions...</echo>
<java fork="true" failonerror="true" classname="org.broadinstitute.sting.queue.extensions.gatk.GATKExtensionsGenerator" >
<arg value="-outDir" />
<arg path="${queue-extensions.source.dir}" />
<arg value="-l" />
<arg value="WARN" />
<classpath>
<file file="${queue-extensions.gatk.jar}"/>
<path refid="scala.dependencies"/>
</classpath>
</java>
<touch>
<file file="${queue-extensions.source.dir}"/>
</touch>
</target>
<target name="init.scala.compile" depends="resolve" description="Initializes the scala ant tasks from scala-compiler.jar">
<path id="scala.classpath">
<fileset dir="${lib.dir}">
<include name="scala-compiler-*.jar"/>
<include name="scala-library-*.jar"/>
</fileset>
</path>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath refid="scala.classpath"/>
</taskdef>
</target>
<!-- Scala depends on the java compile -->
<target name="scala.compile" depends="init,resolve,gatk.compile,queue-extensions.generate,init.scala.compile" if="include.scala">
<mkdir dir="${scala.classes}"/>
<echo>Building Scala...</echo>
<scalac fork="true" jvmargs="-Xmx512m" destdir="${scala.classes}" classpathref="scala.dependencies" deprecation="yes" unchecked="yes">
<src refid="scala.source.path" />
<src path="${queue-extensions.source.dir}" />
<include name="**/*.scala" />
</scalac>
</target>
<!-- ******************************************************************************** -->
<!-- Sting Resource File Generation -->
<!-- ******************************************************************************** -->
<target name="init.extracthelp" depends="gatk.compile">
<loadfile property="properties.version" srcfile="${basedir}/${resource.path}" failonerror="false" quiet="true">
<filterchain>
<linecontains>
<contains value="org.broadinstitute.sting.gatk.CommandLineGATK.version"/>
</linecontains>
<tokenfilter>
<replaceregex pattern="^.*\.(.*?)$" replace="\1"/>
</tokenfilter>
<striplinebreaks/>
</filterchain>
</loadfile>
<!-- This fileset will contain only source files modified since the resource file was last generated,
or all source files if the resource file doesn't exist -->
<fileset dir="${basedir}" id="modified.source.files">
<patternset refid="java.source.files.pattern" />
<include name="${external.dir}/**/*.java"/>
<depend targetdir="${basedir}">
<mapper type="merge" to="${resource.path}"/>
</depend>
</fileset>
<!-- Set the sources.modified property only if our fileset of modified source files is non-empty -->
<pathconvert refid="modified.source.files" property="sources.modified" setonempty="false"/>
<!-- Due to a limitation in the doclet API, we always need to pass package-info files to javadoc -->
<fileset dir="${basedir}" id="package.info.files">
<include name="${java.public.source.dir}/**/package-info.java"/>
<include name="${java.private.source.dir}/**/package-info.java" if="include.private" />
<include name="${java.protected.source.dir}/**/package-info.java" if="include.protected" />
<include name="${external.dir}/**/package-info.java"/>
</fileset>
<condition property="uptodate.extracthelp">
<or>
<isset property="disable.help"/>
<and>
<not>
<isset property="sources.modified"/>
</not>
<equals arg1="${properties.version}" arg2="${build.version}"/>
</and>
</or>
</condition>
</target>
<target name="extracthelp" depends="init.extracthelp" unless="uptodate.extracthelp"
description="Extract help key/value pair file from the JavaDoc tags.">
<path id="doclet.classpath">
<path refid="external.dependencies" />
<pathelement location="${java.classes}" />
<pathelement location="${clover.jar}" />
</path>
<javadoc doclet="org.broadinstitute.sting.utils.help.ResourceBundleExtractorDoclet"
docletpathref="doclet.classpath"
classpathref="external.dependencies"
classpath="${java.classes}"
maxmemory="2g"
additionalparam="-build-timestamp "${build.timestamp}" -absolute-version ${build.version} -out ${basedir}/${resource.path} -quiet">
<sourcefiles>
<union>
<fileset refid="modified.source.files"/>
<fileset refid="package.info.files"/>
</union>
</sourcefiles>
</javadoc>
</target>
<!-- ******************************************************************************** -->
<!-- Build Jars -->
<!-- ******************************************************************************** -->
<target name="sting.compile" depends="gatk.compile, scala.compile" />
<target name="init.jar" depends="sting.compile,extracthelp">
<mkdir dir="${dist.dir}"/>
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}" includes="*.jar"/>
</copy>
</target>
<target name="R.public.tar">
<mkdir dir="${R.tar.dir}/${R.package.path}" />
<tar compression="gzip" basedir="${R.public.src.dir}/${R.package.path}" includes="gsalib/**" destfile="${R.tar.dir}/${R.package.path}/gsalib.tar.gz" />
</target>
<target name="R.script.stage">
<mkdir dir="${R.script.staging.dir}" />
<copy todir="${R.script.staging.dir}" overwrite="true">
<fileset refid="R.script.source.files" />
<!-- remove the initial path components (eg., public/R/scripts) when doing the copy -->
<!-- ant 1.8.2 has a cutdirsmapper, but ant versions < 1.8.2 are too common to use it -->
<mapper type="regexp" from="^(${R.public.scripts.dir}|${R.private.scripts.dir}|${R.protected.scripts.dir})/(.*)" to="\2" />
</copy>
</target>
<target name="sting-utils.jar" depends="gatk.compile, init.jar, R.public.tar, R.script.stage">
<jar jarfile="${dist.dir}/StingUtils.jar">
<fileset dir="${java.classes}" includes="**/sting/utils/**/*.class"/>
<fileset dir="${java.classes}" includes="**/sting/commandline/**/*.class"/>
<fileset dir="${java.classes}" includes="**/sting/pipeline/**/*.class"/>
<fileset dir="${java.classes}" includes="**/sting/tools/**/*.class"/>
<fileset dir="${java.classes}" includes="**/sting/jna/**/*.class"/>
<fileset dir="${java.classes}" includes="net/sf/picard/**/*.class"/>
<fileset dir="${java.classes}" includes="net/sf/samtools/**/*.class"/>
<fileset dir="${R.tar.dir}">
<include name="**/${R.package.path}/**/*.tar.gz"/>
</fileset>
<fileset dir="${R.script.staging.dir}">
<include name="**/sting/utils/**/*.R"/>
</fileset>
<manifest>
<attribute name="Premain-Class" value="org.broadinstitute.sting.utils.instrumentation.Sizeof" />
</manifest>
</jar>
</target>
<target name="na12878kb.jar" depends="gatk.compile,init.jar">
<jar jarfile="${dist.dir}/na12878kb.jar">
<fileset dir="${java.classes}">
<include name="org/broadinstitute/sting/utils/GenomeLocParser*.class"/>
<include name="org/broadinstitute/sting/utils/GenomeLoc.class"/>
<include name="org/broadinstitute/sting/utils/HasGenomeLocation.class"/>
<include name="org/broadinstitute/sting/utils/BaseUtils*.class"/>
<include name="org/broadinstitute/sting/utils/Utils.class"/>
<include name="org/broadinstitute/sting/utils/MRUCaching*.class"/>
<include name="org/broadinstitute/sting/utils/exceptions/**/*.class"/>
<include name="org/broadinstitute/sting/gatk/walkers/na12878kb/core/**/*.class"/>
<include name="net/sf/picard/reference/FastaSequenceFile.class"/>
</fileset>
<fileset dir="${java.private.source.dir}">
<include name="org/broadinstitute/sting/gatk/walkers/na12878kb/core/resources/**/*"/>
</fileset>
</jar>
</target>
<target name="gatk.jar" depends="gatk.compile, init.jar, R.script.stage" description="generate the GATK distribution">
<jar jarfile="${dist.dir}/GenomeAnalysisTK.jar">
<path refid="gatk.resources"/>
<fileset dir="${java.contracts.dir}" />
<fileset dir="${java.classes}">
<include name="${resource.file}" />
<include name="**/sting/gatk/**/*.class" />
<include name="**/sting/alignment/**/*.class"/>
</fileset>
<fileset dir="${R.script.staging.dir}">
<include name="**/sting/gatk/**/*.R"/>
<include name="**/sting/alignment/**/*.R"/>
</fileset>
<fileset dir="${key.dir}">
<include name="**/*.key"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="org.broadinstitute.sting.gatk.CommandLineGATK" />
</manifest>
</jar>
<jar jarfile="${dist.dir}/Aligner.jar">
<fileset dir="${java.classes}" includes="**/sting/alignment/**/*.class" />
</jar>
<subant target="dist" genericantfile="build.xml">
<property name="build.dir" refid="external.build.dir" />
<property name="dist.dir" refid="external.dist.dir" />
<property name="gatk.classpath" refid="external.gatk.classpath" />
<fileset dir="${external.dir}" includes="*/build.xml" erroronmissingdir="false" />
</subant>
</target>
<target name="scala.jar" depends="scala.compile, init.jar" if="include.scala">
<jar jarfile="${dist.dir}/GATKScala.jar">
<fileset dir="${scala.classes}">
<include name="org/broadinstitute/sting/scala/**/*.class"/>
</fileset>
</jar>
</target>
<target name="queue.jar" depends="scala.compile, init.jar, R.script.stage" if="include.scala">
<jar jarfile="${dist.dir}/Queue.jar">
<fileset dir="${scala.classes}">
<include name="org/broadinstitute/sting/queue/**/*.class"/>
</fileset>
<fileset dir="${java.classes}">
<include name="org/broadinstitute/sting/queue/**/*.class" />
</fileset>
<fileset dir="${R.script.staging.dir}">
<include name="org/broadinstitute/sting/queue/**/*.R"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="org.broadinstitute.sting.queue.QCommandLine" />
</manifest>
</jar>
</target>
<target name="sting.jar" depends="sting-utils.jar, gatk.jar, queue.jar" />
<target name="init.manifests" depends="sting.jar">
<pathconvert property="jar.classpath" pathsep=" ">
<flattenmapper/>
<fileset dir="${dist.dir}" includes="*.jar"/>
<filelist files="GATKScala.jar"/>
</pathconvert>
</target>
<target name="sting-utils.manifests" depends="sting-utils.jar, init.manifests">
<jar jarfile="${dist.dir}/StingUtils.jar" update="true">
<manifest>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</jar>
</target>
<target name="gatk.manifests" depends="gatk.jar, init.manifests">
<jar jarfile="${dist.dir}/GenomeAnalysisTK.jar" update="true">
<manifest>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</jar>
</target>
<target name="queue.manifests" depends="queue.jar, init.manifests" if="include.scala">
<jar jarfile="${dist.dir}/Queue.jar" update="true" >
<manifest>
<attribute name="Class-Path" value="${jar.classpath}" />
</manifest>
</jar>
</target>
<target name="sting.manifests" depends="sting-utils.manifests, gatk.manifests, queue.manifests" />
<!-- ******************************************************************************** -->
<!-- Top-Level Build Targets -->
<!-- ******************************************************************************** -->
<target name="dist" depends="sting.manifests" />
<target name="gatk" depends="init.javaonly, sting.manifests" />
<target name="queue" depends="dist" /> <!-- Obsolete target. Now just an alias for dist -->
<target name="scala" depends="scala.jar" description="build the scala directory" />
<!-- ******************************************************************************** -->
<!-- GATKDocs -->
<!-- ******************************************************************************** -->
<target name="gatkdocs" depends="gatk.compile" description="Extract help key/value pair file from the JavaDoc tags.">
<path id="doclet.classpath">
<path refid="external.dependencies" />
<pathelement location="${java.classes}" />
</path>
<!-- Run with -Dgatkdocs.include.hidden=true to include documentation for hidden features -->
<condition property="gatkdocs.include.hidden.arg" value="-include-hidden" else="">
<isset property="gatkdocs.include.hidden" />
</condition>
<javadoc doclet="org.broadinstitute.sting.utils.help.GATKDoclet"
docletpathref="doclet.classpath"
classpathref="external.dependencies"
classpath="${java.classes}"
maxmemory="2g"
additionalparam="${gatkdocs.include.hidden.arg} -private -build-timestamp "${build.timestamp}" -absolute-version ${build.version} -quiet"> <!-- -test to only do DocumentationTest walker -->
<sourcefiles>
<fileset refid="java.source.files"/>
</sourcefiles>
</javadoc>
</target>
<!-- ******************************************************************************** -->
<!-- Javadoc -->
<!-- ******************************************************************************** -->
<target name="init.javadoc">
<mkdir dir="${javadoc.dir}" />
</target>
<target name="javadoc" depends="init.javadoc,resolve">
<javadoc destdir="${javadoc.dir}" classpathref="external.dependencies">
<fileset refid="java.source.files" />
<sourcepath path="${external.dir}" />
</javadoc>
</target>
<!-- ******************************************************************************** -->
<!-- Scaladoc -->
<!-- ******************************************************************************** -->
<target name="init.scaladoc">
<mkdir dir="${scaladoc.dir}" />
</target>
<!-- NOTE: the scaladoc target requires that the environment variable ANT_OPTS has been set to "-Xmx1G" -->
<target name="scaladoc" depends="resolve,queue-extensions.generate,init.scala.compile,scala.compile,init.scaladoc">
<scaladoc srcdir="${basedir}" destdir="${scaladoc.dir}" classpathref="scala.dependencies" deprecation="yes" unchecked="yes">
<patternset refid="scala.source.files.pattern" />
<include name="${queue-extensions.source.dir}/**/*.scala" />
</scaladoc>
</target>
<!-- ******************************************************************************** -->
<!-- Release-related tasks -->
<!-- ******************************************************************************** -->
<target name="init.executable.gatkfull" depends="init.build.publicprotectedonly, init.javaonly">
<property name="executable" value="GenomeAnalysisTK" />
</target>
<target name="init.executable.gatkall" depends="init.build.all, init.javaonly">
<property name="executable" value="GenomeAnalysisTK" />
</target>
<target name="init.executable.queuefull" depends="init.build.publicprotectedonly, init.javaandscala">
<property name="executable" value="Queue" />
</target>
<target name="init.executable.queueall" depends="init.build.all, init.javaandscala">
<property name="executable" value="Queue" />
</target>
<target name="require.executable">
<condition property="no.executable.defined">
<or>
<equals arg1="${executable}" arg2="none" />
<equals arg1="${executable}" arg2="$${executable}" />
</or>
</condition>
<fail message="No executable defined. Call a more specific packaging/release target, or define an executable manually" if="no.executable.defined" />
</target>
<!-- Unzip all classes from their current locations and assemble them in a staging directory -->
<target name="stage" description="stage files for distribution">
<mkdir dir="${staging.dir}"/>
<!--
HACK: Create the edu directory before EDU on case-insensitive mac filesystems.
The ivy dependency colt -> concurrent contains an EDU.oswego package which
BCEL doesn't even pull in but messes up edu.mit.broad.
-->
<mkdir dir="${staging.dir}/edu"/>
<unjar dest="${staging.dir}" overwrite="false">
<fileset dir="${dist.dir}">
<patternset refid="dependency.mask" />
</fileset>
</unjar>
<!-- HACK: The GATK jar itself contains overrides for some core classes. Make sure the GATK.jar is unrolled last. -->
<unjar dest="${staging.dir}" overwrite="true">
<fileset dir="${dist.dir}" includes="**/GenomeAnalysisTK.jar"/>
</unjar>
</target>
<!-- Build a package consisting of all supporting files. Don't call this target directly. Call one of the specific packaging targets below -->
<target name="package" depends="require.clean,dist,stage,require.executable" description="bundle up an executable for distribution">
<mkdir dir="${package.output.dir}" />
<xslt destdir="${package.output.dir}" style="${package.xml.dir}/CreatePackager.xsl" useImplicitFileset="false">
<flattenmapper/>
<fileset dir="${package.xml.dir}">
<include name="${executable}.xml" />
</fileset>
<fileset dir="${external.dir}" erroronmissingdir="false">
<include name="*/${executable}.xml" />
</fileset>
</xslt>
<ant antfile="${package.output.dir}/${executable}.xml" target="package" />
</target>
<!-- Package specific versions of the GATK/Queue. ALWAYS do an ant clean before invoking these! -->
<!-- GATK "full" == public + protected, ie., the standard binary release of the GATK -->
<target name="package.gatk.full" depends="init.executable.gatkfull,package" />
<!-- GATK "all" == public + protected + private. Should never be publicly released -->
<target name="package.gatk.all" depends="init.executable.gatkall,package" />
<target name="package.queue.full" depends="init.executable.queuefull,package" />
<target name="package.queue.all" depends="init.executable.queueall,package" />
<!-- Release a build. Don't call this target directly. Call one of the specific release targets below -->
<target name="release" depends="require.executable" description="release a build, putting each file in a location specified by the package">
<ant antfile="${package.output.dir}/${executable}.xml" target="release" />
</target>
<!-- Release specific versions of the GATK/Queue. ALWAYS do an ant clean before invoking these! -->
<target name="release.gatk.full" depends="package.gatk.full,release" />
<target name="release.queue.full" depends="package.queue.full,release" />
<!-- Build a subset of picard with only those classes we need by completely abusing the packaging system -->
<!-- TODO: Reuse as much as possible of the 'stage' and 'package' targets -->
<target name="build-picard-private" depends="resolve">
<!-- Build out a classpath -->
<pathconvert property="required.picard.jars" pathsep=":">
<fileset dir="${basedir}">
<include name="${staging.dir}" />
<include name="${lib.dir}/picard-*.*.*.jar" />
<include name="${lib.dir}/sam-*.jar" />
</fileset>
</pathconvert>
<echo message="required.picard.jars=${required.picard.jars}" />
<!-- Stage picard-private -->
<delete dir="${staging.dir}" />
<mkdir dir="${staging.dir}" />
<unjar src="${picard.dist.dir}/picard-private.jar" dest="${staging.dir}" overwrite="true" />
<!-- Use the packaging system to extract parts of picard-private we need -->
<mkdir dir="${package.output.dir}" />
<xslt in="${package.xml.dir}/PicardPrivate.xml" out="${package.output.dir}/BuildPicardPrivate.xml" style="${package.xml.dir}/CreatePackager.xsl" />
<ant antfile="${package.output.dir}/BuildPicardPrivate.xml">
<property name="additional.jars" value="${required.picard.jars}" />
</ant>
</target>
<!-- Maven install a package consisting of all supporting files. Don't call this target directly. Call one of the specific packaging targets below -->
<target name="mvninstall" depends="package" description="maven install a package into .m2/repository">
<property name="mvn.build.version" value="0.0.2" />
<!--
We should use the build version or better yet a git tag version, but tags are currently missing. Alternatively how do we then depend on the LATEST?
<property name="mvn.build.version" value="${build.version}" />
-->
<artifact:pom id="${executable}.pom" groupId="org.broadinstitute.sting" artifactId="${executable}" version="${mvn.build.version}" name="${executable}" />
<artifact:writepom pomRefId="${executable}.pom" file="${package.output.dir}/${executable}-${build.version}/${executable}.pom.xml"/>
<artifact:install file="${package.output.dir}/${executable}-${build.version}/${executable}.jar">
<artifact:pom file="${package.output.dir}/${executable}-${build.version}/${executable}.pom.xml" />
</artifact:install>
</target>
<!-- Maven install specific versions of the GATK/Queue. ALWAYS do an ant clean before invoking these! -->
<target name="mvninstall.gatk.full" depends="package.gatk.full,mvninstall" />
<target name="mvninstall.queue.all" depends="package.queue.all,mvninstall" />
<target name="mvninstall.queue.full" depends="package.queue.full,mvninstall" />
<!-- ******************************************************************************** -->
<!-- Clean -->
<!-- ******************************************************************************** -->
<target name="clean.gatkdocs">