source: build.xml @ 19fd865

Last change on this file since 19fd865 was 19fd865, checked in by zzz <zzz@…>, 9 years ago

new targets for including jbigi in the updater

  • Property mode set to 100644
File size: 63.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<project basedir="." default="all" name="i2p">
3   
4    <!-- Things you might want to change -->
5    <!-- This keeps gcj a lot quieter -->
6    <!--
7        <property name="javac.compilerargs" value="-warn:-unchecked,raw,unused,serial" />
8    -->
9    <!-- Additional classpath. No longer required; we find pack200 classes at runtime.
10         See core/java/src/net/i2p/util/FileUtil.java for more info.
11    -->
12    <!--
13        <property name="javac.classpath" value="/PATH/TO/pack200.jar" />
14    -->
15
16    <!-- change this to false if you don't have gettext -->
17    <property name="require.gettext" value="true" />
18
19    <!-- You probably don't want to change anything from here down -->
20    <target name="help" depends="all" />
21    <target name="all" >
22        <echo message="Useful targets: " />
23        <echo message="  pkg:       distclean then package everything up (installer, clean tarball, update tarball)" />
24        <echo message="  dist:      pkg and javadoc" />
25        <echo message="  installer: build the GUI installer" />
26        <echo message="  tarball:   tar the full install into i2p.tar.bz2 (extracts to build a new clean install)" />
27        <echo message="  updater:   Package the built files in i2pupdate.zip (extracts safely over existing installs)" />
28        <echo message="  updater200: Updater compressed with pack200 (creates i2pupdate200.zip, 60% smaller)" />
29        <echo message="  updaterWithJavadoc: updater including the javadocs, for display in the console" />
30        <echo message="  updaterWithJetty: Updater including Jetty" />
31        <echo message="  updaterWithJettyFixes: updater including local jetty patches" />
32        <echo message="  updaterWithGeoIP: updater including GeoIP Files" />
33        <echo message="  updaterWithJettyFixesAndGeoIP" />
34        <echo message="  updaterSmall:   updater with the essentials only - no SAM, i2psnark, SusiMail, SusiDNS, news.xml, or history.txt" />
35        <echo message="  updaterRouter:  updater with the i2p.jar and router.jar only" />
36        <echo message="  distclean: clean up all derived files" />
37        <!-- <echo message="  syndie:    generate a standalone syndie install" /> -->
38        <echo message="  desktopgui: generate a standalone desktopgui install" />
39        <echo message="  i2psnark:  generate a standalone i2psnark install" />
40        <echo message="  justBOB:  generate a standalone BOB-one.jar" />
41        <echo message="  javadoc:   generate javadoc for the entire project into ./build/javadoc" />
42        <echo message="  slackpkg:  generate Slackware packages in ./Slackware/i2p and ./Slackware/i2p-base" />
43        <echo message="  debianhowto: instructions on building Debian packages" />
44        <echo message="  debian: generate Debian packages in ../" />
45        <echo message="          run &quot;ant debianhowto&quot; for instructions" />
46        <echo message="  debian-clean: rollback debian specific patches and run the &quot;distclean&quot; target (done automatically at the end of the &quot;debian&quot; target)" />
47        <!-- <echo message="  debianrepo: build a Debian repository (reprepro required)" /> -->
48        <echo message="  poupdate: update the .po files for translators" />
49        <echo message="  pkg-portable-win32:  build a minimum portable version for win32" />
50   </target>
51    <target name="debianhowto">
52            <echo message="To build debian packages, you must make sure that you have" />
53            <echo message="the necessary build-dependencies installed." />
54            <echo message="The packages required to build can be found in the file "/>
55            <echo message="&quot;debian/control&quot; in both the Build-Depends and Build-Depends-Indep fields."/>
56            <echo message="In addition to those packages, be sure to install &quot;fakeroot&quot;,"/>
57            <echo message="&quot;quilt&quot; and &quot;build-essential&quot;!" />
58            <echo message="" />
59            <echo message="The following command will install all dependencies for you:" />
60            <echo message="apt-get install debhelper ant debconf default-jdk gettext libgmp3-dev po-debconf fakeroot build-essential quilt" />
61            <echo message=" " />
62            <echo message="Once the dependencies are installed, run &quot;ant debian&quot;"/>
63            <echo message="to patch the source and build the packages." />
64    </target>
65    <target name="dist" depends="pkg, javadoc">
66    </target>
67    <target name="build" depends="build2">
68        <!-- so we don't build standalone for the updater -->
69        <!-- This builds apps/i2psnark/java/i2psnark-standalone.zip,
70          -   which we don't distribute anywhere...
71        <ant dir="apps/i2psnark/java/" target="standalone" />
72        -->
73    </target>
74    <target name="build2" depends="builddep, jar, buildWEB" />
75    <target name="buildSmall" depends="builddepSmall, jarSmall, buildWEB" />
76    <target name="buildclean" depends="distclean, build" />
77
78    <target name="builddep" depends="builddepSmall, buildBOB, buildSAM, buildSusiMail, buildSusiDNS, buildI2PSnark" />
79
80    <target name="builddepSmall" depends="buildrouter, buildSystray, buildDesktopGui, buildRouterConsole, buildStreaming, buildI2PTunnel, buildAddressbook" />
81
82    <!-- start of buildX, one for each sub-build.xml.
83         Do not put ant tasks in the sub-build.xmls anymore,
84         so the build will go faster.
85      -->
86
87    <target name="buildBOB" depends="buildStreaming" >
88        <ant dir="apps/BOB/" target="jar" />
89    </target>
90
91    <target name="buildSAM" depends="buildStreaming" >
92        <ant dir="apps/sam/java/" target="jar" />
93    </target>
94
95    <target name="buildSusiMail" depends="buildCore, buildJetty" >
96        <ant dir="apps/susimail/" target="war" />
97    </target>
98
99    <target name="buildSusiDNS" depends="buildCore, buildJetty" >
100        <ant dir="apps/susidns/src" target="all" />
101    </target>
102
103    <target name="buildI2PSnark" depends="buildStreaming, buildJetty" >
104        <ant dir="apps/i2psnark/java/" target="war" />
105    </target>
106
107    <target name="buildAddressbook" depends="buildCore, buildJetty" >
108        <ant dir="apps/addressbook/" target="war" />
109    </target>
110
111    <target name="buildI2PTunnel" depends="buildStreaming, buildJetty" >
112        <ant dir="apps/i2ptunnel/java/" target="build" />
113    </target>
114
115    <target name="buildDesktopGui" depends="buildCore, buildrouter" >
116<!--
117        <ant dir="apps/desktopgui" target="clean" />
118-->
119        <ant dir="apps/desktopgui" target="jar" />
120    </target>
121
122    <target name="buildRouterConsole" depends="buildrouter, buildSystray, buildDesktopGui, buildJetty" >
123        <ant dir="apps/routerconsole/java/" target="jar" />
124    </target>
125
126    <target name="buildJetty" depends="buildProperties" >
127        <ant dir="apps/jetty" target="build" />
128    </target>
129
130    <target name="buildSystray" depends="buildCore" >
131        <ant dir="apps/systray/java/" target="jar" />
132    </target>
133
134    <target name="buildStreaming" depends="buildMinistreaming" >
135        <ant dir="apps/streaming/java/" target="jar" />
136    </target>
137
138    <target name="buildMinistreaming" depends="buildCore" >
139        <ant dir="apps/ministreaming/java/" target="jar" />
140    </target>
141
142    <target name="buildRouter" depends="buildrouter" />
143    <target name="buildrouter" depends="buildCore" >
144        <ant dir="router/java/" target="jar" />
145        <copy file="router/java/build/router.jar" todir="build/" />
146    </target>
147
148    <target name="buildCore" depends="buildProperties" >
149        <ant dir="core/java/" target="jar" />
150        <copy file="core/java/build/i2p.jar" todir="build/" />
151    </target>
152
153    <target name="buildJrobin" depends="buildProperties" >
154        <!-- take only what we need from the jrobin jar -->
155        <jar destfile="build/jrobin.jar" >
156            <zipfileset src="apps/jrobin/jrobin-1.5.9.1.jar"
157                        excludes="org/jrobin/cmd/ org/jrobin/convertor/ org/jrobin/inspector/" />
158            <manifest>
159                <attribute name="Build-Date" value="${build.timestamp}" />
160                <attribute name="Base-Revision" value="${workspace.version}" />
161            </manifest>
162        </jar>
163    </target>
164
165    <target name="checkForMtn" >
166        <available property="mtn.available" file="_MTN" type="dir" />
167    </target>
168
169    <target name="getMtnRev" depends="checkForMtn" if="mtn.available" >
170        <exec executable="mtn" outputproperty="workspace.version" errorproperty="mtn.error1" failifexecutionfails="false" >
171            <arg value="automate" />
172            <arg value="get_base_revision_id" />
173        </exec>
174    </target>
175
176    <target name="buildProperties" depends="getMtnRev" >
177        <!-- default if not set above -->
178        <property name="workspace.version" value="unknown" />
179        <tstamp>
180            <format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC" locale="en" />
181        </tstamp>
182    </target>
183
184    <!-- end of sub-build.xml targets -->
185
186    <target name="buildWEB" depends="buildRouterConsole" >
187        <copy file="apps/routerconsole/java/build/routerconsole.jar" todir="build/" />
188        <copy file="apps/routerconsole/java/build/routerconsole.war" todir="build/" />
189        <copy file="apps/jetty/jettylib/org.mortbay.jetty.jar" todir="build/" />
190        <copy file="apps/jetty/jettylib/jasper-compiler.jar" todir="build/" />
191        <copy file="apps/jetty/jettylib/jasper-runtime.jar" todir="build/" />
192        <copy file="apps/jetty/jettylib/commons-logging.jar" todir="build/" />
193        <copy file="apps/jetty/jettylib/commons-el.jar" todir="build/" />
194        <copy file="apps/jetty/jettylib/javax.servlet.jar" todir="build/" />
195    </target>
196
197    <target name="buildexe">
198        <condition property="noExe">
199            <os arch="x86_64" />
200        </condition>
201        <condition property="noExe">
202            <os arch="ppc" />
203        </condition>
204        <condition property="noExe">
205            <os arch="amd64" />
206        </condition>
207        <condition property="noExe">
208           <not>
209            <or>
210             <os name="Linux" />
211             <os family="windows" />
212            </or>
213           </not>
214        </condition>
215        <ant target="doBuildEXE" />
216    </target>
217    <target name="doBuildEXE" depends="buildProperties" unless="noExe">
218        <jar destfile="./build/launchi2p.jar">
219            <manifest>
220             <attribute name="Main-Class" value="net.i2p.router.RouterLaunch" />
221             <attribute name="Class-Path" value="lib/i2p.jar lib/router.jar lib/jbigi.jar lib/BOB.jar lib/sam.jar lib/mstreaming.jar lib/streaming.jar lib/routerconsole.jar lib/i2ptunnel.jar lib/org.mortbay.jetty.jar lib/javax.servlet.jar lib/jasper-compiler.jar lib/jasper-runtime.jar lib/commons-logging.jar lib/commons-el.jar lib/wrapper.jar lib/systray.jar lib/systray4j.jar lib/desktopgui.jar" />
222             <attribute name="Build-Date" value="${build.timestamp}" />
223             <attribute name="Base-Revision" value="${workspace.version}" />
224            </manifest>
225        </jar>
226        <!-- now the standalone launcher exe -->
227        <taskdef name="launch4j"
228                 classname="net.sf.launch4j.ant.Launch4jTask"
229                 classpath="${basedir}/installer/lib/launch4j/launch4j.jar:${basedir}/installer/lib/launch4j/lib/xstream.jar" />
230        <launch4j configFile="./installer/i2pstandalone.xml" />
231        <!-- thazzit -->
232    </target>
233
234    <target name="jar" depends="jarSmall" >
235        <copy file="apps/BOB/dist/BOB.jar" todir="build/" />
236        <copy file="apps/sam/java/build/sam.jar" todir="build/" />
237        <copy file="apps/susimail/susimail.war" todir="build/" />
238        <copy file="apps/susidns/src/susidns.war" todir="build/" />
239        <copy file="apps/i2psnark/i2psnark.war" todir="build/" />
240        <copy file="apps/i2psnark/java/build/i2psnark.jar" todir="build/" />
241
242    </target>
243    <target name="jarSmall" depends="builddepSmall, buildJrobin" >
244        <copy file="core/java/build/i2p.jar" todir="build/" />
245        <copy file="router/java/build/router.jar" todir="build/" />
246        <copy file="apps/ministreaming/java/build/mstreaming.jar" todir="build/" />
247        <copy file="apps/streaming/java/build/streaming.jar" todir="build/" />
248        <copy file="apps/i2ptunnel/java/build/i2ptunnel.jar" todir="build/" />
249        <copy file="apps/i2ptunnel/java/build/i2ptunnel.war" todir="build/" />
250        <copy file="apps/systray/java/build/systray.jar" todir="build/" />
251        <copy file="apps/desktopgui/dist/desktopgui.jar" todir="build/" />
252        <copy file="apps/addressbook/dist/addressbook.war" todir="build/" />
253    </target>
254
255    <target name="jbigi-list-changes" depends="checkForMtn" if="mtn.available" >
256        <exec executable="mtn" outputproperty="workspace.changes.jbigi" errorproperty="mtn.error.jbigi" failifexecutionfails="false" >
257            <arg value="list" />
258            <arg value="changed" />
259            <arg value="installer/lib/jbigi" />
260        </exec>
261        <!-- \n in an attribute value generates an invalid manifest -->
262        <exec executable="tr" inputstring="${workspace.changes.jbigi}" outputproperty="workspace.changes.jbigi.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
263            <arg value="-s" />
264            <arg value="[:space:]" />
265            <arg value="," />
266        </exec>
267    </target>
268
269    <target name="jbigi" depends="buildProperties, jbigi-list-changes" >
270        <!-- set if unset -->
271        <property name="workspace.changes.jbigi.tr" value="" />
272        <jar destfile="build/jbigi.jar" whenmanifestonly="fail" >
273            <fileset dir="installer/lib/jbigi" includes="*.so *.dll *.jnilib" />
274            <manifest>
275                <attribute name="Build-Date" value="${build.timestamp}" />
276                <attribute name="Base-Revision" value="${workspace.version}" />
277                <attribute name="Workspace-Changes" value="${workspace.changes.jbigi.tr}" />
278            </manifest>
279        </jar>
280    </target>
281
282    <target name="jbigi-windows-only" depends="buildProperties, jbigi-list-changes" >
283        <!-- set if unset -->
284        <property name="workspace.changes.jbigi.tr" value="" />
285        <jar destfile="build/jbigi.jar" whenmanifestonly="fail" >
286            <fileset dir="installer/lib/jbigi" includes="*windows*.dll" />
287            <manifest>
288                <attribute name="Build-Date" value="${build.timestamp}" />
289                <attribute name="Base-Revision" value="${workspace.version}" />
290                <attribute name="Workspace-Changes" value="${workspace.changes.jbigi.tr}" />
291            </manifest>
292        </jar>
293    </target>
294
295    <target name="jbigi-linux-only"  depends="buildProperties, jbigi-list-changes" >
296        <!-- set if unset -->
297        <property name="workspace.changes.jbigi.tr" value="" />
298        <jar destfile="build/jbigi.jar"  whenmanifestonly="fail" >
299            <fileset dir="installer/lib/jbigi" includes="*linux*.so" />
300            <manifest>
301                <attribute name="Build-Date" value="${build.timestamp}" />
302                <attribute name="Base-Revision" value="${workspace.version}" />
303                <attribute name="Workspace-Changes" value="${workspace.changes.jbigi.tr}" />
304            </manifest>
305        </jar>
306    </target>
307
308    <!-- the apps need to compile the jsps to poupdate -->
309    <target name="poupdate" depends="buildRouter, buildStreaming, buildSystray, buildJetty, buildDesktopGui" >
310        <echo message="Setting environment variable LG2 to a lang code (eg: de,zh,nl etc)" />
311        <echo message=" will restrict language update to the language you specified, leaving other language untact." />
312        <ant dir="apps/routerconsole/java/" target="poupdate" />
313        <ant dir="apps/i2psnark/java/" target="poupdate" />
314        <ant dir="apps/i2ptunnel/java/" target="poupdate" />
315        <ant dir="apps/susidns/src/" target="poupdate" />
316        <ant dir="apps/susimail/" target="poupdate" />
317        <ant dir="apps/desktopgui" target="poupdate" />
318    </target>
319    <target name="javadoc">
320        <ant dir="apps/jetty" target="ensureJettylib" />
321        <mkdir dir="./build" />
322        <mkdir dir="./build/javadoc" />
323        <!-- get release and build version numbers -->
324        <exec executable="grep" outputproperty="versionLine" >
325            <arg value="public final static String VERSION" />
326            <arg value="core/java/src/net/i2p/CoreVersion.java" />
327        </exec>
328        <exec executable="cut" inputstring="${versionLine}" outputproperty="release.number" >
329            <arg value="-f2" />
330            <arg value="-d&quot;" />
331        </exec>
332        <exec executable="grep" outputproperty="buildLine" >
333            <arg value="public final static long BUILD" />
334            <arg value="router/java/src/net/i2p/router/RouterVersion.java" />
335        </exec>
336        <exec executable="cut" inputstring="${buildLine}" outputproperty="build.temp" >
337            <arg value="-f2" />
338            <arg value="-d=" />
339        </exec>
340        <exec executable="cut" inputstring="${build.temp}" outputproperty="build.number" >
341            <arg value="-f1" />
342            <arg value="-d;" />
343        </exec>
344        <javadoc access="package" 
345            destdir="./build/javadoc" 
346            packagenames="*" 
347            use="true" 
348            splitindex="true" 
349            doctitle="I2P Javadocs for Release ${release.number} Build ${build.number}"
350            windowtitle="I2P Anonymous Network - Java Documentation - Version ${release.number}">
351            <group title="Core SDK (i2p.jar)" packages="net.i2p:net.i2p.*:net.i2p.client:net.i2p.client.*:net.i2p.internal:net.i2p.internal.*:freenet.support.CPUInformation:org.bouncycastle.crypto:org.bouncycastle.crypto.*:gnu.crypto.*:gnu.gettext:org.xlattice.crypto.filters:com.nettgryppa.security:net.metanotion.*" />
352            <group title="Streaming Library" packages="net.i2p.client.streaming" />
353            <group title="Router" packages="net.i2p.router:net.i2p.router.*:net.i2p.data.i2np:org.cybergarage.*:org.freenetproject" />
354            <group title="Router Console" packages="net.i2p.router.web" />
355            <!-- apps and bridges starting here, alphabetical please -->
356            <group title="Addressbook Application" packages="net.i2p.addressbook" />
357            <group title="BOB Bridge" packages="net.i2p.BOB" />
358            <group title="Desktopgui Application" packages="net.i2p.desktopgui.*" />
359            <group title="I2PSnark Application" packages="org.klomp.snark:org.klomp.snark.*" />
360            <group title="I2PTunnel Application" packages="net.i2p.i2ptunnel:net.i2p.i2ptunnel.*" />
361            <group title="SAM Bridge" packages="net.i2p.sam:net.i2p.sam.client" />
362            <group title="SusiDNS Application" packages="i2p.susi.dns" />
363            <group title="SusiMail Application" packages="i2p.susi.webmail:i2p.susi.webmail.*:i2p.susi.debug:i2p.susi.util" />
364            <group title="Systray Application" packages="net.i2p.apps.systray" />
365            <sourcepath>
366                <pathelement location="core/java/src" />
367                <!--<pathelement location="core/java/test" />-->
368                <pathelement location="router/java/src" />
369                <!--<pathelement location="router/java/test" />-->
370                <pathelement location="apps/ministreaming/java/src" />
371                <pathelement location="apps/streaming/java/src" />
372                <pathelement location="apps/i2ptunnel/java/src" />
373                <pathelement location="apps/systray/java/src" />
374                <pathelement location="apps/desktopgui/src" />
375                <pathelement location="apps/routerconsole/java/src" />
376                <pathelement location="apps/addressbook/java/src" />
377                <pathelement location="apps/i2psnark/java/src" />
378                <pathelement location="apps/sam/java/src" />
379                <pathelement location="apps/BOB/src" />
380                <pathelement location="apps/susidns/src/java/src" />
381                <pathelement location="apps/susimail/src/src" />
382            </sourcepath>
383            <classpath>
384                <pathelement location="apps/jetty/jettylib/org.mortbay.jetty.jar" />
385                <pathelement location="apps/jetty/jettylib/javax.servlet.jar" />
386                <pathelement location="apps/systray/java/lib/systray4j.jar" />
387                <pathelement location="apps/jrobin/jrobin-1.5.9.1.jar" />
388                <pathelement location="installer/lib/wrapper/all/wrapper.jar" />
389                <pathelement location="core/lib/junit.jar" />               
390            </classpath>
391            <link offline="true" href="http://download.oracle.com/javase/6/docs/api/" packagelistLoc="installer/resources/package-lists/java/" />
392            <link offline="true" href="http://docs.i2p2.de/jetty/javadoc/" packagelistLoc="installer/resources/package-lists/jetty/" />
393            <link offline="true" href="http://docs.i2p2.de/jrobin/javadoc/" packagelistLoc="installer/resources/package-lists/jrobin/" />
394        </javadoc>
395        <echo message="Warning, javadoc embeds timestamps in the output, run with 'TZ=UTC ant javadoc' if you plan to distribute" />
396    </target>
397
398    <target name="clean" depends="pkgclean" >
399        <delete dir="./build" />
400        <delete file="i2pinstall.exe" failonerror="false" quiet="true" />       
401        <delete file="i2p.exe" failonerror="false" quiet="true" />
402        <delete file="syndie-standalone.zip" failonerror="false" quiet="true" />
403        <delete file="i2psnark-standalone.zip" failonerror="false" quiet="true" />
404        <delete file="BOB-one.jar" failonerror="false" quiet="true" /> 
405        <delete dir="core/c/jbigi/bin" />
406        <delete dir="core/c/jbigi/lib" />
407        <delete dir="core/c/jcpuid/lib" />
408        <delete dir="debian/tmp" />
409        <delete dir="debian/db" />
410        <delete file="debian/files" />
411        <delete file="debian/copyright" />
412        <delete file="debian/build" />
413        <delete file="debian/substvars"/>
414    </target>
415    <target name="distclean" depends="clean">
416        <delete includeemptydirs="true" failonerror="false" >
417            <fileset dir="debian/packages" followSymlinks="false" />
418        </delete>
419        <delete dir="debian/repo" />
420        <ant dir="core/java/" target="distclean" />
421        <ant dir="router/java/" target="distclean" />
422        <ant dir="apps/ministreaming/java/" target="distclean" />
423        <ant dir="apps/streaming/java/" target="distclean" />
424        <ant dir="apps/i2ptunnel/java/" target="distclean" />
425        <ant dir="apps/sam/java/" target="distclean" />
426        <ant dir="apps/BOB" target="clean" />
427        <ant dir="apps/desktopgui" target="clean" />
428        <ant dir="apps/routerconsole/java/" target="distclean" />
429        <ant dir="apps/addressbook/" target="distclean" />
430        <ant dir="apps/susimail/" target="distclean" />
431        <ant dir="apps/susidns/src/" target="distclean" />
432        <ant dir="apps/systray/java/" target="distclean" />
433        <ant dir="apps/i2psnark/java/" target="distclean" />
434        <ant dir="apps/jetty/" target="distclean" />
435        <!--
436                NOTE! We need to turn off the default excludes for these
437                patterns to work.
438                These are the defaultexcludes in Ant as seen on
439                http://ant.apache.org/manual/CoreTasks/defaultexcludes.html
440                     **/*~
441                     **/#*#
442                     **/.#*
443                     **/%*%
444                     **/._*
445                     **/CVS
446                     **/CVS/**
447                     **/.cvsignore
448                     **/SCCS
449                     **/SCCS/**
450                     **/vssver.scc
451                     **/.svn
452                     **/.svn/**
453                     **/.DS_Store
454                The only recourse is to remove the offending ones.
455                We do this here, as we only need one change, and then put it
456                back after we are done with it.
457        -->
458        <defaultexcludes remove="**/*~"/>
459
460        <delete>
461            <fileset dir="." includes="**/*.class **/*.java~ **/*.txt~ **/*.xml~ **/*.sh~ **/*.SlackBuild~" />
462            <!--
463                Less common, but they pollute my workspace here, so we
464                might as well nuke these as well. Are there any others?
465               
466                !!??? Why don't we just nuke "**/*~" ???!!
467
468                ++Sponge
469            -->
470        </delete>
471        <!--
472                Now we put the defaults back
473        -->
474        <defaultexcludes default="true"/>
475    </target>
476
477    <target name="pkg" depends="distclean, updater, preppkg, installer" />
478
479    <target name="pkgclean" depends="deletepkg-temp">
480        <delete>
481            <fileset dir="." includes="i2p.tar.bz2 install.jar i2pupdate.zip i2pupdate200.zip" />
482        </delete>
483    </target>
484
485    <target name="preppkg" depends="preppkg-linux, preppkg-windows, jbigi">
486        <copy file="build/jbigi.jar" todir="pkg-temp/lib" />
487        <copy todir="pkg-temp/lib/wrapper/freebsd/">
488            <fileset dir="installer/lib/wrapper/freebsd/" />
489        </copy>
490        <copy todir="pkg-temp/lib/wrapper/freebsd64/">
491            <fileset dir="installer/lib/wrapper/freebsd64" />
492        </copy>
493        <copy todir="pkg-temp/lib/wrapper/macosx/">
494            <fileset dir="installer/lib/wrapper/macosx/" />
495        </copy>
496        <copy todir="pkg-temp/lib/wrapper/solaris/">
497            <fileset dir="installer/lib/wrapper/solaris/" />
498        </copy>
499        <copy todir="pkg-temp/lib/wrapper/linux-arm/">
500            <fileset dir="installer/lib/wrapper/linux-arm/" />
501        </copy>
502    </target>
503
504    <target name="preppkg-windows" depends="preppkg-base, buildexe">
505        <copy file="i2p.exe" todir="pkg-temp/" failonerror="false" />
506        <copy file="apps/systray/java/lib/systray4j.dll" todir="pkg-temp/lib" />
507        <copy file="apps/systray/java/resources/iggy.ico" todir="pkg-temp/icons" />
508        <copy file="apps/systray/java/resources/iggy.xpm" todir="pkg-temp/icons" />
509        <copy file="installer/resources/eepget.bat" todir="pkg-temp/" />
510        <copy file="installer/resources/i2prouter.bat" todir="pkg-temp/" />
511        <copy file="installer/resources/fixperms.bat" todir="pkg-temp/" />
512        <copy file="installer/resources/install_i2p_service_winnt.bat" todir="pkg-temp/" />
513        <copy file="installer/resources/set_config_dir_for_nt_service.bat" todir="pkg-temp/" />
514        <copy file="installer/resources/uninstall_i2p_service_winnt.bat" todir="pkg-temp/" />
515        <copy file="installer/lib/wrapper/all/wrapper.jar" todir="pkg-temp/lib" />
516        <copy todir="pkg-temp/lib/wrapper/win32/">
517            <fileset dir="installer/lib/wrapper/win32/" />
518        </copy>
519        <copy todir="pkg-temp/lib/wrapper/win64/">
520            <fileset dir="installer/lib/wrapper/win64/" />
521        </copy>
522    </target>
523
524    <!-- only what is needed for debian, etc. -->
525    <target name="preppkg-linux-only" depends="preppkg-linux, jbigi-linux-only" >
526        <copy file="build/jbigi.jar" todir="pkg-temp/lib" />
527        <copy file="installer/lib/wrapper/all/wrapper.jar" todir="pkg-temp/lib" />
528    </target>
529
530    <!-- x86 linux only -->
531    <target name="preppkg-linux" depends="preppkg-base">
532        <copy file="installer/resources/runplain.sh" todir="pkg-temp/" />
533        <!-- <copy file="apps/i2psnark/launch-i2psnark" todir="pkg-temp/" /> old feature that per zzz isn't used-->
534        <copy file="installer/resources/eepget" todir="pkg-temp/" />
535        <copy file="installer/resources/i2prouter" todir="pkg-temp/" />
536        <copy file="installer/resources/osid" todir="pkg-temp/" />
537        <copy file="installer/resources/postinstall.sh" todir="pkg-temp/" />
538        <copy todir="pkg-temp/man/">
539            <fileset dir="installer/resources/man/" />
540        </copy>
541        <copy todir="pkg-temp/lib/wrapper/linux/">
542            <fileset dir="installer/lib/wrapper/linux/" />
543        </copy>
544        <copy todir="pkg-temp/lib/wrapper/linux64/">
545            <fileset dir="installer/lib/wrapper/linux64/" />
546        </copy>
547    </target>
548
549    <target name="preppkg-base" depends="build, preplicenses, prepConsoleDocs, prepthemeupdates, prepCertificates">
550        <!-- if updater200 was run previously, it left *.pack files in pkg-temp -->
551        <delete>
552            <fileset dir="pkg-temp" includes="**/*.jar.pack **/*.war.pack" />
553        </delete>
554        <copy file="build/i2p.jar" todir="pkg-temp/lib/" />
555        <copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
556        <copy file="build/jasper-compiler.jar" todir="pkg-temp/lib/" />
557        <copy file="build/jasper-runtime.jar" todir="pkg-temp/lib/" />
558        <copy file="build/commons-logging.jar" todir="pkg-temp/lib/" />
559        <copy file="build/commons-el.jar" todir="pkg-temp/lib/" />
560        <copy file="build/javax.servlet.jar" todir="pkg-temp/lib/" />
561        <copy file="build/mstreaming.jar" todir="pkg-temp/lib/" />
562        <copy file="build/streaming.jar" todir="pkg-temp/lib/" />
563        <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
564        <copy file="build/router.jar" todir="pkg-temp/lib/" />
565        <copy file="build/desktopgui.jar" todir="pkg-temp/lib/" />
566        <copy file="build/routerconsole.jar" todir="pkg-temp/lib/" />
567        <!-- pulled out of routerconsole.jar in 0.7.12; name without version so we can overwrite if we upgrade  -->
568        <copy file="build/jrobin.jar" tofile="pkg-temp/lib/jrobin.jar" />
569        <copy file="build/sam.jar" todir="pkg-temp/lib/" />
570        <copy file="build/BOB.jar" todir="pkg-temp/lib/" />
571        <copy file="build/systray.jar" todir="pkg-temp/lib" />
572        <copy file="build/i2psnark.jar" todir="pkg-temp/lib/" />
573        <copy file="apps/systray/java/lib/systray4j.jar" todir="pkg-temp/lib" />
574        <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
575        <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
576        <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
577        <copy file="build/susimail.war" todir="pkg-temp/webapps/" />
578        <copy file="build/susidns.war" todir="pkg-temp/webapps/" />
579        <copy file="apps/susidns/src/WEB-INF/lib/jstl.jar" todir="pkg-temp/lib/" />
580        <copy file="apps/susidns/src/WEB-INF/lib/standard.jar" todir="pkg-temp/lib/" />
581        <copy file="build/i2psnark.war" todir="pkg-temp/webapps/" />
582        <!--
583             Disabling per zzz's statement on IRC: jetty-i2psnark.xml is for an obscure feature that is broken anyway,
584                                                   you can remove the file, the link, and the patch from the package
585
586                     So I'm going one further: I'm disabling it in build.xml
587                     +++kytv
588                     -->
589        <!--
590        <copy file="apps/i2psnark/jetty-i2psnark.xml" todir="pkg-temp/" />
591        -->
592        <copy file="apps/i2psnark/i2psnark.config" todir="pkg-temp/" />
593        <copy file="installer/resources/blocklist.txt" todir="pkg-temp/" />
594        <copy file="installer/resources/clients.config" todir="pkg-temp/" />
595        <copy file="installer/resources/i2ptunnel.config" todir="pkg-temp/" />
596        <copy file="installer/resources/systray.config" todir="pkg-temp/" />
597        <copy file="installer/resources/wrapper.config" todir="pkg-temp/" />
598        <copy file="installer/resources/hosts.txt" todir="pkg-temp/" />
599        <copy file="INSTALL-headless.txt" todir="pkg-temp/" />
600        <!-- overwrite the truncated history put in by the updater -->
601        <copy file="history.txt" todir="pkg-temp/" overwrite="true" />
602        <mkdir dir="pkg-temp/scripts" />
603        <copy file="apps/proxyscript/i2pProxy.pac" todir="pkg-temp/scripts/" />
604        <copy file="installer/resources/startconsole.html" todir="pkg-temp/docs/" />
605        <copy file="installer/resources/start.ico" todir="pkg-temp/docs/" />
606        <copy file="installer/resources/console.ico" todir="pkg-temp/docs/" />
607        <copy file="installer/resources/uninstall.ico" todir="pkg-temp/docs/" />
608        <!-- Eepsite stuff here -->
609        <mkdir dir="pkg-temp/eepsite" />
610        <mkdir dir="pkg-temp/eepsite/webapps" />
611        <mkdir dir="pkg-temp/eepsite/logs" />
612        <mkdir dir="pkg-temp/eepsite/cgi-bin" />
613        <mkdir dir="pkg-temp/eepsite/docroot" />
614        <mkdir dir="pkg-temp/eepsite/docroot/help" />
615        <mkdir dir="pkg-temp/eepsite/docroot/help/lib" />
616        <copy todir="pkg-temp/eepsite/docroot/" >
617            <fileset dir="installer/resources/eepsite.help/" />
618        </copy>
619        <copy todir="pkg-temp/eepsite/docroot/help/lib/" >
620            <fileset dir="installer/resources/icons/flags/" includes="cn.png de.png es.png fr.png ir.png it.png jp.png nl.png ru.png se.png us.png" />
621        </copy>
622        <copy file="installer/resources/themes/console/images/favicon.ico" tofile="pkg-temp/eepsite/docroot/favicon.ico" />
623        <copy file="installer/resources/jetty.xml" tofile="pkg-temp/eepsite/jetty.xml" />
624    </target>
625
626    <target name="preplicenses">
627        <copy file="LICENSE.txt" todir="pkg-temp/" />
628        <copy todir="pkg-temp/licenses/" >
629          <fileset dir="licenses/" />
630        </copy>
631        <!--
632              The license in launch4j/ is a BSD license for launch4j
633              The license in launch4j/head is a MIT license for the code that is actually wrapped around the jars
634              So we include the MIT one in our binary package
635         -->
636        <copy file="installer/lib/launch4j/head/LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-Launch4j.txt" />
637        <!--  Not sure if these are used or should be included -->
638        <copy file="installer/lib/launch4j/lib/foxtrot.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-Foxtrot.txt" />
639        <copy file="installer/lib/launch4j/lib/JGoodies.Forms.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-JGoodies-Forms.txt" />
640        <copy file="installer/lib/launch4j/lib/JGoodies.Looks.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-JGoodies-Looks.txt" />
641        <copy file="installer/lib/launch4j/lib/XStream.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-XStream.txt" />
642    </target>
643
644    <target name="prepthemeupdates">
645        <copy todir="pkg-temp/docs/themes/" >
646            <fileset dir="installer/resources/themes/" />
647        </copy>
648    </target>
649
650    <!-- SSL Certs -->
651    <target name="prepCertificates">
652        <copy todir="pkg-temp/certificates/" >
653          <fileset dir="installer/resources/certificates/" />
654        </copy>
655    </target>
656
657    <!-- this is no longer required, izpack 4.3.0 supports headless installs with java -jar i2pinstall.exe -console -->
658    <target name="tarball" depends="preppkg">
659        <tar compression="bzip2" destfile="i2p.tar.bz2">
660            <tarfileset dir="pkg-temp" includes="**/*" prefix="i2p" />
661        </tar>
662    </target>
663
664    <target name="deletepkg-temp">
665        <delete dir="pkg-temp" />
666    </target>
667
668    <!-- readme and proxy error page files, initialNews.xml files, GeoIP files, and flag icons -->
669    <target name="prepConsoleDocs" depends="prepConsoleDocUpdates, prepgeoupdate" >
670        <copy todir="pkg-temp/docs/initialNews/">
671          <fileset dir="installer/resources/initialNews/" />
672        </copy>
673    </target>
674
675    <!-- readme and proxy error page files -->
676    <target name="prepConsoleDocUpdates">
677        <copy todir="pkg-temp/docs/" >
678          <fileset dir="installer/resources/readme/" includes="readme*.html" />
679          <fileset dir="installer/resources/proxy/" includes="*.ht" />
680          <!-- lang_ar.png added in 0.8.4 -->
681          <fileset dir="installer/resources/" includes="icons/flags/lang_ar.png" />
682        </copy>
683    </target>
684
685    <target name="consoleDocs" depends="deletepkg-temp, prepConsoleDocs">
686        <zip destfile="docs.zip" basedir="pkg-temp" whenempty="fail" />
687    </target>
688
689    <target name="copyJavadoc" depends="javadoc">
690        <copy todir="pkg-temp/docs/javadoc" >
691          <fileset dir="build/javadoc/" />
692        </copy>
693    </target>
694
695    <target name="updater200" depends="prepupdate, preplicenses, pack200, zipit200" />
696    <target name="updater200WithJettyFixes" depends="prepjupdatefixes, preplicenses, pack200, zipit200" />
697    <target name="updater200WithJettyFixesAndJbigi" depends="prepjupdatefixes, prepjbigiupdate, preplicenses, pack200, zipit200" />
698    <target name="updater" depends="prepupdate, preplicenses, zipit" />
699    <target name="updaterWithJavadoc" depends="prepupdate, preplicenses, copyJavadoc, zipit" />
700    <target name="updaterWithGeoIP" depends="prepupdate, prepgeoupdate, preplicenses, zipit" />
701    <target name="updaterWithJetty" depends="prepjupdate, preplicenses, zipit" />
702    <target name="updaterWithJettyFixes" depends="prepjupdatefixes, preplicenses, zipit" />
703    <target name="updaterWithJettyFixesAndJbigi" depends="prepjupdatefixes, prepjbigiupdate, preplicenses, zipit" />
704    <target name="updaterWithJettyFixesAndGeoIP" depends="prepjupdatefixes, prepgeoupdate, preplicenses, zipit" />
705    <target name="updaterSmall" depends="prepupdateSmall, zipit" />
706    <target name="updaterRouter" depends="prepupdateRouter, zipit" />
707    <target name="zipit">
708        <zip destfile="i2pupdate.zip" basedir="pkg-temp" whenempty="fail" />
709       <!-- just a test, makes almost no difference
710        <tar destfile="i2pupdate.tgz" basedir="pkg-temp" compression="gzip" />
711        <tar destfile="i2pupdate.tbz" basedir="pkg-temp" compression="bzip2" />
712       -->
713    </target>
714    <target name="zipit200">
715        <zip destfile="i2pupdate200.zip" basedir="pkg-temp" whenempty="fail" />
716    </target>
717
718    <target name="pack200">
719<!-- *nix here -->
720        <exec executable="sh" osfamily="unix" failonerror="true">
721            <arg value="-c" />
722            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
723        </exec>
724        <exec executable="sh" osfamily="mac" failonerror="true">
725            <arg value="-c" />
726            <!-- pack200 will only pack to a .pack file, and only from a .jar file, so we put another .jar on the end -->
727            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
728        </exec>
729<!-- windoz here : i admit, i hate escaped symbols in xml, indeed = =! -->
730                <exec executable="cmd" osfamily="windows" failonerror="true">
731                        <arg value="/c" />
732                        <arg value="for %i in (pkg-temp\webapps\*.war) do move %i %i.jar &amp;&amp; pack200 -g pkg-temp\webapps\%~ni.war.pack %i.jar &amp;&amp; del %i.jar" />
733        </exec>
734                <exec executable="cmd" osfamily="windows" failonerror="true">
735                        <arg value="/c" />
736                        <arg value="for %i in (pkg-temp\lib\*.jar) do move %i %i.jar &amp;&amp; pack200 -g pkg-temp\lib\%~ni.jar.pack %i.jar &amp;&amp; del %i.jar" />
737        </exec>
738    </target>
739
740    <target name="updateTest" depends="prepupdate">
741        <ant dir="core/java/" target="jarTest" />   
742        <copy file="core/java/build/i2ptest.jar" todir="pkg-temp/lib" />
743        <zip destfile="i2pupdate.zip" basedir="pkg-temp" />
744    </target>
745
746    <target name="prepupdate" depends="build2, prepupdateSmall, prepConsoleDocUpdates, prepCertificates">
747        <copy file="build/BOB.jar" todir="pkg-temp/lib/" />
748        <copy file="build/sam.jar" todir="pkg-temp/lib/" />
749        <copy file="build/i2psnark.jar" todir="pkg-temp/lib" />
750        <!-- include systray changes in 0.7.5 -->
751        <copy file="build/systray.jar" todir="pkg-temp/lib/" />
752        <copy file="build/desktopgui.jar" todir="pkg-temp/lib/" />
753        <copy file="build/susimail.war" todir="pkg-temp/webapps/" />
754        <copy file="build/susidns.war" todir="pkg-temp/webapps/" />
755        <!-- as of 0.7.12; someday, we can remove these from the updater -->
756        <copy file="apps/susidns/src/WEB-INF/lib/jstl.jar" todir="pkg-temp/lib/" />
757        <copy file="apps/susidns/src/WEB-INF/lib/standard.jar" todir="pkg-temp/lib/" />
758        <copy file="build/i2psnark.war" todir="pkg-temp/webapps/" />
759        <copy file="history.txt" todir="pkg-temp/" />
760        <!-- the following overwrites history.txt on unix to shrink the update file -->
761        <exec executable="head" osfamily="unix" failifexecutionfails="true" output="pkg-temp/history.txt">
762            <arg value="-n" />
763            <arg value="1500" />
764            <arg value="history.txt" />
765        </exec>
766        <exec executable="echo" osfamily="unix" failifexecutionfails="true" output="pkg-temp/history.txt" append="true">
767            <arg value="EARLIER HISTORY IS AVAILABLE IN THE SOURCE PACKAGE" />
768        </exec>
769      <!-- May be pointless now, people with split directories will never see this,
770           and for flat installs we don't want to overwrite news more recent than the update package.
771        <copy file="installer/resources/news.xml" todir="pkg-temp/docs/" />
772       -->
773    </target>
774
775    <target name="prepupdateSmall" depends="buildSmall, prepupdateRouter, prepthemeupdates">
776        <copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
777        <copy file="build/mstreaming.jar" todir="pkg-temp/lib/" />
778        <copy file="build/streaming.jar" todir="pkg-temp/lib/" />
779        <copy file="build/routerconsole.jar" todir="pkg-temp/lib/" />
780        <!-- pulled out of routerconsole.jar in 0.7.12, someday we can take out of updater -->
781        <!-- name without version so we can overwrite if we upgrade  -->
782        <copy file="build/jrobin.jar" tofile="pkg-temp/lib/jrobin.jar" />
783        <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
784        <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
785        <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
786        <!-- decapitalized the file in 0.7.8 -->
787       <copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
788    </target>
789
790    <target name="prepupdateRouter" depends="buildrouter, deletepkg-temp">
791        <copy file="build/i2p.jar" todir="pkg-temp/lib/" />
792        <copy file="build/router.jar" todir="pkg-temp/lib/" />
793    </target>
794
795    <!-- jbigi.jar -->
796    <target name="prepjbigiupdate" depends="jbigi">
797        <copy file="build/jbigi.jar" todir="pkg-temp/lib/" />
798    </target>
799
800    <!-- GeoIP files and flag icons -->
801    <target name="prepgeoupdate">
802        <copy file="installer/resources/geoip.txt" todir="pkg-temp/geoip/" />
803        <copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
804        <copy todir="pkg-temp/docs/icons/flags" >
805          <fileset dir="installer/resources/icons/flags" />
806        </copy>
807    </target>
808
809    <target name="prepjupdate" depends="prepupdate, buildWEB">
810        <copy file="build/jasper-compiler.jar" todir="pkg-temp/lib/" />
811        <copy file="build/jasper-runtime.jar" todir="pkg-temp/lib/" />
812        <copy file="build/commons-logging.jar" todir="pkg-temp/lib/" />
813        <copy file="build/commons-el.jar" todir="pkg-temp/lib/" />
814        <copy file="build/javax.servlet.jar" todir="pkg-temp/lib/" />
815        <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
816    </target>
817    <target name="prepjupdatefixes" depends="prepupdate, buildWEB">
818        <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
819    </target>
820
821    <target name="util-list-changes" depends="checkForMtn" if="mtn.available" >
822        <exec executable="mtn" outputproperty="workspace.changes.util" errorproperty="mtn.error.util" failifexecutionfails="false" >
823            <arg value="list" />
824            <arg value="changed" />
825            <arg value="core/java/src/net/i2p/util" />
826        </exec>
827        <!-- \n in an attribute value generates an invalid manifest -->
828        <exec executable="tr" inputstring="${workspace.changes.util}" outputproperty="workspace.changes.util.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
829            <arg value="-s" />
830            <arg value="[:space:]" />
831            <arg value="," />
832        </exec>
833    </target>
834
835    <target name="installer" depends="preppkg, buildProperties, util-list-changes" >
836        <taskdef name="izpack" classpath="${basedir}/installer/lib/izpack/standalone-compiler.jar" classname="com.izforge.izpack.ant.IzPackTask" />
837        <mkdir dir="pkg-temp/installer" />
838        <!-- set if unset -->
839        <property name="workspace.changes.util.tr" value="" />
840        <jar destfile="./pkg-temp/installer/copy.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Copy.class net/i2p/util/FileUtil.class">
841            <manifest>
842                <attribute name="Main-Class" value="net.i2p.util.Copy" />
843                <attribute name="Build-Date" value="${build.timestamp}" />
844                <attribute name="Base-Revision" value="${workspace.version}" />
845                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
846            </manifest>
847        </jar>
848        <jar destfile="./pkg-temp/installer/delete.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Delete.class net/i2p/util/FileUtil.class">
849            <manifest>
850                <attribute name="Main-Class" value="net.i2p.util.Delete" />
851                <attribute name="Build-Date" value="${build.timestamp}" />
852                <attribute name="Base-Revision" value="${workspace.version}" />
853                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
854            </manifest>
855        </jar>
856        <jar destfile="./pkg-temp/installer/exec.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Exec.class">
857            <manifest>
858                <attribute name="Main-Class" value="net.i2p.util.Exec" />
859                <attribute name="Build-Date" value="${build.timestamp}" />
860                <attribute name="Base-Revision" value="${workspace.version}" />
861                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
862            </manifest>
863        </jar>
864        <!--
865          Force 1.5 pack200 output
866          Doesnt work!
867          http://jira.codehaus.org/browse/IZPACK-404
868          http://forums.sun.com/thread.jspa?threadID=773439
869          http://bfo.co.uk/blog/2010/05/13/combining_ant_jar_signatures_and_pack200.html
870        <property name="com.sun.java.util.jar.pack.package.majver" value="150" />
871        <property name="com.sun.java.util.jar.pack.package.minver" value="7" />
872        -->
873        <izpack input="${basedir}/installer/install.xml" output="${basedir}/install.jar" installerType="standard" basedir="${basedir}" />
874
875        <ant target="installerexe" />
876    </target>
877    <target name="installerexe">
878        <condition property="noExe">
879            <os arch="x86_64" />
880        </condition>
881        <condition property="noExe">
882            <os arch="amd64" />
883        </condition>
884        <condition property="noExe">
885           <not>
886            <or>
887             <os name="Linux" />
888             <os family="windows" />
889            </or>
890           </not>
891        </condition>
892        <ant target="doInstallerEXE" />
893    </target>
894    <target name="doInstallerEXE" unless="noExe">
895        <!-- now the installer exe -->
896        <taskdef name="launch4j"
897                 classname="net.sf.launch4j.ant.Launch4jTask"
898                 classpath="${basedir}/installer/lib/launch4j/launch4j.jar:${basedir}/installer/lib/launch4j/lib/xstream.jar" />
899        <launch4j configFile="./installer/i2pinstaller.xml" />
900        <launch4j configFile="./installer/i2pstandalone.xml" />
901        <!-- thazzit -->
902    </target>
903
904    <target name="test" depends="buildProperties, jbigi" >
905        <mkdir dir="reports/core/junit/" />
906        <ant dir="core/java/" target="test" />
907    </target>
908    <target name="junit.report" depends="buildProperties" >
909        <ant dir="core/java/" target="junit.report" />
910    </target>
911    <target name="clover.report" depends="buildProperties" >
912        <ant dir="core/java/" target="clover.report" />
913    </target>
914    <target name="test.report" depends="junit.report, clover.report"/>
915    <target name="fulltest" depends="buildProperties" >
916                <ant dir="core/java/" target="fulltest" />
917                <ant dir="router/java/" target="fulltest" />
918    </target>
919    <target name="fullclovertest" depends="buildProperties" >
920                <ant dir="core/java/" target="fullclovertest" />
921                <ant dir="router/java/" target="fullclovertest" />
922    </target>
923
924    <!-- <target name="syndie" >
925        <ant dir="apps/syndie/java/" target="standalone" />
926        <copy file="apps/syndie/java/syndie-standalone.zip" todir="." />
927    </target> -->
928    <target name="i2psnark" depends="buildProperties" >
929        <ant dir="apps/i2psnark/java" target="standalone" />
930        <copy file="apps/i2psnark/java/i2psnark-standalone.zip" todir="." />
931    </target>
932    <target name="slackpkg">
933        <echo message="Building Slackware package." />
934        <ant dir="Slackware/i2p/" target="slackpkg" />
935        <ant dir="Slackware/i2p-base/" target="slackpkg" />
936    </target>
937    <target name="justBOB" depends="builddepSmall">
938        <ant dir="apps/BOB/" target="onejar" />
939        <copy file="apps/BOB/dist/BOB-one.jar" todir="." />
940    </target>
941    <target name="findbugs" depends="build2">
942        <echo message="Starting findbugs, this will take a while..." />
943        <exec executable="nice" failonerror="true">
944            <arg value="findbugs"/>
945            <arg value="-textui"/>
946            <arg value="-projectName"/>
947            <arg value="i2p"/>
948            <arg value="-sortByClass"/>
949            <arg value="-xml"/>
950            <arg value="-output"/>
951            <arg value="i2p.fba"/>
952            <arg value="-auxclasspath"/>
953            <arg value="build/commons-el.jar:build/commons-logging.jar:build/jasper-compiler.jar:build/jasper-runtime.jar:build/javax.servlet.jar:build/org.mortbay.jetty.jar:apps/jrobin/jrobin-1.5.9.1.jar:apps/systray/java/lib/systray4j.jar:installer/lib/wrapper/all/wrapper.jar:apps/susidns/src/WEB-INF/lib/standard.jar:apps/susidns/src/WEB-INF/lib/jstl.jar:apps/jrobin/jrobin-1.5.9.1.jar"/>
954            <arg value="-sourcepath"/>
955            <arg value="apps/BOB/src/:apps/addressbook/java/src/:apps/i2psnark/java/src/:apps/i2ptunnel/java/src/:apps/ministreaming/java/src/:apps/routerconsole/java/src/:apps/sam/java/src/:apps/streaming/java/src/:apps/susidns/src/java/src/:apps/susimail/src/src/:apps/systray/java/src/:core/java/src/:router/java/src/"/>
956            <!-- start of the files to be analyzed -->
957            <arg value="build/BOB.jar"/>
958            <arg value="build/addressbook.war"/>
959            <arg value="build/i2p.jar"/>
960            <arg value="build/i2psnark.jar"/>
961            <arg value="build/i2psnark.war"/>
962            <arg value="build/i2ptunnel.jar"/>
963            <arg value="build/i2ptunnel.war"/>
964            <arg value="build/mstreaming.jar"/>
965            <arg value="build/router.jar/"/>
966            <arg value="build/desktopgui.jar"/>
967            <arg value="build/routerconsole.jar"/>
968            <arg value="build/routerconsole.war"/>
969            <arg value="build/sam.jar"/>
970            <arg value="build/streaming.jar"/>
971            <arg value="build/susidns.war"/>
972            <arg value="build/susimail.war"/>
973            <arg value="build/systray.jar"/>
974        </exec>
975        <echo message="Findbugs output stored in i2p.fba" />
976        <echo message="Now run: findbugs i2p.fba" />
977    </target>
978
979    <!-- this is the same dependency as pkg, but with updater200 in the middle,
980         since preppkg puts too much stuff in pkg-temp -->
981<!--
982    <target name="release" depends="distclean, updater, updater200, preppkg, installer" >
983-->
984    <target name="release" depends="distclean, updaterWithJettyFixesAndJbigi , updater200WithJettyFixes, preppkg, installer" >
985        <echo message="================================================================" />
986        <echo message="Did you update these files?" />
987        <exec executable="ls" failonerror="true">
988            <arg value="-l" />
989            <arg value="history.txt" />
990            <arg value="installer/install.xml" />
991            <arg value="installer/resources/news.xml" />
992            <arg value="core/java/src/net/i2p/CoreVersion.java" />
993            <arg value="router/java/src/net/i2p/router/RouterVersion.java" />
994        </exec>
995        <echo message="Everything is checked in, right? Let's be sure:" />
996        <exec executable="mtn" failonerror="true">
997            <arg value="st" />
998        </exec>
999        <echo message="If there are any modified files above, stop now!" />
1000        <!-- get release version number -->
1001        <exec executable="grep" outputproperty="versionLine" failonerror="true" >
1002            <arg value="public final static String VERSION" />
1003            <arg value="core/java/src/net/i2p/CoreVersion.java" />
1004        </exec>
1005        <exec executable="cut" inputstring="${versionLine}" outputproperty="release.number" failonerror="true" >
1006            <arg value="-f2" />
1007            <arg value="-d&quot;" />
1008        </exec>
1009        <echo message="New version number is ${release.number}" />
1010        <copy file="i2pupdate.zip" tofile="i2pupdate_${release.number}.zip" />
1011        <copy file="i2pinstall.exe" tofile="i2pinstall_${release.number}.exe" />
1012        <delete file="i2pupdate.sud" failonerror="false" />
1013        <delete file="i2pupdate.su2" failonerror="false" />
1014        <input message="Enter private signing key file:" addproperty="release.privkey" />
1015        <fail message="You must enter a path." >
1016            <condition>
1017                <equals arg1="${release.privkey}" arg2=""/>
1018            </condition>
1019        </fail>
1020        <echo message="Key file is ${release.privkey}" />
1021        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
1022            <classpath>
1023                <pathelement location="build/i2p.jar" />
1024            </classpath>
1025            <arg value="sign" />
1026            <arg value="i2pupdate.zip" />
1027            <arg value="i2pupdate.sud" />
1028            <arg value="${release.privkey}" />
1029            <arg value="${release.number}" />
1030        </java>
1031        <echo message="Verify version and VALID signature:" />
1032        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
1033            <classpath>
1034                <pathelement location="build/i2p.jar" />
1035            </classpath>
1036            <arg value="verifysig" />
1037            <arg value="i2pupdate.sud" />
1038        </java>
1039        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
1040            <classpath>
1041                <pathelement location="build/i2p.jar" />
1042            </classpath>
1043            <arg value="showversion" />
1044            <arg value="i2pupdate.sud" />
1045        </java>
1046        <!-- now build and verify the packed sud from the packed zip -->
1047        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
1048            <classpath>
1049                <pathelement location="build/i2p.jar" />
1050            </classpath>
1051            <arg value="sign" />
1052            <arg value="i2pupdate200.zip" />
1053            <arg value="i2pupdate.su2" />
1054            <arg value="${release.privkey}" />
1055            <arg value="${release.number}" />
1056        </java>
1057        <echo message="Verify version and VALID signature:" />
1058        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
1059            <classpath>
1060                <pathelement location="build/i2p.jar" />
1061            </classpath>
1062            <arg value="verifysig" />
1063            <arg value="i2pupdate.su2" />
1064        </java>
1065        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
1066            <classpath>
1067                <pathelement location="build/i2p.jar" />
1068            </classpath>
1069            <arg value="showversion" />
1070            <arg value="i2pupdate.su2" />
1071        </java>
1072        <!-- will this use the monotonerc file in the current workspace? -->
1073        <echo message="Checking out fresh copy into ../i2p-${release.number} for tarballing:" />
1074        <delete dir="../i2p-${release.number}" />
1075        <exec executable="mtn" failonerror="true">
1076            <arg value="co" />
1077            <arg value="-b" />
1078            <arg value="i2p.i2p" />
1079            <!-- w: is the revision of the current workspace -->
1080            <arg value="-r" />
1081            <arg value="w:" />
1082            <arg value="../i2p-${release.number}/" />
1083        </exec>
1084        <exec executable="tar" failonerror="true">
1085            <arg value="cjf" />
1086            <arg value="i2psource_${release.number}.tar.bz2" />
1087            <arg value="-C" />
1088            <arg value=".." />
1089            <arg value="--exclude" />
1090            <arg value="i2p-${release.number}/_MTN*" />
1091            <arg value="i2p-${release.number}/" />
1092        </exec>
1093        <echo message="Sign the files:" />
1094        <delete file="i2pinstall_${release.number}.exe.sig" />
1095        <delete file="i2psource_${release.number}.tar.bz2.sig" />
1096        <delete file="i2pupdate_${release.number}.zip.sig" />
1097        <exec executable="gpg" failonerror="true">
1098            <arg value="-b" />
1099            <arg value="i2pinstall_${release.number}.exe" />
1100        </exec>
1101        <exec executable="gpg" failonerror="true">
1102            <arg value="-b" />
1103            <arg value="i2psource_${release.number}.tar.bz2" />
1104        </exec>
1105        <exec executable="gpg" failonerror="true">
1106            <arg value="-b" />
1107            <arg value="i2pupdate_${release.number}.zip" />
1108        </exec>
1109        <echo message="File sizes:" />
1110        <exec executable="ls" failonerror="true">
1111            <arg value="-l" />
1112            <arg value="i2pinstall_${release.number}.exe" />
1113            <arg value="i2psource_${release.number}.tar.bz2" />
1114            <arg value="i2pupdate_${release.number}.zip" />
1115            <arg value="i2pupdate.su2" />
1116            <arg value="i2pupdate.sud" />
1117            <arg value="i2pinstall_${release.number}.exe.sig" />
1118            <arg value="i2psource_${release.number}.tar.bz2.sig" />
1119            <arg value="i2pupdate_${release.number}.zip.sig" />
1120        </exec>
1121        <echo message="SHA256 sums:" />
1122        <exec executable="sha256sum" failonerror="true">
1123            <arg value="i2pinstall_${release.number}.exe" />
1124            <arg value="i2psource_${release.number}.tar.bz2" />
1125            <arg value="i2pupdate_${release.number}.zip" />
1126            <arg value="i2pupdate.su2" />
1127            <arg value="i2pupdate.sud" />
1128        </exec>
1129        <echo message="Don't forget to mtn tag w: i2p-${release.number}" />
1130        <echo message="... and mtn cert t:i2p-${release.number} branch i2p.i2p.release" />
1131    </target>
1132
1133    <target name="debian" depends="debian-clean, debian-binary" />
1134
1135    <target name="debian-binary" >
1136        <echo message="Did you update the version using dch -i?" />
1137        <echo message=" " />
1138        <echo message="If the changelog was not updated with dch -i, press" />
1139        <echo message="press CTRL+C to abort building this Debian package." />
1140        <echo message="" />
1141        <echo message="Pausing build for ten seconds to give enough time to read this notice." />
1142        <exec executable="sleep" failonerror="true">
1143                <arg value="10" />
1144        </exec>
1145        <echo message="====================" />
1146        <!-- bundle the jetty 5 lib since there isn't a deb for it -->
1147        <ant dir="apps/jetty" target="ensureJettylib" />
1148       
1149        <exec executable="fakeroot" failonerror="true">
1150            <arg value="debian/rules" />
1151            <arg value="patch" />
1152            <arg value="binary" />
1153            <arg value="clean" />
1154        </exec>
1155        <delete dir=".pc" />
1156    </target>
1157    <target name="debian-clean" depends="buildProperties" >
1158        <exec executable="fakeroot" failonerror="true">
1159            <arg value="debian/rules" />
1160            <arg value="clean" />
1161        </exec>
1162        <delete dir="./.pc" />
1163    </target>
1164    <target name="debian-patch" depends="buildProperties" >
1165        <exec executable="quilt" failonerror="true">
1166            <arg value="-a" />
1167            <arg value="push" />
1168        </exec>
1169        <echo message="====================" />
1170    </target>
1171    <target name="debian-unpatch" depends="buildProperties">
1172        <exec executable="quilt" failonerror="false">
1173            <arg value="-a" />
1174            <arg value="pop" />
1175        </exec>
1176    </target>
1177
1178    <target name="debianrepo" depends="debian">
1179        <exec dir="debian" executable="./makerepo.sh" failonerror="true"/>
1180    </target>
1181
1182<!-- the following are appened to help build barebone portable version,
1183     none of the above is modified for this purpose -->
1184        <target name = "pkg-portable-clean">
1185                <delete dir="build/" />
1186                <delete dir="pkg-temp/" />
1187                <delete>
1188                        <fileset dir="." includes="portable-**.zip**" />
1189                </delete>
1190        </target>
1191<!-- build a portable archive -->
1192
1193<!-- *0* Since we simply pack all files in folder "build/" into our archieve,
1194                we need to make sure its small, with NO redundent jars or wars.
1195                thus cleaning is required before each build-->
1196        <target name="buildSmallOnly" depends="pkg-portable-clean,buildSmall"/>
1197
1198<!-- *1* preparing the jars by OS dependent de-bloating -->
1199        <target name="preppkg-portable-win32-jbigi" depends="buildSmallOnly, jbigi-windows-only" />
1200
1201        <target name="preppkg-portable-linux-jbigi"  depends="buildSmallOnly, jbigi-linux-only" />
1202
1203<!-- *2* os independent procedure  -->
1204        <target name="preppkg-portable-basic" >
1205                <mkdir dir="pkg-temp" />
1206                        <!-- non OS dependent configurations only, dont add *nux/win stuff here -->
1207                        <copy todir="pkg-temp">
1208                                <fileset dir="installer/resources/portable/configs/" />
1209                        </copy>
1210                        <copy file="installer/resources/blocklist.txt" todir="pkg-temp/" />
1211                        <copy file="installer/resources/hosts.txt" todir="pkg-temp/" />
1212                        <copy file="installer/resources/readme.license.txt" todir="pkg-temp/" />
1213                <mkdir dir="pkg-temp/addressbook" />
1214                        <copy file="apps/addressbook/subscriptions.txt" todir="pkg-temp/addressbook/" />
1215                        <copy file="apps/addressbook/myhosts.txt"  todir="pkg-temp/addressbook/" />
1216                        <!-- config.txt is in installer/resources/portable -->
1217                <mkdir dir="pkg-temp/docs" />
1218                        <copy file="installer/resources/initialNews.xml" tofile="pkg-temp/docs/news.xml" overwrite="true" />
1219                        <copy file="installer/resources/readme/readme.html" tofile="pkg-temp/docs/readme.html" />
1220                        <copy file="installer/resources/startconsole.html" todir="pkg-temp/docs/" />
1221                        <copy file="installer/resources/start.ico" todir="pkg-temp/docs/" />
1222                        <copy file="installer/resources/console.ico" todir="pkg-temp/docs/" />
1223                        <!-- HTTP Header files, english only,
1224                                if you need a different lang do it in a seperate target -->
1225                        <copy todir="pkg-temp/docs/" >
1226                                <fileset dir="installer/resources/proxy/"  includes="**-header.ht" />
1227                        </copy>
1228                        <!-- Theme light only -->
1229                        <copy todir="pkg-temp/docs/themes/console/light/" overwrite="true" >
1230                                <fileset dir="installer/resources/themes/console/light/" includes="**.css" />
1231                        </copy>
1232                        <copy file="installer/resources/themes/console/light/console_big.css" todir="portable/docs/themes/console/light/" />
1233                        <copy todir="pkg-temp/docs/themes/console/images/" >
1234                                <fileset dir="installer/resources/themes/console/images/" />
1235                        </copy>
1236                        <!-- FLAGs for language icon (not for ip)-->
1237                        <copy todir="pkg-temp/docs/icons/flags" >
1238                                <fileset dir="installer/resources/icons/flags/" includes="cn.png,de.png,fr.png,nl.png,ru.png,se.png,us.png" />
1239                        </copy>
1240                <mkdir dir="pkg-temp/webapps" />
1241                        <copy todir="pkg-temp/webapps/">
1242                                <fileset dir="build/" includes="**.war" />
1243                        </copy>
1244                <mkdir dir="pkg-temp/lib" />
1245                        <copy todir ="pkg-temp/lib/" >
1246                                <fileset dir="build/" includes="**.jar" />
1247                        </copy>
1248                        <!-- 3rd party jars from apps/  -->
1249                                <!-- jrobin - without jobin , you lost graph and get a lot error entry in logs -->
1250                        <copy file="build/jrobin.jar" tofile="pkg-temp/lib/jrobin.jar" />
1251        </target>
1252<!-- *3* os dependent procedure/commands -->
1253        <target name = "preppkg-portable-win32" depends="preppkg-portable-win32-jbigi,preppkg-portable-basic">
1254                        <!-- systray4.j  - why do we need trayicons for portable version ? dependency hardcoded in console -->
1255                <copy file="apps/systray/java/lib/systray4j.dll" todir="pkg-temp/lib" />
1256                <copy file="apps/systray/java/lib/systray4j.jar" todir="pkg-temp/lib" />
1257                        <!--wrapper - dont even think about it. i2p cosumes appreantly more mem without it on win32-->
1258                <copy file="installer/lib/wrapper/win32/wrapper.dll" todir="pkg-temp/lib" />
1259                <copy file="installer/lib/wrapper/all/wrapper.jar" todir="pkg-temp/lib" />
1260                <copy file="installer/lib/wrapper/win32/I2Psvc.exe" tofile="pkg-temp/i2psvc.ex_" />
1261                        <!--  copy the unpack/start batchfiles -->
1262                <copy todir="pkg-temp">
1263                        <fileset dir="installer/resources/portable/win32/" />
1264                </copy>
1265        </target>
1266<!-- *4* command for windows package -->
1267        <target name = "pkg-portable-win32"     depends="preppkg-portable-win32, pack200" >
1268                <!-- i need the portable\ folder in .zip so basedir is set to . -->
1269                <move file="pkg-temp" tofile="portable"/>
1270                <zip destfile="portable-win32.zip" basedir="." level="9" includes="portable\**" />
1271                <checksum file="portable-win32.zip" forceOverwrite="yes"/>
1272                <move file="portable" tofile="pkg-temp"/>
1273        </target>
1274</project>
Note: See TracBrowser for help on using the repository browser.