Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

109 lines (90 sloc) 4.538 kB
<?xml version="1.0"?>
<project name="GEM Java Tests" default="help" basedir=".">
<property name="lib.dir" value="lib"/>
<property name="src.dir" value="java"/>
<property name="test.dir" value="java_tests"/>
<property name="data.dir" value="test_data"/>
<property name="dist.dir" value="dist"/>
<property name="build.dir" value="build"/>
<property name="coverage.dir" value="${dist.dir}"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="instrumented.dir" value="${build.dir}/inst"/>
<property name="javadoc.report.dir" value="${dist.dir}/javadoc"/>
<property name="tests.report.dir" value="${dist.dir}/tests_result"/>
<path id="libraries">
<fileset dir="${lib.dir}" includes="*.jar" />
</path>
<target name="help" description="Display detailed usage information">
<exec executable="ant">
<arg value="-p"/>
</exec>
</target>
<target name="clean" description="Clean build directories">
<delete dir="${dist.dir}"/>
<delete dir="${build.dir}"/>
</target>
<target name="javadoc">
<javadoc classpathref="libraries" packagenames="org.gem.engine.*" sourcepath="${src.dir}" destdir="${javadoc.report.dir}" author="true" version="true" use="true" windowtitle="OpenGEM Java Core API"/>
</target>
<target name="compile-sources" depends="clean">
<mkdir dir="${classes.dir}"/>
<javac fork="no" debug="true" destdir="${classes.dir}" classpathref="libraries" includes="org/**/*.java" srcdir="${src.dir}"/>
</target>
<target name="compile" depends="compile-sources" description="Compile the Java classes and build the jar">
<mkdir dir="${dist.dir}"/>
<jar destfile="${dist.dir}/opensha-lite.jar">
<fileset dir="${classes.dir}" includes="**/*.class"/>
<fileset dir="${src.dir}" includes="**/*.txt"/>
</jar>
</target>
<taskdef resource="emma_ant.properties" classpathref="libraries"/>
<target name="junit-tests-with-coverage" depends="compile" description="Run the test suite and check the code coverage">
<mkdir dir="${coverage.dir}"/>
<mkdir dir="${tests.report.dir}"/>
<!-- Compile test classes -->
<javac fork="no" debug="true" destdir="${classes.dir}" classpathref="libraries" includes="org/**/*.java" srcdir="${test.dir}"/>
<emma enabled="true">
<instr verbosity="verbose" instrpath="${classes.dir}" destdir="${instrumented.dir}" metadatafile="${coverage.dir}/metadata.emma" merge="true" mode="fullcopy">
<filter excludes="*Test*"/>
<filter excludes="au.com.jenisys.view.*"/>
</instr>
</emma>
<copy todir="${instrumented.dir}/classes/org/opensha/sha/imr/attenRelImpl/" overwrite="true">
<fileset dir="${src.dir}/org/opensha/sha/imr/attenRelImpl/">
<include name="**/*.txt" />
</fileset>
</copy>
<mkdir dir="${coverage.dir}/test_data"/>
<copy todir="${coverage.dir}/test_data/">
<fileset dir="${data.dir}"/>
</copy>
<junit haltonerror="yes" haltonfailure="yes" fork="yes" dir="${coverage.dir}" maxmemory="2048m">
<classpath>
<!-- Input test files -->
<pathelement path="${data.dir}"/>
<pathelement path="${instrumented.dir}/classes"/>
<path refid="libraries" />
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${tests.report.dir}">
<fileset dir="${test.dir}">
<!-- <include name="org/opensha/**/*test.java"/> -->
<include name="org/opensha/**/*Suite.java"/>
<include name="org/opensha/sha/calc/*Test.java"/>
<include name="org/opensha/gem/*Test.java"/>
<include name="org/gem/*Test.java"/>
<include name="org/opensha/sha/earthquake/rupForecastImpl/GEM1/SourceData/*Test.java"/>
<!-- <include name="org/opensha/sha/imr/attenRelImpl/test/*test.java"/> -->
</fileset>
</batchtest>
</junit>
<emma enabled="true">
<report sourcepath="${src.dir}">
<infileset dir="${coverage.dir}" includes="*.emma, *.ec"/>
<xml outfile="${coverage.dir}/coverage.xml" depth="method"/>
</report>
</emma>
<echo message="Cleaning compiled resources..."/>
<delete dir="${build.dir}"/>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.