source: apps/routerconsole/java/build.xml @ 061f96a

Last change on this file since 061f96a was 061f96a, checked in by zzz <zzz@…>, 10 years ago

Use ${ant.home}/lib/ant.jar instead of pulling ant.jar from Jetty

  • Property mode set to 100644
File size: 17.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="routerconsole">
3    <target name="all" depends="clean, build" />
4    <target name="build" depends="builddep, jar" />
5    <target name="builddep">
6        <!-- run from top level build.xml to get dependencies built -->
7    </target>
8    <target name="prepare">
9        <!-- run from top level build.xml to get dependencies built -->
10    </target>
11    <condition property="depend.available">
12        <typefound name="depend" />
13    </condition>
14    <target name="depend" if="depend.available">
15        <depend
16            cache="../../../build"
17            srcdir="./src" 
18            destdir="./build/obj" >
19            <!-- Depend on classes instead of jars where available -->
20            <classpath>
21                <pathelement location="../../../core/java/build/obj" />
22                <pathelement location="../../../router/java/build/obj" />
23                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
24                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
25                <pathelement location="../../jetty/jettylib/jetty-sslengine.jar" />
26                <pathelement location="../../jetty/jettylib/jetty-java5-threadpool.jar" />
27                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
28                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
29                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
30                <pathelement location="../../systray/java/build/obj" />
31                <pathelement location="../../systray/java/lib/systray4j.jar" />
32                <pathelement location="../../desktopgui/build" />
33                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
34                <pathelement location="../../jrobin/jrobin-1.5.9.1.jar" />
35            </classpath>
36        </depend>
37    </target>
38    <target name="dependVersion">
39        <!-- Force the dependency on the RouterVersion as depend doesn't recognize constant changes  -->
40        <dependset>
41             <srcfilelist dir="." files="../../../router/java/build/obj/net/i2p/router/RouterVersion.class" />
42             <targetfilelist dir="." files="build/obj/net/i2p/router/web/NewsFetcher.class" />
43             <targetfilelist dir="." files="build/obj/net/i2p/router/web/PluginStarter.class" />
44             <targetfilelist dir="." files="build/obj/net/i2p/router/web/SummaryHelper.class" />
45             <targetfilelist dir="." files="build/obj/net/i2p/router/web/UpdateHandler.class" />
46        </dependset>
47    </target>
48    <property name="javac.compilerargs" value="" />
49    <target name="compile" depends="prepare, depend, dependVersion">
50        <mkdir dir="./build" />
51        <mkdir dir="./build/obj" />
52        <javac 
53            srcdir="./src" 
54            debug="true" deprecation="on" source="1.5" target="1.5" 
55            includeAntRuntime="false"
56            destdir="./build/obj">
57            <compilerarg line="${javac.compilerargs}" />
58            <classpath>
59                <pathelement location="../../../core/java/build/i2p.jar" />
60                <pathelement location="../../../router/java/build/router.jar" />
61                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
62                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
63                <pathelement location="../../jetty/jettylib/jetty-sslengine.jar" />
64                <pathelement location="../../jetty/jettylib/jetty-java5-threadpool.jar" />
65                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
66                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
67                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
68                <pathelement location="../../systray/java/build/systray.jar" />
69                <pathelement location="../../systray/java/lib/systray4j.jar" />
70                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
71                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
72                <pathelement location="../../jrobin/jrobin-1.5.9.1.jar" />
73            </classpath>
74        </javac>
75    </target>
76
77    <!-- the jar with the latest message classes from the jsps, and the war too -->
78    <target name="jar" depends="jar1, war, bundle" />
79
80    <!-- the jar without the latest message classes from the jsps -->
81    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
82        <exec executable="mtn" outputproperty="workspace.changes.j" errorproperty="mtn.error2" failifexecutionfails="false" >
83            <arg value="list" />
84            <arg value="changed" />
85            <arg value="." />
86            <arg value="../locale" />
87        </exec>
88        <!-- \n in an attribute value generates an invalid manifest -->
89        <exec executable="tr" inputstring="${workspace.changes.j}" outputproperty="workspace.changes.j.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
90            <arg value="-s" />
91            <arg value="[:space:]" />
92            <arg value="," />
93        </exec>
94    </target>
95
96    <target name="jar1" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
97        <!-- set if unset -->
98        <property name="workspace.changes.j.tr" value="" />
99        <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class">
100            <manifest>
101                <!-- top level installer will rename to jrobin.jar -->
102                <!-- DTG added in 0.8.4, not in the classpath for very old installs, before we changed wrapper.config to specify * -->
103                <attribute name="Class-Path" value="i2p.jar router.jar jrobin.jar desktopgui.jar" />
104                <attribute name="Implementation-Version" value="${full.version}" />
105                <attribute name="Build-Date" value="${build.timestamp}" />
106                <attribute name="Base-Revision" value="${workspace.version}" />
107                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
108            </manifest>
109        </jar>
110    </target>
111
112    <!-- this is tricky because the message classes go in the jar, not in the war -->
113    <target name="bundle" depends="jar1, precompilejsp" >
114        <!-- Update the messages_*.po files.
115             We need to supply the bat file for windows, and then change the fail property to true -->
116        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
117            <arg value="./bundle-messages.sh" />
118        </exec>
119        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
120            <arg value="./bundle-messages.sh" />
121        </exec>
122                <!-- multi-lang is optional -->
123        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
124            <arg value="./bundle-messages.sh" />
125        </exec>
126        <!-- jar again to get the latest messages_*.class files -->
127        <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
128    </target>
129
130
131    <target name="jarUpToDate">
132        <uptodate property="jar.uptodate" targetfile="build/routerconsole.jar" >
133            <srcfiles dir= "build/obj" includes="**/*.class" />
134        </uptodate>
135        <condition property="shouldListChanges" >
136            <and>
137                <not>
138                    <isset property="jar.uptodate" />
139                </not>
140                <isset property="mtn.available" />
141            </and>
142        </condition>
143    </target>
144
145    <target name="poupdate" depends="precompilejsp">
146        <!-- Update the messages_*.po files.
147             We need to supply the bat file for windows, and then change the fail property to true -->
148        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
149            <arg value="./bundle-messages.sh" />
150            <arg value="-p" />
151        </exec>
152        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
153            <arg value="./bundle-messages.sh" />
154            <arg value="-p" />
155        </exec>
156        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
157            <arg value="./bundle-messages.sh" />
158            <arg value="-p" />
159        </exec>
160    </target>
161
162    <target name="listChangedFiles2" depends="warUpToDate" if="shouldListChanges2" >
163        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
164            <arg value="list" />
165            <arg value="changed" />
166            <arg value="../jsp" />
167        </exec>
168        <!-- \n in an attribute value generates an invalid manifest -->
169        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
170            <arg value="-s" />
171            <arg value="[:space:]" />
172            <arg value="," />
173        </exec>
174    </target>
175
176    <!-- does NOT update the message classes, as those go in the jar -->
177    <target name="war" depends="precompilejsp, warUpToDate, listChangedFiles2" unless="war.uptodate" >
178        <!-- set if unset -->
179        <property name="workspace.changes.w.tr" value="" />
180        <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
181        <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
182             basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, *.jsi, web-fragment.xml, web-out.xml">
183            <manifest>
184                <attribute name="Implementation-Version" value="${full.version}" />
185                <attribute name="Build-Date" value="${build.timestamp}" />
186                <attribute name="Base-Revision" value="${workspace.version}" />
187                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
188            </manifest>
189        </war>
190    </target>
191
192    <target name="warUpToDate">
193        <uptodate property="war.uptodate" targetfile="build/routerconsole.war" >
194            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, *.css, **/*.java, *.jsp, *.jsi" />
195        </uptodate>
196        <condition property="shouldListChanges" >
197            <and>
198                <not>
199                    <isset property="jar.uptodate" />
200                </not>
201                <isset property="mtn.available" />
202            </and>
203        </condition>
204    </target>
205
206    <target name="precompilejsp" depends="jar1" unless="precompilejsp.uptodate">
207        <delete dir="../jsp/WEB-INF/" />
208        <delete file="../jsp/web-fragment.xml" />
209        <delete file="../jsp/web-out.xml" />
210        <mkdir dir="../jsp/WEB-INF/" />
211        <mkdir dir="../jsp/WEB-INF/classes" />
212
213        <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
214        <!--
215           **     Usage: jspc <options> <jsp files>
216           **     where jsp files is
217           **         -webapp <dir>      A directory containing a web-app, whose JSP pages
218           **                            will be processed recursively
219           **     or any number of
220           **         <file>             A file to be parsed as a JSP page
221           **     where options include:
222           **         -help              Print this help message
223           **         -v                 Verbose mode
224           **         -d <dir>           Output Directory (default -Djava.io.tmpdir)
225           **         -l                 Outputs the name of the JSP page upon failure
226           **         -s                 Outputs the name of the JSP page upon success
227           **         -p <name>          Name of target package (default org.apache.jsp)
228           **         -c <name>          Name of target class name (only applies to first JSP page)
229           **         -mapped            Generates separate write() calls for each HTML line in the JSP
230           **         -die[#]            Generates an error return code (#) on fatal errors (default 1)
231           **         -uribase <dir>     The uri directory compilations should be relative to
232           **                            (default "/")
233           **         -uriroot <dir>     Same as -webapp
234           **         -compile           Compiles generated servlets
235           **         -webinc <file>     Creates a partial servlet mappings in the file
236           **         -webxml <file>     Creates a complete web.xml in the file
237           **         -ieplugin <clsid>  Java Plugin classid for Internet Explorer
238           **         -classpath <path>  Overrides java.class.path system property
239           **         -xpoweredBy        Add X-Powered-By response header
240           **         -trimSpaces        Trim spaces in template text between actions, directives
241        -->
242        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
243            <classpath>
244                <pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
245                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
246                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
247                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
248                <pathelement location="../../jetty/jettylib/commons-el.jar" />
249                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
250                <pathelement location="${ant.home}/lib/ant.jar" />
251                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
252                <pathelement location="../../systray/java/build/obj" />
253                <pathelement location="../../systray/java/lib/systray4j.jar" />
254                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
255                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
256                <pathelement location="build/routerconsole.jar" />
257                <pathelement location="build/" />
258                <pathelement location="../../../router/java/build/router.jar" />
259                <pathelement location="../../../core/java/build/i2p.jar" />
260            </classpath>
261            <arg value="-d" />
262            <arg value="../jsp/WEB-INF/classes" />
263            <arg value="-v" />
264            <arg value="-p" />
265            <arg value="net.i2p.router.web.jsp" />
266            <arg value="-webinc" />
267            <arg value="../jsp/web-fragment.xml" />
268            <arg value="-webapp" />
269            <arg value="../jsp/" />
270        </java>
271       
272        <javac debug="true" deprecation="on" source="1.5" target="1.5" 
273               encoding="UTF-8"
274               includeAntRuntime="false"
275               destdir="../jsp/WEB-INF/classes/" 
276               srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
277            <compilerarg line="${javac.compilerargs}" />
278            <classpath>
279                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
280                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
281                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
282                <pathelement location="../../jetty/jettylib/commons-el.jar" />
283                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
284                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
285                <pathelement location="../../jetty/jettylib/jetty-sslengine.jar" />
286                <pathelement location="../../jetty/jettylib/jetty-java5-threadpool.jar" />
287                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
288                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
289                <pathelement location="../../systray/java/build/obj" />
290                <pathelement location="../../systray/java/lib/systray4j.jar" />
291                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
292                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
293                <pathelement location="build/routerconsole.jar" />
294                <pathelement location="build" />
295                <pathelement location="../../../router/java/build/router.jar" />
296                <pathelement location="../../../core/java/build/i2p.jar" />
297            </classpath>
298        </javac>
299
300        <!-- save these so we can run gettext on the generated java files later
301        <delete>
302            <fileset dir="../jsp/WEB-INF/" includes="**/*.java" />
303            <fileset dir="../jsp/WEB-INF/" includes="**/*.jsp" />
304        </delete>
305        -->
306        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
307        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
308        <replace file="../jsp/web-out.xml">
309            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
310        </replace>
311    </target>
312
313    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
314        <srcfiles dir= "../jsp" includes="**/*.jsp, *.jsi, **/*.html, *.css, susimail/susimail, web.xml"/>
315        <!-- so the version is right on logs.jsp -->
316        <srcfiles dir= "../../../router/java/src/net/i2p/router" includes="RouterVersion.java"/>
317    </uptodate>
318
319    <target name="javadoc">
320        <mkdir dir="./build" />
321        <mkdir dir="./build/javadoc" />
322        <javadoc 
323            sourcepath="./src:../../../core/java/src:../../../router/java/src:../../systray/java/src:../../desktopgui/src" destdir="./build/javadoc" 
324            packagenames="*" 
325            use="true" 
326            splitindex="true" 
327            windowtitle="Router Console" />
328    </target>
329    <target name="clean">
330        <delete dir="./build" />
331        <delete dir="../jsp/WEB-INF/" />
332        <delete file="../jsp/web-fragment.xml" />
333        <delete file="../jsp/web-out.xml" />
334    </target>
335    <target name="cleandep" depends="clean">
336    </target>
337    <target name="distclean" depends="clean">
338    </target>
339</project>
Note: See TracBrowser for help on using the repository browser.