-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
235 lines (205 loc) · 7.33 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
<!--
###
#
# Copyright Alan Kennedy.
#
# You may contact the copyright holder at this uri:
#
# http://www.xhaus.com/contact/modjy
#
# The licence under which this code is released is the Apache License v2.0.
#
# The terms and conditions of this license are listed in a file contained
# in the distribution that also contained this file, under the name
# LICENSE.txt.
#
# You may also read a copy of the license at the following web address.
#
# http://modjy.xhaus.com/LICENSE.txt
#
###
-->
<project name="modjy" default="compile">
<description>
Modjy
</description>
<!-- Versioning constants -->
<property name="major" value="0"/>
<property name="minor" value="25"/>
<property name="micro" value="3"/>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="test" location="test"/>
<property name="build" location="build"/>
<property name="doc" location="doc"/>
<property name="webapp" location="modjy_webapp"/>
<property name="jarname" value="modjy.jar"/>
<!-- Distribution properties -->
<property name="dist_name" value="modjy_${major}_${minor}_${micro}"/>
<property name="dist_dir" location="${dist_name}"/>
<property name="dist_zip" location="${dist_name}.zip"/>
<property name="dist_webapp" location="${dist_dir}/modjy_webapp"/>
<property name="dist_webapplib" location="${dist_webapp}/WEB-INF/lib"/>
<property name="dist_doc" location="${dist_dir}/doc"/>
<property name="dist_src" location="${dist_dir}/src"/>
<property name="dist_test" location="${dist_dir}/test"/>
<!-- Import the environment -->
<property environment="env"/>
<!-- You must set both the jython and tomcat properties in order to use the 'install' target -->
<!-- Jython properties -->
<property name="jython_home" location="${env.JYTHON_HOME}"/>
<property name="jython_jar" value="jython.jar"/>
<property name="jython_jar_path" location="${jython_home}/${jython_jar}"/>
<property name="jython_cachedir" location="${jython_home}/cachedir"/>
<!-- Tomcat properties -->
<property name="tomcat_home" location="${env.TOMCAT_HOME}"/>
<property name="tomcat_shared_lib" location="${tomcat_home}/lib"/>
<property name="webapp_inst" location="${tomcat_home}/webapps/modjy_webapp"/>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${dist_dir}"/>
<mkdir dir="${dist_doc}"/>
<mkdir dir="${dist_src}"/>
<mkdir dir="${dist_src}"/>
</target>
<target name="compile" depends="init" description="Compile source and build the jar">
<javac srcdir="${src}" destdir="${build}" debug="on"/>
<jar jarfile="${jarname}" basedir="${build}"/>
<jar jarfile="${jarname}" basedir="src" includes="*.py" update="true"/>
</target>
<target name="dist" depends="compile, webapp, doc, source">
<copy file="${jarname}" todir="${dist_webapplib}"/>
<copy todir="${dist_dir}">
<fileset dir=".">
<include name="build.xml"/>
<include name="LICENSE.txt"/>
<include name="release_notes.txt"/>
</fileset>
</copy>
<zip
destfile="${dist_zip}"
basedir="."
includes="${dist_name}/**"
/>
</target>
<target name="install" depends="dist" description="Carry out installation of the finished jar file in the testapp dir">
<!-- First try to copy in the jython.jar file -->
<copy file="${jython_jar_path}" todir="${dist_webapplib}" failonerror="false"/>
<copy todir="${webapp_inst}">
<fileset dir="${dist_webapp}"/>
</copy>
</target>
<target name="source" depends="init">
<copy todir="${dist_src}">
<fileset dir="${src}">
<include name="**/*.java"/>
<include name="*.py"/>
</fileset>
</copy>
<copy todir="${dist_test}">
<fileset dir="${test}">
<include name="**/*.java"/>
<include name="**/*.py"/>
</fileset>
</copy>
</target>
<target name="doc" depends="init">
<copy todir="${dist_doc}">
<fileset dir="${doc}">
<include name="*.html"/>
<include name="*.css"/>
<include name="*.gif"/>
</fileset>
</copy>
</target>
<target name="webapp" depends="init">
<copy todir="${dist_webapp}">
<fileset dir="${webapp}"/>
</copy>
</target>
<target name="clean" description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist_dir}"/>
<delete file="${jarname}"/>
<delete file="${dist_zip}"/>
</target>
<!-- Now testing related targets -->
<target name="do_test" description="Run unit tests against a single jdk/servlet combo">
<echo message="Running tests against JDK ${jdk_version}, Servlet ${servlet_version}"/>
<echo message="Clearing jython package cache located at ${jython_home}/cachedir"/>
<delete quiet="true">
<fileset dir="${jython_cachedir}"/>
</delete>
<property name="mockrunner_home" value="${env.MOCKRUNNER_HOME}"/>
<property name="mockrunner_jar" location="${mockrunner_home}/jar"/>
<property name="mockrunner_lib" location="${mockrunner_home}/lib/jdk${jdk_version}/${servlet_version}"/>
<javac srcdir="${test}" destdir="${build}" debug="on">
<classpath>
<pathelement path="${jarname}"/>
<pathelement path="${build}"/>
<pathelement path="${jython_jar_path}"/>
<fileset dir="${mockrunner_jar}" includes="**/*.jar"/>
<fileset dir="${mockrunner_lib}" includes="**/*.jar"/>
</classpath>
</javac>
<java
classname="com.xhaus.modjy.ModjyTestBase"
dir="${test}"
fork="yes"
>
<classpath>
<pathelement path="${jarname}"/>
<pathelement path="${build}"/>
<pathelement path="${jython_jar_path}"/>
<fileset dir="${mockrunner_jar}" includes="**/*.jar"/>
<fileset dir="${mockrunner_lib}" includes="**/*.jar"/>
</classpath>
</java>
</target>
<target name="test" depends="compile">
<antcall target="do_test">
<param name="jdk_version" value="1.5"/>
<param name="servlet_version" value="j2ee1.3"/>
</antcall>
</target>
<target name="test_java_14" depends="clean, compile">
<antcall target="do_test">
<param name="jdk_version" value="1.4"/>
<param name="servlet_version" value="j2ee1.3"/>
</antcall>
<antcall target="do_test">
<param name="jdk_version" value="1.4"/>
<param name="servlet_version" value="j2ee1.4"/>
</antcall>
</target>
<target name="test_java_15" depends="clean, compile">
<antcall target="do_test">
<param name="jdk_version" value="1.5"/>
<param name="servlet_version" value="j2ee1.3"/>
</antcall>
<antcall target="do_test">
<param name="jdk_version" value="1.5"/>
<param name="servlet_version" value="j2ee1.4"/>
</antcall>
<antcall target="do_test">
<param name="jdk_version" value="1.5"/>
<param name="servlet_version" value="jee5"/>
</antcall>
</target>
<target name="test_java_16" depends="clean, compile">
<antcall target="do_test">
<param name="jdk_version" value="1.6"/>
<param name="servlet_version" value="j2ee1.3"/>
</antcall>
<antcall target="do_test">
<param name="jdk_version" value="1.6"/>
<param name="servlet_version" value="j2ee1.4"/>
</antcall>
<antcall target="do_test">
<param name="jdk_version" value="1.6"/>
<param name="servlet_version" value="jee5"/>
</antcall>
</target>
</project>