-
Notifications
You must be signed in to change notification settings - Fork 29
/
build.xml
214 lines (200 loc) · 9.32 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
<?xml version="1.0" encoding="UTF-8" ?>
<project name="FOX" default="all" basedir=".">
<property environment="env"/>
<property file="build.properties"/>
<property name="input.lib" value="lib/main"/>
<property name="input.lib-test" value="lib/test"/>
<property name="input.source_java" value="src/main/java"/>
<property name="input.source_tests" value="src/test/java"/>
<property name="input.source_sql" value="src/main/sql"/>
<property name="input.source_mustache" value="src/main/mustache"/>
<property name="input.source_web" value="src/main/webapp"/>
<property name="input.resources" value="src/main/resources"/>
<property name="output.javadoc_dir" value="target/docs/api"/>
<property name="output.build_dir" value="target"/>
<property name="output.classes_dir" value="${output.build_dir}/classes"/>
<property name="output.deploy_dir" value="${output.build_dir}/deploy"/>
<property name="output.default_war_name" value="FOX.war"/>
<!-- Set up PluginAPI properties-->
<property name="output.plugin.jar_name" value="FOXPluginAPI"/>
<property file="src/main/java/net/foxopen/fox/plugin/api/version.properties"/>
<tstamp>
<format property="time" pattern="yyyy/MM/dd HH:mm:ss"/>
</tstamp>
<property name="nl" value=" "/>
<path id="library.JUnit">
<fileset dir="${input.lib-test}">
<include name="*.jar" />
</fileset>
</path>
<path id="library.Container">
<pathelement location="${libs.servlet}"/>
<pathelement location="${libs.jsp}"/>
</path>
<path id="library.FOXLibs">
<fileset dir="${input.lib}">
<include name="*.jar" />
</fileset>
</path>
<path id="classpath.main">
<path refid="library.Container"/>
<path refid="library.FOXLibs"/>
</path>
<path id="classpath.tests">
<path refid="library.JUnit"/>
<path refid="library.Container"/>
<path refid="library.FOXLibs"/>
</path>
<target name="init" depends="check-libs">
<mkdir dir="${output.classes_dir}"/>
<mkdir dir="${output.deploy_dir}"/>
</target>
<target name="clean" description="Clean the project">
<delete dir="${output.build_dir}" includeemptydirs="true" quiet="true"/>
<delete dir="${output.javadoc_dir}" includeemptydirs="true" quiet="true"/>
</target>
<target name="all" description="Build FOX and run all tests" depends="build,test"/>
<target name="all-clean" description="Build FOX fresh and run all tests" depends="clean,build,test"/>
<target name="all-generic" description="Build FOX for any context and run all tests" depends="build-generic,test"/>
<target name="all-generic-clean" description="Build FOX fresh for any context and run all tests" depends="clean,build-generic,test"/>
<target name="build" description="Build FOX with context specific logging file" depends="init,compile,war"/>
<target name="build-generic" description="Build FOX without context specific logging file" depends="init,compile,war"/>
<target name="test" description="Compile and run AllTests JUnit suite" depends="init,compile-tests,run-all-tests"/>
<target name="javadoc" description="Generate javadoc for FOX">
<javadoc packagenames="net.foxopen.fox.*"
sourcepath="${input.source_java}"
defaultexcludes="yes"
destdir="${output.javadoc_dir}"
author="true"
version="true"
use="true"
windowtitle="FOXOpen"
classpathref="classpath.main">
<doctitle><![CDATA[<h1>FOXOpen</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © FOXOpen. All Rights Reserved.</i>]]></bottom>
<tag name="todo" scope="all" description="To do:"/>
<link href="http://www.foxopen.net/docs/api/"/>
</javadoc>
</target>
<target name="compile" description="Compile Java source files" depends="init">
<javac destdir="${output.classes_dir}" classpathref="classpath.main" nowarn="off" source="1.8" target="1.8"
failonerror="on" debug="on" debuglevel="lines,vars,source">
<src path="${input.source_java}"/>
</javac>
<copy todir="${output.classes_dir}">
<fileset dir="${input.source_java}" includes="**/*.mustache, **/*.properties" />
<fileset dir="${input.source_sql}" includes="**/*.sql" />
<fileset dir="${input.source_mustache}" includes="**/*.mustache" />
</copy>
</target>
<target name="war" depends="">
<antcall target="war-env-name" />
<antcall target="war-prompt-name" />
</target>
<target name="war-env-name" description="Set the name for the WAR file if it's not passed in" if="env.WAR_NAME">
<war destfile="${output.deploy_dir}/${env.WAR_NAME}" webxml="${input.source_web}/WEB-INF/web.xml" compress="on">
<fileset dir="${input.source_web}"/>
<fileset dir="${input.resources}">
<include name="schematron/**" if="release.development"/>
</fileset>
<lib dir="${input.lib}" excludes="junit*.jar mockito*.jar"/>
<classes dir="${output.classes_dir}" includes="**/*"/>
<manifest>
<attribute name="FOX-Version" value="${env.FOX_VERSION}" />
<attribute name="Build-Tag" value="${env.BUILD_TAG}" />
<attribute name="Build-Time" value="${time}" />
</manifest>
</war>
</target>
<target name="war-prompt-name" description="Set the name for the WAR file if it's not passed in" unless="env.WAR_NAME">
<input message="Please enter WAR name (default=${output.default_war_name}):" addproperty="fox.war_name" defaultvalue="${output.default_war_name}"/>
<input message="Please enter FOX Version (default=FOXr??.??.??):" addproperty="fox.version" defaultvalue="FOXr??.??.??"/>
<war destfile="${output.deploy_dir}/${fox.war_name}" webxml="${input.source_web}/WEB-INF/web.xml" compress="on">
<fileset dir="${input.source_web}"/>
<fileset dir="${input.resources}">
<include name="schematron/**" if="release.development"/>
</fileset>
<lib dir="${input.lib}" excludes="junit*.jar mockito*.jar"/>
<classes dir="${output.classes_dir}" includes="**/*"/>
<manifest>
<attribute name="FOX-Version" value="${fox.version}" />
<attribute name="Build-Tag" value="Local Build: ${env.COMPUTERNAME}-${env.OS}" />
<attribute name="Build-Time" value="${time}" />
</manifest>
</war>
</target>
<target name="compile-tests" description="Compile JUnit Test source files" depends="init">
<javac destdir="${output.classes_dir}" classpathref="classpath.tests" nowarn="off" debug="on" debuglevel="lines,vars,source">
<src path="${input.source_java}"/>
<src path="${input.source_tests}"/>
</javac>
<copy todir="${output.classes_dir}">
<fileset dir="${input.source_tests}">
<include name="**/*.pdf"/>
<include name="**/*.pkcs8"/>
<include name="**/*.p7b"/>
<include name="**/*.pkipath"/>
<include name="**/*.xml"/>
<include name="**/*.cer"/>
<include name="**/*.xls"/>
<include name="**/*.xlsx"/>
<include name="**/*.doc"/>
<include name="**/*.docx"/>
<include name="**/*.exe"/>
<include name="**/*.gif"/>
<include name="**/*.htm"/>
<include name="**/*.jpg"/>
<include name="**/*.png"/>
<include name="**/*.ppt"/>
<include name="**/*.txt"/>
<include name="**/*.unknown"/>
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<target name="run-all-tests" description="Run all JUnit tests" depends="compile-tests">
<junit fork="yes" printsummary="yes" haltonfailure="yes" showoutput="yes">
<jvmarg value="-Djava.awt.headless=true"/>
<classpath refid="classpath.tests"/>
<classpath path="${output.classes_dir}"/>
<formatter type="xml"/>
<batchtest fork="no" todir="${output.build_dir}">
<fileset dir="${input.source_tests}">
<include name="**/*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="check-libs" description="Check the required libraries are present">
<condition property="fox.libs_ok">
<and>
<available file="${libs.servlet}"/>
<available file="${libs.jsp}"/>
</and>
</condition>
<fail message="Container libraries missing or not found at the paths defined in your build.properties, or build.properties file not found: ${libs.servlet} or ${libs.jsp}" unless="fox.libs_ok"/>
</target>
<target name="PluginAPI" description="Compile and build FOX Plugin API" depends="clean, compile">
<!-- Generate API jar -->
<jar file="${output.deploy_dir}/${output.plugin.jar_name}-${plugin-api.version}.jar" compress="on">
<fileset dir="${output.classes_dir}">
<include name="net/foxopen/fox/plugin/api/**" />
<include name="net/foxopen/fox/ex/*.*" />
<!-- TODO PN - Sort out XFUtil -->
<include name="net/foxopen/fox/XFUtil.class" />
</fileset>
<manifest>
<attribute name="FOX-Plugin-API-version" value="${plugin-api.version}"/>
</manifest>
</jar>
<!-- Generate sources jar -->
<jar file="${output.deploy_dir}/${output.plugin.jar_name}-${plugin-api.version}-src.jar" compress="on">
<fileset dir="${input.source_java}">
<include name="net/foxopen/fox/plugin/api/**" />
<include name="net/foxopen/fox/ex/*.*" />
<!-- TODO PN - Sort out XFUtil -->
<include name="net/foxopen/fox/XFUtil.java" />
</fileset>
</jar>
</target>
</project>