This repository has been archived by the owner on May 28, 2019. It is now read-only.
forked from joshuamckenty/OpenSHA
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
108 lines (90 loc) · 4.43 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
<?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>