-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
264 lines (224 loc) · 10.3 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
<!--
Copyright (c) 2017, Kiran V Garimella ([email protected])
Wellcome Trust Centre for Human Genetics
University of Oxford
-->
<project name="corticall" default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
<description>Compile and distribute Corticall</description>
<property name="src.dir" value="public/java" />
<property name="src.R.dir" value="public/R" />
<property name="src.html.dir" value="public/html" />
<property name="lib.dir" value="lib" />
<property name="build.dir" value="build" />
<property name="jars.dir" value="build/jars" />
<property name="staging.dir" value="build/staging" />
<property name="dist.dir" value="dist" />
<property name="testng.dir" value="test" />
<property name="doc.dir" value="docs" />
<property name="out.dir" value="out" />
<property name="report.dir" value="report" />
<property name="release.dir" value="release" />
<property name="bwa.version" value="8e2da1e407972170d1a660286f07a3a3a71ee6fb" />
<property name="bwa.dir" value="build/bwa" />
<property name="ivy.install.version" value="2.3.0-rc1" />
<property name="ivy.jar.dir" value="${lib.dir}" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<property name="ivy.settings.dir" value="settings"/>
<property file="${ivy.settings.dir}/ivysettings.properties"/>
<!-- If we don't have ivy already, download and install it -->
<target name="install-ivy" unless="skip.download" description="install ivy">
<mkdir dir="${ivy.jar.dir}"/>
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<ivy:settings file="${ivy.settings.dir}/ivysettings.xml"/>
</target>
<!-- Configure ivy for dependency resolution -->
<target name="resolve" depends="install-ivy" unless="skip.download" description="locate and download library dependencies">
<property name="ivy.conf" value="default"/>
<ivy:retrieve file="ivy.xml" conf="${ivy.conf}" />
</target>
<!-- Set things up (directories, file copies, etc.) -->
<target name="init" depends="resolve">
<tstamp>
<format property="build.timestamp" pattern="yyyy/MM/dd HH:mm:ss"/>
</tstamp>
<mkdir dir="${build.dir}" />
<mkdir dir="${jars.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${doc.dir}" />
<copy todir="${jars.dir}">
<fileset dir="${lib.dir}" includes="*.jar"/>
</copy>
<pathconvert property="jar.classpath" pathsep=" ">
<flattenmapper/>
<fileset dir="${jars.dir}" includes="*.jar"/>
</pathconvert>
</target>
<!-- Compile everything into individual jar files -->
<target name="compile" depends="init,properties" description="compile distribution">
<javac srcdir="${src.dir}" destdir="${build.dir}" includeantruntime="false" debug="on" debuglevel="lines,vars,source">
<classpath>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${build.dir}/R">
<fileset dir="${src.R.dir}" />
</copy>
<copy todir="${build.dir}/html">
<fileset dir="${src.html.dir}" />
</copy>
<jar jarfile="${jars.dir}/corticall.jar">
<fileset dir="${build.dir}">
<include name="**/*.class" />
<include name="**/*.properties" />
<include name="**/*.R" />
<include name="**/*.html" />
<include name="**/*.js" />
<include name="**/*.css" />
<include name="**/*.so" />
<include name="**/*.jnilib" />
</fileset>
<manifest>
<attribute name="Class-Path" value="${jar.classpath}"/>
<attribute name="Main-Class" value="uk.ac.ox.well.cortexjdk.CortexJDK" />
</manifest>
</jar>
</target>
<!-- Prepare to make a jar file with all the Corticall code and dependencies -->
<target name="stage" description="stage files for distribution">
<mkdir dir="${staging.dir}" />
<unjar dest="${staging.dir}" overwrite="false">
<fileset dir="${jars.dir}"/>
</unjar>
</target>
<!-- Create a single executable jar with all of the Corticall and dependency code wrapped up -->
<target name="dist" depends="tidy,compile,stage" description="bundle up an executable for distribution">
<mkdir dir="${dist.dir}" />
<jar jarfile="${dist.dir}/corticall.jar">
<fileset dir="${build.dir}">
<include name="**/*.properties" />
<include name="**/*.R" />
<include name="**/*.html" />
<include name="**/*.js" />
<include name="**/*.css" />
</fileset>
<fileset dir="${staging.dir}">
<include name="**/*.class" />
<include name="**/*.so" />
<include name="**/*.jnilib" />
</fileset>
<manifest>
<attribute name="Main-Class" value="uk.ac.ox.well.cortexjdk.CortexJDK" />
</manifest>
</jar>
</target>
<!-- Unit tests -->
<target name="test" depends="compile">
<mkdir dir="${testng.dir}" />
<taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${jars.dir}/testng-6.9.10.jar" />
<testng outputDir="${testng.dir}" haltOnFailure="false" verbose="2">
<classpath>
<fileset dir="${jars.dir}">
<include name="*.jar" />
</fileset>
</classpath>
<classfileset dir="${build.dir}/uk/ac/ox/well/cortexjdk/" includes="**/*.class" />
</testng>
</target>
<!-- Update the build properties file with the git commit ID, commit date, and build date -->
<target name="properties" depends="git.version,git.version.long,git.date,build.date">
<propertyfile file="${build.dir}/build.properties">
<entry key="major.version" value="0"/>
<entry key="minor.version" value="1"/>
<entry key="git.version" value="${git.version.output}"/>
<entry key="git.version.long" value="${git.version.long.output}"/>
<entry key="git.date" value="${git.date.output}"/>
<entry key="build.date" value="${build.date.output}"/>
</propertyfile>
</target>
<!-- Get a version number for the executable -->
<target name="git.version">
<exec executable="git" outputproperty="git.version.output" resultproperty="git.version.exit.value" failonerror="false">
<arg line="rev-parse --short=4 HEAD" />
</exec>
<condition property="git.version.succeeded">
<equals arg1="${git.version.exit.value}" arg2="0" />
</condition>
<echo message="${git.version.output}" />
</target>
<!-- Get a long version number for the executable -->
<target name="git.version.long">
<exec executable="git" outputproperty="git.version.long.output" resultproperty="git.version.long.exit.value" failonerror="false">
<arg line="rev-parse HEAD" />
</exec>
<condition property="git.version.long.succeeded">
<equals arg1="${git.version.long.exit.value}" arg2="0" />
</condition>
<echo message="${git.version.long.output}" />
</target>
<!-- Get a most recent commit date for the executable -->
<target name="git.date">
<exec executable="git" outputproperty="git.date.output" resultproperty="git.date.exit.value" failonerror="false">
<arg line="show -s --format='%ci' HEAD" />
</exec>
<condition property="git.date.succeeded">
<equals arg1="${git.date.exit.value}" arg2="0" />
</condition>
<echo message="${git.date.output}" />
</target>
<!-- Get a compilation date for the executable -->
<target name="build.date">
<tstamp>
<format property="build.date.output" pattern="yyyy-MM-dd HH:mm:ss Z" />
</tstamp>
<echo message="${build.date.output}" />
</target>
<!-- BWA bindings -->
<!--
<target name="bwalib">
<mkdir dir="${bwa.dir}" />
<exec executable="wget" failonerror="true">
<arg line="-O '${bwa.dir}/bwa.zip' 'https://github.com/lh3/bwa/archive/${bwa.version}.zip'" />
</exec>
<unzip src="${bwa.dir}/bwa.zip" dest="${bwa.dir}"/>
<exec executable="make" dir="${bwa.dir}/bwa-${bwa.version}" />
</target>
-->
<!-- Make a fully tested release jar -->
<target name="release" depends="clean,test,git.version,dist">
<mkdir dir="${release.dir}" />
<copy file="${dist.dir}/cortexjdk.jar" tofile="${release.dir}/cortexjdk-${git.version.output}.jar" />
</target>
<!-- Build Javadocs -->
<target name="doc">
<exec executable="javadoc" failonerror="false">
<arg line="-sourcepath public/java/src/ -d ./docs -subpackages . -exclude uk.ac.ox.well.cortexjdk.commands:uk.ac.ox.well.cortexjdk.playground" />
</exec>
</target>
<!-- Tidy a little bit up -->
<target name="tidy" description="tidy the project up a little bit">
<delete includeemptydirs="true" verbose="false" quiet="true">
<fileset dir="${staging.dir}" />
<fileset dir="${dist.dir}" />
</delete>
</target>
<!-- Clean everything up -->
<target name="clean" description="clean the project">
<delete includeemptydirs="true" verbose="false" quiet="true">
<fileset dir="${lib.dir}" />
<fileset dir="${build.dir}" />
<fileset dir="${staging.dir}" />
<fileset dir="${dist.dir}" />
<fileset dir="${testng.dir}" />
<fileset dir="${out.dir}" />
<fileset dir="${report.dir}" />
<fileset dir="${release.dir}" />
</delete>
</target>
</project>