forked from t11e/discovery_datatool
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.xml
More file actions
227 lines (215 loc) · 9.49 KB
/
build.xml
File metadata and controls
227 lines (215 loc) · 9.49 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Discovery Data Tool" default="test">
<target name="clean"
description="Remove all generated files.">
<delete dir="build.ant"/>
</target>
<path id="build.classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
<exclude name="**/*-sources.jar"/>
<exclude name="**/*-src.jar"/>
</fileset>
</path>
<target name="compile"
description="Compile the Java sources.">
<mkdir dir="build.ant/main"/>
<javac destdir="build.ant/main" target="1.6" debug="true" includeantruntime="false">
<src path="src/main/java"/>
<classpath refid="build.classpath"/>
</javac>
<mkdir dir="build.ant/test"/>
<javac destdir="build.ant/test" target="1.6" debug="true" includeantruntime="false">
<src path="src/test/java"/>
<classpath path="build.ant/main"/>
<classpath refid="build.classpath"/>
</javac>
</target>
<target name="test" depends="compile" unless="skip_tests"
description="Run the unit tests.">
<delete dir="build.ant/junit"/>
<delete dir="build.ant/report"/>
<mkdir dir="build.ant/junit"/>
<junit fork="true" haltonerror="false" errorproperty="junit.error"
haltonfailure="false" failureproperty="junit.error"
printsummary="true">
<classpath>
<path refid="build.classpath"/>
<path path="src/docroot/WEB-INF/classes"/>
<path path="src/test/java"/>
<path path="build.ant/main"/>
<path path="build.ant/test"/>
</classpath>
<formatter type="xml"/>
<sysproperty key="java.util.logging.config.file"
value="src/test/java/logging.properties"/>
<batchtest todir="build.ant/junit">
<fileset dir="src/test/java">
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
</fileset>
</batchtest>
</junit>
<mkdir dir="build.ant/report"/>
<junitreport todir="build.ant/report">
<fileset dir="build.ant/junit">
<include name="TEST-*.xml"/>
</fileset>
<report todir="build.ant/report/html"/>
</junitreport>
<echo message="Test report in: build.ant/report/html/index.html"/>
<fail if="junit.error" message="Tests failed."/>
</target>
<target name="javadoc"
description="Build the Javadoc.">
<delete dir="build.ant/javadoc"/>
<javadoc destdir="build.ant/javadoc">
<classpath refid="build.classpath" />
<packageset dir="src/main/java" defaultexcludes="yes"/>
</javadoc>
<echo message="Java documentation now available in build.ant/javadoc/index.html"/>
</target>
<target name="jar" depends="compile">
<delete file="build.ant/discovery_datatool.jar"/>
<jar destfile="build.ant/discovery_datatool.jar">
<fileset dir="build.ant/main"/>
</jar>
</target>
<target name="war" depends="jar, test"
description="Build the WAR, can be dropped into a web container like Tomcat.">
<delete file="build.ant/discovery_datatool.war"/>
<delete file="build.ant/war.lib"/>
<mkdir dir="build.ant/war.lib"/>
<copy todir="build.ant/war.lib" flatten="true">
<fileset dir="lib">
<include name="**/*.jar"/>
<exclude name="javax/servlet-*.jar"/>
<exclude name="test/**"/>
<exclude name="jetty/**"/>
<exclude name="**/*-sources.jar"/>
<exclude name="**/*-src.jar"/>
<exclude name="**/slf4j-*.jar"/>
</fileset>
<fileset file="build.ant/discovery_datatool.jar"/>
</copy>
<war destfile="build.ant/discovery_datatool.war" webxml="src/docroot/WEB-INF/web.xml">
<lib dir="build.ant/war.lib">
<include name="*.jar"/>
</lib>
<webinf dir="src/docroot/WEB-INF"/>
<fileset dir="src/docroot">
<exclude name="WEB-INF/**"/>
</fileset>
</war>
<delete file="build.ant/war.lib"/>
</target>
<target name="dev-server" depends="compile"
description="Run a Jetty server using the freshly compiled classes, you can edit the ftl files in place while this is running.">
<path id="jetty.classpath.dev">
<fileset dir="lib">
<include name="**/*.jar"/>
<exclude name="test/**"/>
<exclude name="**/*-sources.jar"/>
<exclude name="**/*-src.jar"/>
</fileset>
<path path="build.ant/main"/>
<path path="src/docroot/WEB-INF/classes"/>
</path>
<antcall target="jetty">
<param name="argline"
value="src/config/jetty.xml src/config/jetty-dev.xml"/>
<reference refid="jetty.classpath.dev" torefid="jetty.classpath"/>
</antcall>
</target>
<property name="server.port" value="8080"/>
<target name="jetty">
<java fork="true" maxmemory="256m"
classname="org.mortbay.xml.XmlConfiguration">
<classpath>
<fileset dir="lib/jetty">
<include name="*.jar"/>
<exclude name="*-sources.jar"/>
</fileset>
<fileset file="lib/javax/servlet-2.5.jar"/>
<fileset file="lib/c3p0-0.9.1.2.jar"/>
<fileset file="lib/mysql-connector-java-5.1.10-bin.jar"/>
<path refid="jetty.classpath"/>
<fileset file="lib/jakarta/commons-lang-2.4.jar"/>
</classpath>
<!--
<sysproperty key="java.util.logging.config.file"
value="src/java/test/logging.properties"/>
-->
<sysproperty key="jetty.port" value="${server.port}"/>
<!--
<jvmarg line="-agentlib:jdwp=transport=dt_socket,server=y,address=8081,suspend=n"/>
-->
<arg line="${argline}"/>
</java>
</target>
<target name="test-single" depends="compile"
description="Runs a single junit test case.">
<fail message="Please set the test.class variable." unless="test.class"/>
<junit showoutput="true" fork="true">
<classpath>
<path refid="build.classpath"/>
<path path="src/docroot"/>
<path path="src/main/java"/>
<path path="src/test/java"/>
<path path="build.ant/main"/>
<path path="build.ant/test"/>
</classpath>
<sysproperty key="java.util.logging.config.file"
value="src/test/java/logging.properties"/>
<test name="${test.class}"/>
<formatter usefile="no" type="plain"/>
</junit>
</target>
<target name="jetty-standalone">
<delete file="build.ant/jetty-6.1.22.standalone.jar"/>
<jar destfile="build.ant/jetty-6.1.22.standalone.jar">
<zipgroupfileset dir="lib">
<include name="jetty/jetty-6.1.22.jar"/>
<include name="jetty/jetty-util-6.1.22.jar"/>
<include name="javax/servlet-2.5.jar"/>
</zipgroupfileset>
<manifest>
<attribute name="Main-Class" value="org.mortbay.jetty.Main" />
</manifest>
</jar>
</target>
<target name="standalone-jar" depends="war" description="Built the stand-alone executable jar.">
<delete file="build.ant/discovery_datatool_standalone.jar"/>
<jar destfile="build.ant/discovery_datatool_standalone.jar">
<fileset dir="build.ant/main">
<include name="com/t11e/discovery/datatool/WebServerMain.class"/>
<include name="com/t11e/discovery/datatool/WebServerDaemon.class"/>
<include name="com/t11e/discovery/datatool/CustomLogFormatter.class"/>
</fileset>
<zipgroupfileset dir="lib">
<include name="jopt-simple-3.2.jar"/>
<include name="jetty/jetty-6.1.22.jar"/>
<include name="jetty/jetty-util-6.1.22.jar"/>
<include name="javax/servlet-2.5.jar"/>
<include name="deps/slf4j-api-1.5.10.jar"/>
<include name="deps/slf4j-jdk14-1.5.10.jar"/>
<include name="jakarta/commons-lang-2.4.jar"/>
<include name="jakarta/commons-daemon-1.0.2.jar"/>
</zipgroupfileset>
<zipgroupfileset file="build.ant/discovery_datatool.war"/>
<manifest>
<attribute name="Main-Class" value="com.t11e.discovery.datatool.WebServerMain" />
</manifest>
</jar>
</target>
<property name="external.version" value="0.0.0"/>
<target name="release" depends="standalone-jar"
description="Build the distribution ZIP. Can set external.version if building from a tag.">
<delete file="build.ant/discovery_datatool.zip"/>
<zip destfile="build.ant/discovery_datatool-${external.version}.zip">
<zipfileset prefix="discovery_datatool-${external.version}/" dir="stage" excludes="bin/**,init-script/init.d/**,*.sh"/>
<zipfileset prefix="discovery_datatool-${external.version}/" dir="stage" includes="bin/**,init-script/init.d/**,*.sh" filemode="755"/>
<zipfileset prefix="discovery_datatool-${external.version}/" file="build.ant/discovery_datatool_standalone.jar"/>
</zip>
</target>
</project>