forked from samtools/htsjdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·274 lines (246 loc) · 11.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
<?xml version="1.0"?>
<!--
~ The MIT License
~
~ Copyright (c) 2009 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="htsjdk" basedir="." default="all">
<property name="src" value="src/java"/>
<property name="src.test" value="src/tests"/>
<property name="src.test.java" value="${src.test}/java"/>
<property name="lib" value="lib"/>
<property name="dist" value="dist"/>
<property name="classes" value="classes"/>
<property name="classes.test" value="testclasses"/>
<property name="scripts" value="src/scripts"/>
<property name="test.output" value="dist/test"/>
<property name="javac.target" value="1.6"/>
<property name="javac.debug" value="true"/>
<!-- Get GIT hash, if available, otherwise leave it blank. -->
<exec executable="git" outputproperty="repository.revision" failifexecutionfails="true" errorproperty="">
<arg value="log"/>
<arg value="-1"/>
<arg value="--pretty=format:%H_%at"/>
</exec>
<property name="repository.revision" value=""/>
<property name="htsjdk-version" value="1.118"/>
<property name="htsjdk-version-xml" value="htsjdk.version.property.xml"/>
<property name="testng.verbosity" value="2"/>
<property name="test.debug.port" value="5005" /> <!-- override on the command line if desired -->
<condition property="isUnix">
<os family="unix"/>
</condition>
<target name="set_excluded_test_groups_unix" if="isUnix">
<property name="excludedTestGroups" value="slow, broken"/>
</target>
<target name="set_excluded_test_groups_non_unix" unless="isUnix">
<property name="excludedTestGroups" value="slow, broken, unix"/>
</target>
<target name="set_excluded_test_groups" depends="set_excluded_test_groups_unix,set_excluded_test_groups_non_unix"/>
<!-- VERSION PROPERTY -->
<target name="write-version-property">
<propertyfile
file="${htsjdk-version-xml}"
comment="htsjdk version">
<entry key="htsjdk-version" value="${htsjdk-version}"/>
</propertyfile>
</target>
<!-- INIT -->
<target name="init" depends="write-version-property">
<path id="classpath">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</path>
</target>
<!-- CLEAN -->
<target name="clean">
<delete dir="${classes}"/>
<delete dir="${classes.test}"/>
<delete dir="${test.output}"/>
<delete dir="${dist}"/>
<delete dir="javadoc"/>
<delete file="${htsjdk-version-xml}"/>
</target>
<!-- COMPILE -->
<target name="compile" depends="compile-src, compile-tests"
description="Compile files without cleaning">
</target>
<target name="compile-src" depends="compile-samtools, compile-tribble, compile-variant" description="Compile files without cleaning"/>
<target name="compile-samtools" depends="init" description="Compile sam-samtools files without cleaning">
<compile-src includes="htsjdk/samtools/**/*.*"/>
</target>
<target name="compile-tribble" depends="init, compile-samtools" description="Compile tribble files without cleaning">
<compile-src includes="htsjdk/tribble/**/*.*"/>
</target>
<target name="compile-variant" depends="init, compile-tribble" description="Compile variant files without cleaning">
<compile-src includes="htsjdk/variant/**/*.*" compiler.args="-proc:none"/>
</target>
<target name="compile-tests" depends="compile-samtools-tests, compile-tribble-tests, compile-variant-tests" description="Compile test files without cleaning"/>
<target name="compile-samtools-tests" depends="init" description="Compile samtools test files without cleaning">
<compile-tests includes="htsjdk/samtools/**/*.*"/>
</target>
<target name="compile-tribble-tests" depends="init" description="Compile tribble test files without cleaning">
<compile-tests includes="htsjdk/tribble/**/*.*"/>
</target>
<target name="compile-variant-tests" depends="init" description="Compile variant test files without cleaning">
<compile-tests includes="htsjdk/variant/**/*.*" compiler.args="-proc:none"/>
</target>
<!-- TEST -->
<target name="test" depends="compile, set_excluded_test_groups" description="Run unit tests">
<taskdef resource="testngtasks" classpathref="classpath"/>
<testng suitename="htsjdk-tests" classpathref="classpath" outputdir="${test.output}"
failureproperty="tests.failed" excludedgroups="${excludedTestGroups}" workingDir="${basedir}"
verbose="${testng.verbosity}">
<classpath>
<pathelement path="${classes}"/>
<pathelement path="${classes.test}"/>
<pathelement path="${scripts}"/>
</classpath>
<classfileset dir="${classes.test}">
<include name="**/Test*.class"/>
<include name="**/*Test.class"/>
</classfileset>
<jvmarg value="-Xmx2G"/>
</testng>
<junitreport todir="${dist}/test" >
<fileset dir="${test.output}">
<include name="*.xml"/>
</fileset>
<report format="noframes" todir="${dist}/test" styledir="etc/test"/>
</junitreport>
<copy file="etc/test/testng.css" todir="${dist}/test" overwrite="true"/>
<fail if="tests.failed" message="There were failed unit tests"/>
</target>
<target name="single-test"
depends="compile, compile-tests"
description="Compile and run a single test.">
<taskdef resource="testngtasks" classpathref="classpath"/>
<fail unless="name" message="Please provide input test: -Dname=..." />
<condition property="debug.jvm.args" value="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${test.debug.port}" else="">
<isset property="test.debug" />
</condition>
<testng suitename="htsjdk-single-test" classpathref="classpath" outputdir="${test.output}"
verbose="${testng.verbosity}">
<jvmarg line="-Xmx512M ${debug.jvm.args}"/>
<classpath>
<pathelement path="${classes}"/>
<pathelement path="${classes.test}"/>
<pathelement path="${scripts}"/>
</classpath>
<classfileset dir="${classes.test}">
<include name="**/${name}.class"/>
</classfileset>
</testng>
</target>
<target name="htsjdk-jar" depends="compile-samtools, compile-tribble, compile-variant"
description="Builds htsjdk-${htsjdk-version}.jar for inclusion in other projects">
<mkdir dir="${dist}"/>
<jar destfile="${dist}/htsjdk-${htsjdk-version}.jar" compress="no">
<fileset dir="${classes}" includes ="htsjdk/samtools/**/*.*"/>
<fileset dir="${classes}" includes="htsjdk/tribble/**/*.*"/>
<fileset dir="${classes}" includes="htsjdk/variant/**/*.*"/>
<manifest>
<attribute name="Implementation-Version" value="${hts-version}(${repository.revision})"/>
<attribute name="Implementation-Vendor" value="Broad Institute"/>
</manifest>
</jar>
<copy todir="${dist}">
<fileset dir="lib" includes="*.jar"/>
</copy>
</target>
<target name="javadoc" depends="init" description="Generates the project javadoc.">
<javadoc
sourcepath="${src}"
destdir="javadoc"
packagenames="htsjdk.samtools.*, htsjdk.variant.*, htsjdk.tribble.*"
windowtitle="HTS JDK API Documentation"
doctitle="<h1>HTS JDK API Documentation</h1>"
author="true"
protected="true"
use="true"
version="true"
failonerror="true">
<classpath>
<pathelement location="${java.home}/../lib/tools.jar" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
</javadoc>
</target>
<!-- ALL -->
<target name="all" depends="compile, htsjdk-jar" description="Default build target">
</target>
<!-- ************************************************************************************** -->
<!-- ************************************************************************************** -->
<!-- Beginning of taskdefs that are used elsewhere in the build file -->
<!-- ************************************************************************************** -->
<!-- ************************************************************************************** -->
<!-- Compile source files specified by includes, from source root. Can specifically
include or exclude-->
<macrodef name="compile-src">
<attribute name="includes" default=""/>
<attribute name="excludes" default=""/>
<attribute name="destdir" default="${classes}"/>
<attribute name="compile.classpath" default="classpath"/>
<attribute name="compiler.args" default=""/>
<sequential>
<mkdir dir="${classes}"/>
<!-- unset the sourcepath attribute in order to compile only files explicitly specified and disable javac's default searching mechanism -->
<javac destdir="@{destdir}"
optimize="${javac.opt}"
debug="${javac.debug}"
sourcepath=""
srcdir="${src}"
includes="@{includes}"
excludes="@{excludes}"
source="${javac.target}"
target="${javac.target}">
<classpath refid="@{compile.classpath}"/>
<compilerarg line="@{compiler.args}" />
</javac>
</sequential>
</macrodef>
<macrodef name="compile-tests">
<attribute name="includes" default=""/>
<attribute name="excludes" default=""/>
<attribute name="compiler.args" default=""/>
<sequential>
<mkdir dir="${classes.test}"/>
<javac destdir="${classes.test}"
optimize="${javac.opt}"
debug="${javac.debug}"
srcdir="${src.test.java}"
includes="@{includes}"
excludes="@{excludes}"
source="${javac.target}"
target="${javac.target}">
<classpath>
<path refid="classpath"/>
<pathelement location="${classes}"/>
</classpath>
<compilerarg line="@{compiler.args}"/>
</javac>
</sequential>
</macrodef>
</project>