source: apps/routerconsole/java/build.xml @ 93045c2a

Last change on this file since 93045c2a was 93045c2a, checked in by walking <walking@…>, 10 years ago

make windoz msg bundling suck less

  • Property mode set to 100644
File size: 12.7 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/javax.servlet.jar" />
25                <pathelement location="../../systray/java/build/obj" />
26                <pathelement location="../../systray/java/lib/systray4j.jar" />
27                <pathelement location="../../desktopgui/build" />
28                <pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" /> <!-- we dont care if we're not on win32 -->
29                <pathelement location="../../jrobin/jrobin-1.4.0.jar" />
30            </classpath>
31        </depend>
32    </target>
33    <target name="dependVersion">
34        <!-- Force the dependency on the RouterVersion as depend doesn't recognize constant changes  -->
35        <dependset>
36             <srcfilelist dir="." files="../../../router/java/build/obj/net/i2p/router/RouterVersion.class" />
37             <targetfilelist dir="." files="build/obj/net/i2p/router/web/NewsFetcher.class" />
38             <targetfilelist dir="." files="build/obj/net/i2p/router/web/SummaryHelper.class" />
39             <targetfilelist dir="." files="build/obj/net/i2p/router/web/UpdateHandler.class" />
40        </dependset>
41    </target>
42    <property name="javac.compilerargs" value="" />
43    <target name="compile" depends="prepare, depend, dependVersion">
44        <mkdir dir="./build" />
45        <mkdir dir="./build/obj" />
46        <javac 
47            srcdir="./src" 
48            debug="true" deprecation="on" source="1.5" target="1.5" 
49            destdir="./build/obj">
50            <compilerarg line="${javac.compilerargs}" />
51            <classpath>
52                <pathelement location="../../../core/java/build/i2p.jar" />
53                <pathelement location="../../../router/java/build/router.jar" />
54                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
55                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
56                <pathelement location="../../systray/java/build/systray.jar" />
57                <pathelement location="../../systray/java/lib/systray4j.jar" />
58                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
59                <pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" /> <!-- we dont care if we're not on win32 -->
60                <pathelement location="../../jrobin/jrobin-1.4.0.jar" />
61            </classpath>
62        </javac>
63    </target>
64    <target name="jar" depends="compile">
65        <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class">
66            <manifest>
67                <!-- top level installer will rename to jrobin.jar -->
68                <!-- DTG added in 0.8.4, not in the classpath for very old installs, before we changed wrapper.config to specify * -->
69                <attribute name="Class-Path" value="i2p.jar router.jar jrobin.jar desktopgui.jar" />
70            </manifest>
71        </jar>
72        <delete dir="./tmpextract" />
73       <!-- jrobin taken out of routerconsole.jar in 0.7.12
74        <unjar src="../../jrobin/jrobin-1.4.0.jar" dest="./tmpextract" />
75        <jar destfile="./build/routerconsole.jar" basedir="./tmpextract" update="true" />
76        <delete dir="./tmpextract" />
77       -->
78       
79        <ant target="war" />
80
81        <!-- Update the messages_*.po files.
82             We need to supply the bat file for windows, and then change the fail property to true -->
83        <exec executable="sh" osfamily="unix" failifexecutionfails="true" >
84            <arg value="./bundle-messages.sh" />
85        </exec>
86        <exec executable="sh" osfamily="mac" failifexecutionfails="true" >
87            <arg value="./bundle-messages.sh" />
88        </exec>
89        <exec executable="sh" osfamily="windows" failifexecutionfails="true" >
90            <arg value="./bundle-messages.sh" />
91        </exec>
92        <!-- jar again to get the latest messages_*.class files -->
93        <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
94    </target>
95
96    <target name="poupdate" depends="build">
97        <ant target="war" />
98        <!-- Update the messages_*.po files.
99             We need to supply the bat file for windows, and then change the fail property to true -->
100        <exec executable="sh" osfamily="unix" failifexecutionfails="true" >
101            <arg value="./bundle-messages.sh" />
102            <arg value="-p" />
103        </exec>
104        <exec executable="sh" osfamily="mac" failifexecutionfails="true" >
105            <arg value="./bundle-messages.sh" />
106            <arg value="-p" />
107        </exec>
108        <exec executable="sh" osfamily="windows" failifexecutionfails="true" >
109            <arg value="./bundle-messages.sh" />
110            <arg value="-p" />
111        </exec>
112    </target>
113    <target name="war" depends="precompilejsp">
114        <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
115        <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
116             basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, *.jsi, web-fragment.xml, web-out.xml">
117        </war>
118    </target>
119    <target name="precompilejsp" unless="precompilejsp.uptodate">
120        <delete dir="../jsp/WEB-INF/" />
121        <delete file="../jsp/web-fragment.xml" />
122        <delete file="../jsp/web-out.xml" />
123        <mkdir dir="../jsp/WEB-INF/" />
124        <mkdir dir="../jsp/WEB-INF/classes" />
125
126        <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
127        <!--
128           **     Usage: jspc <options> <jsp files>
129           **     where jsp files is
130           **         -webapp <dir>      A directory containing a web-app, whose JSP pages
131           **                            will be processed recursively
132           **     or any number of
133           **         <file>             A file to be parsed as a JSP page
134           **     where options include:
135           **         -help              Print this help message
136           **         -v                 Verbose mode
137           **         -d <dir>           Output Directory (default -Djava.io.tmpdir)
138           **         -l                 Outputs the name of the JSP page upon failure
139           **         -s                 Outputs the name of the JSP page upon success
140           **         -p <name>          Name of target package (default org.apache.jsp)
141           **         -c <name>          Name of target class name (only applies to first JSP page)
142           **         -mapped            Generates separate write() calls for each HTML line in the JSP
143           **         -die[#]            Generates an error return code (#) on fatal errors (default 1)
144           **         -uribase <dir>     The uri directory compilations should be relative to
145           **                            (default "/")
146           **         -uriroot <dir>     Same as -webapp
147           **         -compile           Compiles generated servlets
148           **         -webinc <file>     Creates a partial servlet mappings in the file
149           **         -webxml <file>     Creates a complete web.xml in the file
150           **         -ieplugin <clsid>  Java Plugin classid for Internet Explorer
151           **         -classpath <path>  Overrides java.class.path system property
152           **         -xpoweredBy        Add X-Powered-By response header
153           **         -trimSpaces        Trim spaces in template text between actions, directives
154        -->
155        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
156            <classpath>
157                <pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
158                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
159                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
160                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
161                <pathelement location="../../jetty/jettylib/commons-el.jar" />
162                <pathelement location="../../jetty/jettylib/ant.jar" />
163                <pathelement location="../../systray/java/build/obj" />
164                <pathelement location="../../systray/java/lib/systray4j.jar" />
165                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
166                <pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" />
167                <pathelement location="build/routerconsole.jar" />
168                <pathelement location="build/" />
169                <pathelement location="../../../router/java/build/router.jar" />
170                <pathelement location="../../../core/java/build/i2p.jar" />
171            </classpath>
172            <arg value="-d" />
173            <arg value="../jsp/WEB-INF/classes" />
174            <arg value="-v" />
175            <arg value="-p" />
176            <arg value="net.i2p.router.web.jsp" />
177            <arg value="-webinc" />
178            <arg value="../jsp/web-fragment.xml" />
179            <arg value="-webapp" />
180            <arg value="../jsp/" />
181        </java>
182       
183        <javac debug="true" deprecation="on" source="1.5" target="1.5" 
184               encoding="UTF-8"
185               destdir="../jsp/WEB-INF/classes/" 
186               srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
187            <compilerarg line="${javac.compilerargs}" />
188            <classpath>
189                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
190                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
191                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
192                <pathelement location="../../jetty/jettylib/commons-el.jar" />
193                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
194                <pathelement location="../../systray/java/build/obj" />
195                <pathelement location="../../systray/java/lib/systray4j.jar" />
196                <pathelement location="../../desktopgui/dist/desktopgui.jar" />
197                <pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" />
198                <pathelement location="build/routerconsole.jar" />
199                <pathelement location="build" />
200                <pathelement location="../../../router/java/build/router.jar" />
201                <pathelement location="../../../core/java/build/i2p.jar" />
202            </classpath>
203        </javac>
204
205        <!-- save these so we can run gettext on the generated java files later
206        <delete>
207            <fileset dir="../jsp/WEB-INF/" includes="**/*.java" />
208            <fileset dir="../jsp/WEB-INF/" includes="**/*.jsp" />
209        </delete>
210        -->
211        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
212        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
213        <replace file="../jsp/web-out.xml">
214            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
215        </replace>
216    </target>
217
218    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
219        <srcfiles dir= "../jsp" includes="**/*.jsp, **/*.html, *.css, susimail/susimail, web.xml"/>
220    </uptodate>
221
222    <target name="javadoc">
223        <mkdir dir="./build" />
224        <mkdir dir="./build/javadoc" />
225        <javadoc 
226            sourcepath="./src:../../../core/java/src:../../../router/java/src:../../systray/java/src:../../desktopgui/src" destdir="./build/javadoc" 
227            packagenames="*" 
228            use="true" 
229            splitindex="true" 
230            windowtitle="Router Console" />
231    </target>
232    <target name="clean">
233        <delete dir="./build" />
234        <delete dir="../jsp/WEB-INF/" />
235        <delete file="../jsp/web-fragment.xml" />
236        <delete file="../jsp/web-out.xml" />
237    </target>
238    <target name="cleandep" depends="clean">
239    </target>
240    <target name="distclean" depends="clean">
241    </target>
242</project>
Note: See TracBrowser for help on using the repository browser.