Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

157 lines (122 sloc) 5.049 kb
<?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="jaxb-impl-2.2.5-2.jar"/>
<include name="jaxb2-basics-runtime-0.6.4.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="org.jvnet.jaxb2_commons.xjc.XJC2Task">
<classpath>
<fileset dir="${lib}">
<include name="jaxb-impl-*.jar"/>
<include name="jaxb-xjc-*.jar"/>
<include name="jaxb2-basics-ant-*.jar"/>
</fileset>
</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.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"/>
<!-- Wildcard plugin, supports parsing of InternalEvent and ScenarioEvent from non-quakeml namespace -->
<arg value="-Xwildcard"/>
<classpath>
<fileset dir="${basedir}/lib">
<!-- JAXB2 Basics library -->
<include name="jaxb2-basics-*.jar"/>
<!-- JAXB2 Basics library dependencies -->
<include name="javaparser-*.jar"/>
<include name="commons-beanutils-*.jar"/>
<include name="commons-lang-*.jar"/>
<include name="commons-logging-*.jar"/>
</fileset>
</classpath>
</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>
Jump to Line
Something went wrong with that request. Please try again.