-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
158 lines (122 loc) · 5.16 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="MessageUtils" default="jar" basedir=".">
<description>
The MessageUtils project provides utilities for generating, parsing, sending, and receiving earthquake messages.
Using ant it should be fairly easy to build this project from source (try "ant jar").
</description>
<property name="etc" location="etc" />
<property name="src" location="src" />
<property name="gensrc" location="gensrc" />
<property name="build" location="build" />
<property name="lib" location="lib" />
<property name="dist" location="dist" />
<property name="jarfile" location="${dist}/${ant.project.name}.jar" />
<property name="compile.debug" value="true" />
<fileset id="lib.jars" dir="${lib}">
<include name="*.jar" />
<!-- only need this for compilation -->
<exclude name="jaxb-xjc.jar" />
<exclude name="junit-4.7.jar" />
</fileset>
<path id="classpath">
<fileset refid="lib.jars" />
</path>
<path id="classpath-test">
<pathelement location="${lib}/junit-4.7.jar" />
<path refid="classpath" />
<pathelement path="${build}" />
<pathelement path="${etc}" />
</path>
<!-- for auto generating classes from xml schema -->
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
<classpath>
<pathelement location="${lib}/jaxb-xjc.jar" />
<pathelement location="${lib}/jaxb-api.jar" />
<pathelement location="${lib}/jaxb-impl.jar" />
<pathelement location="${lib}/jsr173_1.0_api.jar" />
</classpath>
</taskdef>
<target name="gensrc" description="Generate JAXB classes">
<mkdir dir="${gensrc}"/>
<!-- EQXML -->
<xjc destdir="${gensrc}" schema="${etc}/eqxml/ANSS_EQ_XML_doc.xsd" binding="${etc}/eqxml/ANSS_EQ_XML.bindings.xml" removeOldOutput="yes">
<produces dir="${gensrc}/gov/usgs/ansseqmsg" includes="*" />
<arg value="-enableIntrospection"/>
</xjc>
<!-- QuakeML 1.1 -->
<xjc destdir="${gensrc}" binding="${etc}/quakeml_1.1/QuakeML-BED-1.1.bindings.xml" removeOldOutput="yes">
<schema dir="${etc}/quakeml_1.1" includes="*_jaxb.xsd" />
<produces dir="${gensrc}/org/quakeml1_1" includes="*" />
<arg value="-enableIntrospection"/>
</xjc>
<!-- QuakeML 1.2rc3 -->
<xjc destdir="${gensrc}" binding="${etc}/quakeml_1.2rc3/QuakeML-1.2rc3.bindings.xml" removeOldOutput="yes" extension="true">
<schema dir="${etc}/quakeml_1.2rc3" includes="*_jaxb.xsd" />
<produces dir="${gensrc}/org/quakeml1_2rc3" includes="*" />
<arg value="-enableIntrospection"/>
</xjc>
<!-- QuakeML RT 1.2rc3 -->
<xjc destdir="${gensrc}" binding="${etc}/quakeml_rt_1.2rc3/QuakeML-RT-1.2rc3.bindings.xml" removeOldOutput="yes" extension="true">
<schema dir="${etc}/quakeml_rt_1.2rc3" includes="*_jaxb.xsd" />
<produces dir="${gensrc}/org/quakeml_rt_1_2rc3" includes="*" />
<arg value="-enableIntrospection"/>
</xjc>
<!-- QuakeML 1.2 -->
<xjc destdir="${gensrc}" binding="${etc}/quakeml_1.2/QuakeML-1.2.bindings.xml" removeOldOutput="yes" extension="true">
<schema dir="${etc}/quakeml_1.2" includes="*_jaxb.xsd" />
<produces dir="${gensrc}/org/quakeml1_2" includes="*" />
<arg value="-enableIntrospection"/>
</xjc>
<!-- QuakeML RT 1.2 -->
<xjc destdir="${gensrc}" binding="${etc}/quakeml_rt_1.2/QuakeML-RT-1.2.bindings.xml" removeOldOutput="yes" extension="true">
<schema dir="${etc}/quakeml_rt_1.2" includes="*_jaxb.xsd" />
<produces dir="${gensrc}/org/quakeml_rt_1_2" includes="*" />
<arg value="-enableIntrospection"/>
</xjc>
</target>
<target name="compile" depends="gensrc" description="Compile code">
<mkdir dir="${build}" />
<mkdir dir="${lib}" />
<javac srcdir="${src}" destdir="${build}" source="1.5" target="1.5" includeAntRuntime="no" classpathref="classpath-test" debug="${compile.debug}">
<src path="${src}"/>
<src path="${gensrc}"/>
</javac>
</target>
<target name="test" depends="compile" description="Run JUnit tests">
<junit printsummary="yes" haltonfailure="yes">
<classpath refid="classpath-test" />
<formatter type="plain" usefile="false" />
<batchtest>
<!-- any class with the name Test in its name -->
<fileset dir="${build}" includes="**/*Test.class" />
</batchtest>
</junit>
</target>
<target name="jar" depends="compile" description="Build jar">
<mkdir dir="${dist}" />
<!-- copy eqxml schema into jar -->
<mkdir dir="${build}/eqxml"/>
<copy todir="${build}/eqxml" file="${etc}/eqxml/ANSS_EQ_XML_doc.xsd"/>
<mkdir dir="${build}/quakeml_1.2"/>
<copy todir="${build}/quakeml_1.2">
<fileset dir="${etc}/quakeml_1.2">
<include name="*.xsd"/>
</fileset>
</copy>
<jar jarfile="${jarfile}" basedir="${build}" excludes="**/*Test*">
<zipgroupfileset refid="lib.jars" />
</jar>
</target>
<target name="javadoc" depends="jar" description="Generate Javadoc">
<javadoc destdir="${dist}/javadoc" packagenames="gov**" classpathref="classpath">
<fileset dir="${src}" excludes="**/*Test*" />
<fileset dir="${gensrc}" />
</javadoc>
</target>
<target name="all" depends="clean,test,javadoc,jar" description="clean, test, jar, and javadoc" />
<target name="clean" description="Remove build and dist directories">
<delete dir="${build}" />
<delete dir="${dist}" />
<delete dir="${gensrc}" />
</target>
</project>