-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.xml
229 lines (201 loc) · 8.02 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
<project name="webmaths" default="war" basedir=".">
<description>
Builds web maths services and related items. If your project doesn't have
the 'gen' source folder, you need to run the wsdlgen target in here.
</description>
<!-- Build folder (will be deleted on run!) -->
<property name="build" location="${java.io.tmpdir}/build/webmaths" />
<!-- Version number -->
<property name="version" value="3.16"/>
<!-- Set location you want to build the WEB-INF folder inside -->
<property name="webinf.location" location="${user.home}/Desktop"/>
<!-- Set location you want to build the .war file inside -->
<property name="war.location" location="${user.home}/Desktop"/>
<!-- Set default temp directory (on server), will be placed into web.xml -->
<property name="temp.directory" value="/tmp"/>
<!-- Set location of mathjax-node-sre (on server), will be placed into web.xml -->
<property name="mathjax.directory" value="/opt/mathjax_node_sre"/>
<!-- URL of Tomcat application -->
<property name="tomcat-url" value="http://localhost:8080/"/>
<!-- Tomcat admin username -->
<property name="tomcat-username" value="admin"/>
<!-- Tomcat admin password -->
<property name="tomcat-password" value=""/>
<!-- Tomcat home folder -->
<property name="tomcat-home" location="C:/Program Files/Apache Software Foundation/Tomcat 7.0"/>
<!-- Location of a Java 8 compiler so we can actually get this geriatric built -->
<property name="java8home" location="${java.home}"/>
<property name="javac8" location="${java8home}/bin/javac"/>
<!-- JAXWS-RI location (download from https://repo1.maven.org/maven2/com/sun/xml/ws/jaxws-ri/, I used version 2.2.10 which is old and supposed to work with Tomcat 7) -->
<property name="jaxws-ri-home" location="c:/tools/jaxws-ri"/>
<!-- Set to false after you have managed to deploy it to Tomcat -->
<property name="firstrun" value="true"/>
<!-- If not using LaTeX, set blank. Otherwise set to 'latex' or full path -->
<property name="latexruntime" value=""/>
<!-- Set to wsimport.sh if building on Unix -->
<property name="wsimportscript" value="wsimport.bat"/>
<target name="wsdlgen" description="Create generated source (gen folder) based on WSDL">
<delete dir="gen/uk/ac/open/lts/webmaths/image"/>
<delete dir="gen/uk/ac/open/lts/webmaths/english"/>
<delete dir="gen/uk/ac/open/lts/webmaths/tex"/>
<delete dir="gen/uk/ac/open/lts/webmaths/mathjax"/>
<mkdir dir="gen"/>
<exec executable="${jaxws-ri-home}/bin/${wsimportscript}">
<env key="JAVA_HOME" value="${java8home}" />
<arg line="-keep -Xnocompile -s gen misc/maths.tex.wsdl -p uk.ac.open.lts.webmaths.tex -wsdllocation /wsdl/maths.tex.wsdl"/>
</exec>
<exec executable="${jaxws-ri-home}/bin/${wsimportscript}">
<env key="JAVA_HOME" value="${java8home}" />
<arg line="-keep -Xnocompile -s gen misc/maths.image.wsdl -p uk.ac.open.lts.webmaths.image -wsdllocation /wsdl/maths.image.wsdl"/>
</exec>
<exec executable="${jaxws-ri-home}/bin/${wsimportscript}">
<env key="JAVA_HOME" value="${java8home}" />
<arg line="-keep -Xnocompile -s gen misc/maths.english.wsdl -p uk.ac.open.lts.webmaths.english -wsdllocation /wsdl/maths.english.wsdl"/>
</exec>
<exec executable="${jaxws-ri-home}/bin/${wsimportscript}">
<env key="JAVA_HOME" value="${java8home}" />
<arg line="-keep -Xnocompile -s gen misc/maths.mathjax.wsdl -p uk.ac.open.lts.webmaths.mathjax -wsdllocation /wsdl/maths.mathjax.wsdl"/>
</exec>
</target>
<!-- Get date in format used for build version -->
<target name="timestamp">
<tstamp>
<format property="build-date" pattern="yyyy-MM-dd HH:mm"/>
</tstamp>
</target>
<!-- Init build folders -->
<target name="init" depends="timestamp">
<delete dir="${build}" />
<mkdir dir="${build}" />
</target>
<!-- Classpath -->
<path id="classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- Compile Java source -->
<target name="compile" depends="init">
<mkdir dir="${build}/classes" />
<javac destdir="${build}/classes" fork="yes" executable="${javac8}"
source="1.8" target="1.8" encoding="UTF-8" debug="true">
<src>
<pathelement path="gen"/>
</src>
<src>
<pathelement path="src"/>
</src>
<classpath refid="classpath"/>
</javac>
<copy todir="${build}/classes">
<fileset dir="src">
<exclude name="**/*.java" />
</fileset>
</copy>
<mkdir dir="${build}/classes/wsdl"/>
<copy todir="${build}/classes/wsdl">
<fileset dir="misc">
<include name="*.wsdl"/>
</fileset>
</copy>
</target>
<!-- Build jar file -->
<target name="jar" depends="compile">
<jar jarfile="${build}/webmaths.jar" basedir="${build}/classes" level="9"/>
</target>
<!-- Create web-inf folder -->
<target name="buildwebinf" depends="jar">
<!-- Create web-inf -->
<mkdir dir="${build}/WEB-INF"/>
<mkdir dir="${build}/WEB-INF/lib"/>
<copy todir="${build}/WEB-INF/lib">
<fileset dir="lib/jeuclid">
<include name="*.jar"/>
</fileset>
<fileset dir="lib/fop">
<include name="*.jar"/>
</fileset>
<fileset dir="lib/extrafonts">
<include name="*.jar"/>
</fileset>
<fileset dir="lib/commons">
<include name="*.jar"/>
</fileset>
<fileset dir="lib/jaxws-ri">
<include name="*.jar"/>
</fileset>
<fileset dir="lib/misc">
<include name="*.jar"/>
</fileset>
<fileset dir="${build}">
<include name="webmaths.jar"/>
</fileset>
</copy>
<copy todir="${build}/WEB-INF">
<fileset dir="misc">
<include name="sun-jaxws.xml"/>
<include name="ou-mathjax-batchprocessor"/>
</fileset>
</copy>
<copy file="misc/web.xml" tofile="${build}/WEB-INF/web.xml">
<filterchain>
<replacetokens>
<token key="TEMP" value="${temp.directory}"/>
<token key="MATHJAXFOLDER" value="${mathjax.directory}"/>
<token key="LATEX" value="${latexruntime}"/>
</replacetokens>
</filterchain>
</copy>
<!--
There are two copies of the WSDL files. This one is for the sun-jaxws.xml
versions. The other copy in code is for the stubs to load.
-->
<mkdir dir="${build}/WEB-INF/wsdl"/>
<copy todir="${build}/WEB-INF/wsdl">
<fileset dir="misc">
<include name="*.wsdl"/>
</fileset>
</copy>
<echo message="${version} (${build-date})" file="${build}/WEB-INF/version.txt" />
</target>
<target name="war" depends="buildwebinf" description="Build .war file on desktop">
<delete file="${war.location}/webmaths.war"/>
<jar destfile="${war.location}/webmaths.war">
<fileset dir="${build}">
<include name="WEB-INF/**"/>
</fileset>
</jar>
</target>
<!-- TOMCATSTART Comment this section out if you don't have Tomcat installed -->
<path id="catalina-ant-classpath">
<fileset dir="${tomcat-home}/lib">
<include name="catalina-ant.jar"/>
<include name="catalina.jar"/>
<include name="tomcat-coyote.jar"/>
<include name="tomcat-util.jar"/>
</fileset>
<fileset dir="${tomcat-home}/bin">
<include name="tomcat-juli.jar"/>
</fileset>
</path>
<taskdef name="tomcatdeploy" classname="org.apache.catalina.ant.DeployTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="tomcatundeploy" classname="org.apache.catalina.ant.UndeployTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="tomcatstop" classname="org.apache.catalina.ant.StopTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<target name="tomcatundeploy" unless="${firstrun}">
<tomcatstop url="${tomcat-url}/manager/text" username="${tomcat-username}" password="${tomcat-password}"
path="/webmaths"/>
<tomcatundeploy url="${tomcat-url}/manager/text" username="${tomcat-username}" password="${tomcat-password}"
path="/webmaths"/>
</target>
<target name="tomcatdeploy" depends="war, tomcatundeploy" description="Deploy to Tomcat server">
<tomcatdeploy url="${tomcat-url}/manager/text" username="${tomcat-username}" password="${tomcat-password}"
path="/webmaths" war="${war.location}/webmaths.war"/>
</target>
<!-- TOMCATSTOP Comment this section out if you don't have Tomcat installed -->
</project>