source: apps/routerconsole/java/build.xml @ 7bd83f8

Last change on this file since 7bd83f8 was 2b81cee, checked in by zzz <zzz@…>, 9 years ago

propagate from branch 'i2p.i2p.zzz.jetty6' (head b2ad0d72311d5ec26270cfcbbc79d128b268869b)

to branch 'i2p.i2p' (head b05b73d4740740f306a665e4b354d412eab2f328)

  • Property mode set to 100644
File size: 18.0 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="Built-By" value="${build.built-by}" />
106                <attribute name="Build-Date" value="${build.timestamp}" />
107                <attribute name="Base-Revision" value="${workspace.version}" />
108                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
109            </manifest>
110        </jar>
111    </target>
112
113    <!-- this is tricky because the message classes go in the jar, not in the war -->
114    <target name="bundle" depends="jar1, precompilejsp" >
115        <!-- Update the messages_*.po files.
116             We need to supply the bat file for windows, and then change the fail property to true -->
117        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
118            <arg value="./bundle-messages.sh" />
119        </exec>
120        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
121            <arg value="./bundle-messages.sh" />
122        </exec>
123                <!-- multi-lang is optional -->
124        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
125            <arg value="./bundle-messages.sh" />
126        </exec>
127        <!-- jar again to get the latest messages_*.class files -->
128        <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
129    </target>
130
131
132    <target name="jarUpToDate">
133        <uptodate property="jar.uptodate" targetfile="build/routerconsole.jar" >
134            <srcfiles dir= "build/obj" includes="**/*.class" />
135        </uptodate>
136        <condition property="shouldListChanges" >
137            <and>
138                <not>
139                    <isset property="jar.uptodate" />
140                </not>
141                <isset property="mtn.available" />
142            </and>
143        </condition>
144    </target>
145
146    <target name="poupdate" depends="precompilejsp">
147        <!-- Update the messages_*.po files.
148             We need to supply the bat file for windows, and then change the fail property to true -->
149        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
150            <arg value="./bundle-messages.sh" />
151            <arg value="-p" />
152        </exec>
153        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
154            <arg value="./bundle-messages.sh" />
155            <arg value="-p" />
156        </exec>
157        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
158            <arg value="./bundle-messages.sh" />
159            <arg value="-p" />
160        </exec>
161    </target>
162
163    <target name="listChangedFiles2" depends="warUpToDate" if="shouldListChanges2" >
164        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
165            <arg value="list" />
166            <arg value="changed" />
167            <arg value="../jsp" />
168        </exec>
169        <!-- \n in an attribute value generates an invalid manifest -->
170        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
171            <arg value="-s" />
172            <arg value="[:space:]" />
173            <arg value="," />
174        </exec>
175    </target>
176
177    <!-- does NOT update the message classes, as those go in the jar -->
178    <target name="war" depends="precompilejsp, warUpToDate, listChangedFiles2" unless="war.uptodate" >
179        <!-- set if unset -->
180        <property name="workspace.changes.w.tr" value="" />
181        <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
182        <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
183             basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, *.jsi, web-fragment.xml, web-out.xml">
184            <manifest>
185                <attribute name="Implementation-Version" value="${full.version}" />
186                <attribute name="Built-By" value="${build.built-by}" />
187                <attribute name="Build-Date" value="${build.timestamp}" />
188                <attribute name="Base-Revision" value="${workspace.version}" />
189                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
190            </manifest>
191        </war>
192    </target>
193
194    <target name="warUpToDate">
195        <uptodate property="war.uptodate" targetfile="build/routerconsole.war" >
196            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, *.css, **/*.java, *.jsp, *.jsi" />
197        </uptodate>
198        <condition property="shouldListChanges" >
199            <and>
200                <not>
201                    <isset property="jar.uptodate" />
202                </not>
203                <isset property="mtn.available" />
204            </and>
205        </condition>
206    </target>
207
208    <target name="precompilejsp" depends="jar1" unless="precompilejsp.uptodate">
209        <delete dir="../jsp/WEB-INF/" />
210        <delete file="../jsp/web-fragment.xml" />
211        <delete file="../jsp/web-out.xml" />
212        <mkdir dir="../jsp/WEB-INF/" />
213        <mkdir dir="../jsp/WEB-INF/classes" />
214
215        <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
216        <!--
217           **     Usage: jspc <options> <jsp files>
218           **     where jsp files is
219           **         -webapp <dir>      A directory containing a web-app, whose JSP pages
220           **                            will be processed recursively
221           **     or any number of
222           **         <file>             A file to be parsed as a JSP page
223           **     where options include:
224           **         -help              Print this help message
225           **         -v                 Verbose mode
226           **         -d <dir>           Output Directory (default -Djava.io.tmpdir)
227           **         -l                 Outputs the name of the JSP page upon failure
228           **         -s                 Outputs the name of the JSP page upon success
229           **         -p <name>          Name of target package (default org.apache.jsp)
230           **         -c <name>          Name of target class name (only applies to first JSP page)
231           **         -mapped            Generates separate write() calls for each HTML line in the JSP
232           **         -die[#]            Generates an error return code (#) on fatal errors (default 1)
233           **         -uribase <dir>     The uri directory compilations should be relative to
234           **                            (default "/")
235           **         -uriroot <dir>     Same as -webapp
236           **         -compile           Compiles generated servlets
237           **         -webinc <file>     Creates a partial servlet mappings in the file
238           **         -webxml <file>     Creates a complete web.xml in the file
239           **         -ieplugin <clsid>  Java Plugin classid for Internet Explorer
240           **         -classpath <path>  Overrides java.class.path system property
241           **         -xpoweredBy        Add X-Powered-By response header
242           **         -trimSpaces        Trim spaces in template text between actions, directives
243        -->
244        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
245            <classpath>
246                <pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
247                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
248                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
249                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
250                <pathelement location="../../jetty/jettylib/commons-el.jar" />
251                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
252                <pathelement location="${ant.home}/lib/ant.jar" />
253                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
254                <pathelement location="../../systray/java/build/obj" />
255                <pathelement location="../../systray/java/lib/systray4j.jar" />
256                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
257                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
258                <pathelement location="build/routerconsole.jar" />
259                <pathelement location="build/" />
260                <pathelement location="../../../router/java/build/router.jar" />
261                <pathelement location="../../../core/java/build/i2p.jar" />
262            </classpath>
263            <arg value="-d" />
264            <arg value="../jsp/WEB-INF/classes" />
265            <arg value="-v" />
266            <arg value="-p" />
267            <arg value="net.i2p.router.web.jsp" />
268            <arg value="-webinc" />
269            <arg value="../jsp/web-fragment.xml" />
270            <arg value="-webapp" />
271            <arg value="../jsp/" />
272        </java>
273       
274        <javac debug="true" deprecation="on" source="1.5" target="1.5" 
275               encoding="UTF-8"
276               includeAntRuntime="false"
277               destdir="../jsp/WEB-INF/classes/" 
278               srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
279            <compilerarg line="${javac.compilerargs}" />
280            <classpath>
281                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
282                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
283                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
284                <pathelement location="../../jetty/jettylib/commons-el.jar" />
285                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
286                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
287                <pathelement location="../../jetty/jettylib/jetty-sslengine.jar" />
288                <pathelement location="../../jetty/jettylib/jetty-java5-threadpool.jar" />
289                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
290                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
291                <pathelement location="../../systray/java/build/obj" />
292                <pathelement location="../../systray/java/lib/systray4j.jar" />
293                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
294                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
295                <pathelement location="build/routerconsole.jar" />
296                <pathelement location="build" />
297                <pathelement location="../../../router/java/build/router.jar" />
298                <pathelement location="../../../core/java/build/i2p.jar" />
299            </classpath>
300        </javac>
301
302        <!-- save these so we can run gettext on the generated java files later
303        <delete>
304            <fileset dir="../jsp/WEB-INF/" includes="**/*.java" />
305            <fileset dir="../jsp/WEB-INF/" includes="**/*.jsp" />
306        </delete>
307        -->
308        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
309        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
310        <replace file="../jsp/web-out.xml">
311            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
312        </replace>
313    </target>
314
315    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
316        <srcfiles dir= "../jsp" includes="**/*.jsp, *.jsi, **/*.html, *.css, susimail/susimail, web.xml"/>
317        <!-- so the version is right on logs.jsp -->
318        <srcfiles dir= "../../../router/java/src/net/i2p/router" includes="RouterVersion.java"/>
319    </uptodate>
320
321    <target name="javadoc">
322        <mkdir dir="./build" />
323        <mkdir dir="./build/javadoc" />
324        <javadoc 
325            sourcepath="./src:../../../core/java/src:../../../router/java/src:../../systray/java/src:../../desktopgui/src" destdir="./build/javadoc" 
326            packagenames="*" 
327            use="true" 
328            splitindex="true" 
329            windowtitle="Router Console" />
330    </target>
331    <target name="clean">
332        <delete dir="./build" />
333        <delete dir="../jsp/WEB-INF/" />
334        <delete file="../jsp/web-fragment.xml" />
335        <delete file="../jsp/web-out.xml" />
336    </target>
337    <target name="cleandep" depends="clean">
338    </target>
339    <target name="distclean" depends="clean">
340    </target>
341</project>
Note: See TracBrowser for help on using the repository browser.