-
Notifications
You must be signed in to change notification settings - Fork 31
/
build.xml
245 lines (212 loc) · 8.08 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="nshmp-haz" default="jar" basedir=".">
<description>
nshmp-haz is a platform for conducting seismic hazard calculations
</description>
<!-- PROPERTIES -->
<property name="src" location="src" />
<property name="test" location="test" />
<property name="lib" location="lib" />
<property name="classes" location="classes" />
<property name="dist" location="dist" />
<property name="docs" location="docs" />
<property name="javadoc" location="${docs}/javadoc" />
<property name="reports" location="${docs}/reports" />
<property name="reports.xml" location="${reports}/junit-xml" />
<property name="reports.html" location="${reports}/junit-html" />
<property name="coverage.html" location="${reports}/coverage-html" />
<property name="guava.jar" location="${lib}/guava-20.0.jar" />
<property name="gson.jar" location="${lib}/gson-2.8.0.jar" />
<property name="gmm.tests" value="**/gmm/*.java" />
<property name="peer.tests" value="**/peer/*.java" />
<path id="classpath">
<pathelement location="${guava.jar}" />
<pathelement location="${gson.jar}" />
</path>
<path id="classpath.test">
<path refid="classpath" />
<pathelement path="${classes}" />
<!-- JUnit -->
<pathelement location="${lib}/junit-4.12.jar" />
<pathelement location="${lib}/hamcrest-core-1.3.jar" />
<!-- Cobertura Code Coverage -->
<pathelement location="${lib}/cobertura-2.1.1.jar" />
<pathelement location="${lib}/commons-lang3-3.4.jar" />
<pathelement location="${lib}/slf4j-api-1.7.21.jar" />
<pathelement location="${lib}/slf4j-jdk14-1.7.21.jar" />
<pathelement location="${lib}/oro-2.0.8.jar" />
<pathelement location="${lib}/asm-5.1.jar" />
<pathelement location="${lib}/asm-util-5.1.jar" />
<pathelement location="${lib}/asm-tree-5.1.jar" />
<pathelement location="${lib}/asm-analysis-5.1.jar" />
<pathelement location="${lib}/asm-commons-5.1.jar" />
</path>
<!--
TODO consider skipping utility classes and exporters
and internal package; need to check dependencies
-->
<target name="jar" depends="compile.source">
<jar destfile="${dist}/nshmp-haz.jar">
<fileset dir="${classes}" />
<zipfileset src="${guava.jar}" excludes="**/META-INF/**" />
<zipfileset src="${gson.jar}" />
</jar>
</target>
<target name="compile">
<mkdir dir="${classes}" />
<javac srcdir="${param.srcdir}"
destdir="${classes}"
classpathref="${param.classpath}"
nowarn="true"
fork="true"
source="1.7"
target="1.7"
encoding="UTF-8"
debug="true"
includeantruntime="false"
createMissingPackageInfoClass="false">
<!--<compilerarg value="-Xlint" />-->
</javac>
<!-- Copy non-Java resources -->
<copy todir="${classes}" includeEmptyDirs="false">
<fileset dir="${param.srcdir}" excludes="**/*.java" />
</copy>
</target>
<target name="compile.source">
<delete dir="${classes}" />
<antcall target="compile">
<param name="param.srcdir" value="${src}" />
<param name="param.classpath" value="classpath" />
</antcall>
<copy file="${lib}/logging.properties" todir="${classes}" />
</target>
<target name="compile.test">
<antcall target="compile">
<param name="param.srcdir" value="${test}" />
<param name="param.classpath" value="classpath.test" />
</antcall>
</target>
<target name="test.gmms"
depends="compile.source"
description="Test Ground Motion Models">
<antcall target="test">
<param name="param.test.include" value="${gmm.tests}" />
<param name="param.test.exclude" value="**/Ngaw2.java" />
</antcall>
</target>
<target name="test.peer"
depends="compile.source"
description="Test Peer Models">
<antcall target="test">
<param name="param.test.include" value="${peer.tests}" />
</antcall>
</target>
<target name="test" depends="compile.test">
<delete dir="${reports}" />
<mkdir dir="${reports.xml}" />
<mkdir dir="${reports.html}" />
<junit fork="yes"
forkmode="once"
printsummary="off"
showoutput="false"
haltonfailure="yes"
failureProperty="test.failed">
<classpath refid="classpath.test" />
<formatter type="xml" />
<formatter type="brief" usefile="false" />
<batchtest skipNonTests="true" todir="${reports.xml}">
<fileset dir="${test}"
includes="${param.test.include}"
excludes="${param.test.exclude}" />
</batchtest>
</junit>
<junitreport todir="${reports.xml}">
<fileset dir="${reports.xml}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${reports.html}" />
</junitreport>
</target>
<!--
With JUnit4 and annotated tests, test classes will not necessarily contain
the word 'test'. We therefore first build and instrument all sources, and
only then compile any test classes.
-->
<target name="coverage"
depends="compile.source"
description="Generate code coverage reports">
<taskdef classpathref="classpath.test" resource="tasks.properties" />
<delete file="cobertura.ser" />
<cobertura-instrument>
<!-- Ignore any logging for the purposes of coverage reporting. -->
<ignore regex="java.util.logging.*" />
<fileset dir="${classes}">
<include name="**/*.class" />
</fileset>
</cobertura-instrument>
<antcall target="test">
<param name="param.test.include" value="${gmm.tests}" />
</antcall>
<mkdir dir="${coverage.html}" />
<cobertura-report destdir="${coverage.html}"
encoding="UTF-8"
srcdir="${src}" />
<!-- Remove instrumentation -->
<antcall target="compile.source" />
<antcall target="compile.test" />
</target>
<target name="instrument.source" depends="compile.source">
<taskdef classpathref="classpath.test" resource="tasks.properties" />
<delete file="cobertura.ser" />
<cobertura-instrument>
<!-- Ignore any logging for the purposes of coverage reporting. -->
<ignore regex="java.util.logging.*" />
<fileset dir="${classes}">
<include name="**/*.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="javadoc" description="Generate Javadocs">
<delete dir="${javadoc}" />
<javadoc classpathref="classpath"
destdir="${javadoc}"
author="true"
version="true"
use="true"
windowtitle="nshmp-haz"
doctitle="nshmp-haz"
maxmemory="512m"
verbose="false"
encoding="UTF-8"
docencoding="UTF-8"
charset="UTF-8"
additionalparam="-notimestamp">
<packageset dir="${src}">
<include name="org/opensha2/**" />
<exclude name="org/opensha2/etc/**" />
<exclude name="org/opensha2/gcim/**" />
<exclude name="org/opensha2/internal/**" />
</packageset>
<!--
enabling sourcepath will caputure documentation from jdk
<sourcepath>
<pathelement location="/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/src.zip" />
</sourcepath>
the package element restricts the docs generated to nshmp-haz
<package name="org.opensha2.*" />-->
<bottom>
<![CDATA[<div style="float: right; font-size: 14px; padding: 4px;">
<span style="font-weight: bold;">U.S. Geological Survey</span>
– National Seicmic Hazard Mapping Project
(<a href="https://github.com/usgs/nshmp-haz" target="_top">NSHMP</a>)</div>]]>
</bottom>
<link href="http://docs.oracle.com/javase/7/docs/api/" />
<link href="http://google.github.io/guava/releases/20.0/api/docs/" />
<link href="http://google.github.io/gson/apidocs/" />
</javadoc>
<!-- Copy images -->
<copy todir="${javadoc}/resources">
<fileset dir="etc/resources/docs" includes="*.jpg" />
</copy>
</target>
</project>