I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
build.xml 55.7 KiB
Newer Older
jrandom's avatar
jrandom committed
<?xml version="1.0" encoding="ISO-8859-1"?>
<project basedir="." default="all" name="i2p">
    <!-- Things you might want to change -->
    <!-- This keeps gcj a lot quieter -->
    <!--
        <property name="javac.compilerargs" value="-warn:-unchecked,raw,unused,serial" />
    -->
    <!-- Add Apache Harmony's Pack200 library if you don't have java.util.jar.Pack200
         See core/java/src/net/i2p/util/FileUtil.java for code changes required
         to use this library instead of Sun's version.
         Or to comment it all out if you don't have either.
    -->
    <!--
        <property name="javac.classpath" value="/PATH/TO/pack200.jar" />
    -->

    <!-- You probably don't want to change anything from here down -->
zzz's avatar
zzz committed
    <target name="help" depends="all" />
    <target name="all" >
        <echo message="Useful targets: " />
zzz's avatar
zzz committed
        <echo message="  pkg:       distclean then package everything up (installer, clean tarball, update tarball)" />
        <echo message="  dist:      pkg and javadoc" />
jrandom's avatar
jrandom committed
        <echo message="  installer: build the GUI installer" />
        <echo message="  tarball:   tar the full install into i2p.tar.bz2 (extracts to build a new clean install)" />
jrandom's avatar
jrandom committed
        <echo message="  updater:   tar the built i2p specific files into an i2pupdate.zip (extracts safely over existing installs)" />
zzz's avatar
zzz committed
        <echo message="  updaterWithJetty:   tar the built i2p specific files and jetty into an i2pupdate.zip (extracts safely over existing installs)" />
        <echo message="  updaterWithJettyFixes: updater including local jetty patches" />
zzz's avatar
zzz committed
        <echo message="  updaterWithGeoIP: updater including GeoIP Files" />
        <echo message="  updaterWithJettyFixesAndGeoIP" />
        <echo message="  updaterSmall:   updater with the essentials only - no SAM, i2psnark, SusiMail, SusiDNS, news.xml, or history.txt" />
        <echo message="  updaterRouter:  updater with the i2p.jar and router.jar only" />
        <echo message="  distclean: clean up all derived files" />
jrandom's avatar
jrandom committed
        <echo message="  syndie:    generate a standalone syndie install" />
jrandom's avatar
jrandom committed
        <echo message="  i2psnark:  generate a standalone i2psnark install" />
        <echo message="  justBOB:  generate a standalone BOB-one.jar" />
jrandom's avatar
jrandom committed
        <echo message="  javadoc:   generate javadoc for the entire project into ./build/javadoc" />
        <echo message="  slackpkg:  generate Slackware packages in ./Slackware/i2p and ./Slackware/i2p-base" />
dream's avatar
dream committed
        <echo message="  debianhowto: instructions on building Debian packages" />
        <echo message="  debian: generate Debian packages in ./debian/packages" />
        <echo message="          (libc6-i686 and libc6-amd64 required, ant>=1.8 required)" />
HungryHobo's avatar
HungryHobo committed
        <echo message="  debianrepo: build a Debian repository (reprepro required)" />
        <echo message="  updaterWithDesktopgui: tar the built files and desktopgui in an i2pupdate.zip" />
        <echo message="  pkgWithDesktopgui: distclean then package everything up with the desktopgui" />
        <echo message="  distWithDesktopgui: pkgWithDesktopgui and javadoc" />
        <echo message="  distcleanWithDesktopgui: clean up all derived files (including desktopgui files)" />
        <echo message="  poupdate: update the .po files for translators" />
dream's avatar
dream committed
    </target>
    <target name="debianhowto">
        <echo message="To build debian packages, you must run dpkg-buildpackage as root in the source directory. It will then run ant for you. dpkg-buildpackage is found in the 'dpkg-dev' package. Also it should work fine to use the 'fakeroot' package with dpkg-buildpackage, if you don't want to run as root. Please read 'man dpkg-buildpackage' before building any packages yourself." />
    </target>
    <target name="dist" depends="pkg, javadoc">
zzz's avatar
zzz committed
    <target name="build" depends="build2">
        <!-- so we don't build standalone for the updater -->
zzz's avatar
zzz committed
        <!-- This builds apps/i2psnark/java/i2psnark-standalone.zip,
          -   which we don't distribute anywhere...
zzz's avatar
zzz committed
        <ant dir="apps/i2psnark/java/" target="standalone" />
zzz's avatar
zzz committed
        -->
zzz's avatar
zzz committed
    </target>
    <target name="build2" depends="builddep, jar, buildWEB" />
    <target name="buildSmall" depends="builddepSmall, jarSmall, buildWEB" />
    <target name="buildclean" depends="distclean, build" />
    <target name="builddep" depends="builddepSmall">
mihi's avatar
mihi committed
	<!-- build *everything* here, but only once -->
        <ant dir="apps/sam/java/" target="jar" />
        <ant dir="apps/susimail/" target="war" />
        <ant dir="apps/susidns/src" target="all" />
zzz's avatar
zzz committed
        <ant dir="apps/i2psnark/java/" target="war" />
    </target>
    <target name="builddepSmall">
mihi's avatar
mihi committed
        <ant dir="core/java/" target="jar" />
        <ant dir="router/java/" target="jar" />
zzz's avatar
zzz committed
        <ant dir="apps/systray/java/" target="jar" />
        <ant dir="apps/routerconsole/java/" target="jar" />
mihi's avatar
mihi committed
        <ant dir="apps/ministreaming/java/" target="jar" />
jrandom's avatar
jrandom committed
        <ant dir="apps/streaming/java/" target="jar" />
zzz's avatar
zzz committed
        <ant dir="apps/i2ptunnel/java/" target="build" />
jrandom's avatar
jrandom committed
        <ant dir="apps/addressbook/" target="war" />
    </target>
jrandom's avatar
jrandom committed
    <target name="buildrouter">
        <ant dir="core/java/" target="jar" />
        <ant dir="router/java/" target="jar" />
        <copy file="core/java/build/i2p.jar" todir="build/" />
        <copy file="router/java/build/router.jar" todir="build/" />
    </target>
    <target name="buildWEB">
complication's avatar
complication committed
        <ant dir="apps/jetty" target="ensureJettylib" />
        <ant dir="apps/routerconsole/java" target="build" />
        <copy file="apps/routerconsole/java/build/routerconsole.jar" todir="build/" />
        <copy file="apps/routerconsole/java/build/routerconsole.war" todir="build/" />
        <copy file="apps/jetty/jettylib/org.mortbay.jetty.jar" todir="build/" />
        <copy file="apps/jetty/jettylib/jasper-compiler.jar" todir="build/" />
        <copy file="apps/jetty/jettylib/jasper-runtime.jar" todir="build/" />
jrandom's avatar
jrandom committed
        <copy file="apps/jetty/jettylib/commons-logging.jar" todir="build/" />
        <copy file="apps/jetty/jettylib/commons-el.jar" todir="build/" />
        <copy file="apps/jetty/jettylib/javax.servlet.jar" todir="build/" />
    </target>
jrandom's avatar
jrandom committed
    <target name="buildexe">
        <condition property="noExe">
	    <os arch="x86_64" />
	</condition>
jrandom's avatar
jrandom committed
        <condition property="noExe">
	    <os arch="ppc" />
	</condition>
        <condition property="noExe">
	    <os arch="amd64" />
	</condition>
	<condition property="noExe">
	   <not>
	    <or>
	     <os name="Linux" />
	     <os family="windows" />
	    </or>
	   </not>
	</condition>
jrandom's avatar
jrandom committed
	<ant target="doBuildEXE" />
    </target>
    <target name="doBuildEXE" unless="noExe">
jrandom's avatar
jrandom committed
        <jar destfile="./build/launchi2p.jar">
            <manifest>
	     <attribute name="Main-Class" value="net.i2p.router.RouterLaunch" />
	     <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" />
jrandom's avatar
jrandom committed
	    </manifest>
        </jar>
	<!-- now the standalone launcher exe -->
	<taskdef name="launch4j"
                 classname="net.sf.launch4j.ant.Launch4jTask"
                 classpath="${basedir}/installer/lib/launch4j/launch4j.jar:${basedir}/installer/lib/launch4j/lib/xstream.jar" />
        <launch4j configFile="./installer/i2pstandalone.xml" />
	<!-- thazzit -->
    </target>
    <target name="compile" />
    <target name="jar" depends="jarSmall" >
        <copy file="apps/BOB/dist/BOB.jar" todir="build/" />
        <copy file="apps/sam/java/build/sam.jar" todir="build/" />
        <copy file="apps/susimail/susimail.war" todir="build/" />
        <copy file="apps/susidns/src/susidns.war" todir="build/" />
        <copy file="apps/i2psnark/i2psnark.war" todir="build/" />
        <copy file="apps/i2psnark/java/build/i2psnark.jar" todir="build/" />
    </target>
    <target name="jarSmall" depends="compile" >
        <copy file="core/java/build/i2p.jar" todir="build/" />
        <copy file="router/java/build/router.jar" todir="build/" />
        <copy file="apps/ministreaming/java/build/mstreaming.jar" todir="build/" />
jrandom's avatar
jrandom committed
        <copy file="apps/streaming/java/build/streaming.jar" todir="build/" />
        <copy file="apps/i2ptunnel/java/build/i2ptunnel.jar" todir="build/" />
        <copy file="apps/i2ptunnel/java/build/i2ptunnel.war" todir="build/" />
        <copy file="apps/systray/java/build/systray.jar" todir="build/" />
        <copy file="installer/lib/jbigi/jbigi.jar" todir="build" />
jrandom's avatar
jrandom committed
        <copy file="apps/addressbook/dist/addressbook.war" todir="build/" />
    </target>
    <target name="poupdate">
        <ant dir="apps/routerconsole/java/" target="poupdate" />
        <ant dir="apps/i2psnark/java/" target="poupdate" />
zzz's avatar
zzz committed
        <ant dir="apps/i2ptunnel/java/" target="poupdate" />
zzz's avatar
zzz committed
        <ant dir="apps/susidns/src/" target="poupdate" />
    <target name="javadoc">
zzz's avatar
zzz committed
        <ant dir="apps/jetty" target="ensureJettylib" />
        <mkdir dir="./build" />
        <mkdir dir="./build/javadoc" />
zzz's avatar
zzz committed
        <!-- get release and build version numbers -->
        <exec executable="grep" outputproperty="versionLine" >
            <arg value="public final static String VERSION" />
	    <arg value="core/java/src/net/i2p/CoreVersion.java" />
        </exec>
        <exec executable="cut" inputstring="${versionLine}" outputproperty="release.number" >
            <arg value="-f2" />
	    <arg value="-d&quot;" />
        </exec>
        <exec executable="grep" outputproperty="buildLine" >
            <arg value="public final static long BUILD" />
	    <arg value="router/java/src/net/i2p/router/RouterVersion.java" />
        </exec>
        <exec executable="cut" inputstring="${buildLine}" outputproperty="build.temp" >
            <arg value="-f2" />
	    <arg value="-d=" />
        </exec>
        <exec executable="cut" inputstring="${build.temp}" outputproperty="build.number" >
            <arg value="-f1" />
	    <arg value="-d;" />
        </exec>
            destdir="./build/javadoc" 
            packagenames="*" 
            use="true" 
            splitindex="true" 
zzz's avatar
zzz committed
            doctitle="I2P Javadocs for Release ${release.number} Build ${build.number}"
            windowtitle="I2P Anonymous Network - Java Documentation - Version ${release.number}">
            <group title="Core SDK (i2p.jar)" packages="net.i2p:net.i2p.*:net.i2p.client:net.i2p.client.*:freenet.support.CPUInformation:org.bouncycastle.crypto:org.bouncycastle.crypto.*:gnu.crypto.*:gnu.gettext:org.xlattice.crypto.filters:com.nettgryppa.security" />
            <group title="Streaming Library" packages="net.i2p.client.streaming" />
            <group title="Router" packages="net.i2p.router:net.i2p.router.*:net.i2p.data.i2np:org.cybergarage.*:org.freenetproject" />
            <group title="Router Console" packages="net.i2p.router.web" />
            <group title="Addressbook Application" packages="net.i2p.addressbook" />
            <group title="BOB Bridge" packages="net.i2p.BOB" />
            <group title="I2PSnark Application" packages="org.klomp.snark:org.klomp.snark.*" />
            <group title="I2PTunnel Application" packages="net.i2p.i2ptunnel:net.i2p.i2ptunnel.*" />
            <group title="SAM Bridge" packages="net.i2p.sam:net.i2p.sam.client" />
            <group title="SusiDNS Application" packages="i2p.susi.dns" />
            <group title="SusiMail Application" packages="i2p.susi.webmail:i2p.susi.webmail.*:i2p.susi.debug:i2p.susi.util" />
            <group title="Systray Application" packages="net.i2p.apps.systray" />
jrandom's avatar
jrandom committed
            <sourcepath>
                <pathelement location="core/java/src" />
jrandom's avatar
jrandom committed
                <!--<pathelement location="core/java/test" />-->
jrandom's avatar
jrandom committed
                <pathelement location="router/java/src" />
jrandom's avatar
jrandom committed
                <!--<pathelement location="router/java/test" />-->
jrandom's avatar
jrandom committed
                <pathelement location="apps/ministreaming/java/src" />
jrandom's avatar
jrandom committed
                <pathelement location="apps/streaming/java/src" />
jrandom's avatar
jrandom committed
                <pathelement location="apps/i2ptunnel/java/src" />
                <pathelement location="apps/systray/java/src" />
                <pathelement location="apps/routerconsole/java/src" />
                <pathelement location="apps/addressbook/java/src" />
                <pathelement location="apps/i2psnark/java/src" />
                <pathelement location="apps/sam/java/src" />
                <pathelement location="apps/BOB/src" />
                <pathelement location="apps/susidns/src/java/src" />
                <pathelement location="apps/susimail/src/src" />
jrandom's avatar
jrandom committed
            </sourcepath>
            <classpath>
                <pathelement location="apps/jetty/jettylib/org.mortbay.jetty.jar" />
sponge's avatar
sponge committed
                <pathelement location="apps/jetty/jettylib/javax.servlet.jar" />
jrandom's avatar
jrandom committed
                <pathelement location="apps/systray/java/lib/systray4j.jar" />
sponge's avatar
sponge committed
                <pathelement location="apps/jrobin/jrobin-1.4.0.jar" />
jrandom's avatar
jrandom committed
                <pathelement location="installer/lib/wrapper/win32/wrapper.jar" />
sponge's avatar
sponge committed
                <pathelement location="core/lib/junit.jar" />                
jrandom's avatar
jrandom committed
            </classpath>
zzz's avatar
zzz committed
            <link offline="true" href="http://download.oracle.com/javase/6/docs/api/" packagelistLoc="installer/resources/package-lists/java/" />
            <link offline="true" href="http://docs.i2p2.de/jetty/javadoc/" packagelistLoc="installer/resources/package-lists/jetty/" />
            <link offline="true" href="http://docs.i2p2.de/jrobin/javadoc/" packagelistLoc="installer/resources/package-lists/jrobin/" />
jrandom's avatar
jrandom committed
        </javadoc>
    </target>
        <delete dir="./build" />
jrandom's avatar
jrandom committed
        <delete file="i2pinstall.exe" failonerror="false" quiet="true" />	
jrandom's avatar
jrandom committed
        <delete file="i2p.exe" failonerror="false" quiet="true" />
        <delete file="syndie-standalone.zip" failonerror="false" quiet="true" />
jrandom's avatar
jrandom committed
        <delete file="i2psnark-standalone.zip" failonerror="false" quiet="true" />
        <delete file="BOB-one.jar" failonerror="false" quiet="true" />	
        <delete dir="debian/tmp" />
HungryHobo's avatar
HungryHobo committed
        <delete dir="debian/db" />
        <delete file="debian/files" />
HungryHobo's avatar
HungryHobo committed
        <delete file="debian/build" />
    </target>
    <target name="distclean" depends="clean">
        <delete includeemptydirs="true" removeNotFollowedSymlinks="true" failonerror="false" >
            <fileset dir="debian/packages" followSymlinks="false" />
HungryHobo's avatar
HungryHobo committed
        </delete>
        <delete dir="debian/repo" />
        <ant dir="core/java/" target="distclean" />
        <ant dir="router/java/" target="distclean" />
        <ant dir="apps/ministreaming/java/" target="distclean" />
jrandom's avatar
jrandom committed
        <ant dir="apps/streaming/java/" target="distclean" />
        <ant dir="apps/i2ptunnel/java/" target="distclean" />
        <ant dir="apps/sam/java/" target="distclean" />
        <ant dir="apps/routerconsole/java/" target="distclean" />
jrandom's avatar
jrandom committed
        <ant dir="apps/addressbook/" target="distclean" />
jrandom's avatar
jrandom committed
        <ant dir="apps/susimail/" target="distclean" />
jrandom's avatar
jrandom committed
        <ant dir="apps/susidns/src/" target="distclean" />
        <ant dir="apps/systray/java/" target="distclean" />
jrandom's avatar
jrandom committed
        <ant dir="apps/i2psnark/java/" target="distclean" />
        <ant dir="apps/jetty/" target="distclean" />
	<!-- 
		NOTE! We need to turn off the default excludes for these
		patterns to work. 
		These are the defaultexcludes in Ant as seen on
		http://ant.apache.org/manual/CoreTasks/defaultexcludes.html
		     **/*~
                     **/#*#
                     **/.#*
                     **/%*%
                     **/._*
                     **/CVS
                     **/CVS/**
                     **/.cvsignore
                     **/SCCS
                     **/SCCS/**
                     **/vssver.scc
                     **/.svn
                     **/.svn/**
                     **/.DS_Store
		The only recourse is to remove the offending ones.
		We do this here, as we only need one change, and then put it
		back after we are done with it.
	-->
	<defaultexcludes remove="**/*~"/>

            <fileset dir="." includes="**/*.class **/*.java~ **/*.txt~ **/*.xml~ **/*.sh~ **/*.SlackBuild~" />
	    <!-- 
	    	Less common, but they pollute my workspace here, so we
            	might as well nuke these as well. Are there any others?
            	
            	!!??? Why don't we just nuke "**/*~" ???!!

            	++Sponge
            -->
        </delete>
	<!--
		Now we put the defaults back
	-->
	<defaultexcludes default="true"/>
    </target>
    <target name="pkg" depends="distclean, updater, preppkg, installer" />
    <target name="pkgclean" depends="deletepkg-temp">
            <fileset dir="." includes="i2p.tar.bz2 install.jar i2pupdate.zip i2pupdate200.zip" />
        </delete>
    </target>
zzz's avatar
zzz committed
    <target name="preppkg" depends="preppkg-linux, preppkg-windows">
        <copy file="build/jbigi.jar" todir="pkg-temp/lib" />
zzz's avatar
zzz committed
        <copy todir="pkg-temp/lib/wrapper/freebsd/">
            <fileset dir="installer/lib/wrapper/freebsd/" />
        </copy>
        <copy todir="pkg-temp/lib/wrapper/macosx/">
            <fileset dir="installer/lib/wrapper/macosx/" />
        </copy>
        <copy todir="pkg-temp/lib/wrapper/solaris/">
            <fileset dir="installer/lib/wrapper/solaris/" />
        </copy>
    </target>

    <target name="preppkg-windows" depends="preppkg-base, buildexe">
        <copy file="i2p.exe" todir="pkg-temp/" failonerror="false" />
        <copy file="apps/systray/java/lib/systray4j.dll" todir="pkg-temp/lib" />
        <copy file="apps/systray/java/resources/iggy.ico" todir="pkg-temp/icons" />
        <copy file="apps/systray/java/resources/iggy.xpm" todir="pkg-temp/icons" />
        <copy file="installer/resources/eepget.bat" todir="pkg-temp/" />
        <copy file="installer/resources/i2prouter.bat" todir="pkg-temp/" />
        <copy file="installer/resources/fixperms.bat" todir="pkg-temp/" />
        <copy file="installer/resources/install_i2p_service_winnt.bat" todir="pkg-temp/" />
        <copy file="installer/resources/postinstall.bat" todir="pkg-temp/" />
        <copy file="installer/resources/uninstall_i2p_service_winnt.bat" todir="pkg-temp/" />
        <copy todir="pkg-temp/lib/wrapper/win32/">
            <fileset dir="installer/lib/wrapper/win32/" />
        </copy>
    </target>

walking's avatar
walking committed
    <!-- only what is needed for debian, etc. -->
    <target name="preppkg-linux-only" depends="preppkg-linux">
        <!-- rip the non-linux stuff out of jbigi.jar -->
        <mkdir dir="tmpextract" />
        <unjar src="build/jbigi.jar" dest="tmpextract/" />
        <jar destfile="pkg-temp/lib/jbigi.jar" >
            <fileset dir="tmpextract/" includes="*linux*" />
        </jar>
        <delete dir="tmpextract/" />
    </target>

zzz's avatar
zzz committed
    <target name="preppkg-linux" depends="preppkg-base">
        <copy file="installer/resources/runplain.sh" todir="pkg-temp/" />
        <copy file="apps/i2psnark/launch-i2psnark" todir="pkg-temp/" />
        <copy file="installer/resources/eepget" todir="pkg-temp/" />
        <copy file="installer/resources/i2prouter" todir="pkg-temp/" />
        <copy file="installer/resources/osid" todir="pkg-temp/" />
        <copy file="installer/resources/postinstall.sh" todir="pkg-temp/" />
        <copy todir="pkg-temp/lib/wrapper/linux/">
            <fileset dir="installer/lib/wrapper/linux/" />
        </copy>
        <copy todir="pkg-temp/lib/wrapper/linux64/">
            <fileset dir="installer/lib/wrapper/linux64/" />
        </copy>
    </target>

    <target name="preppkg-base" depends="build, preplicenses, prepconsoleDocs">
        <!-- if updater200 was run previously, it left *.pack files in pkg-temp -->
        <delete>
            <fileset dir="pkg-temp" includes="**/*.jar.pack **/*.war.pack" />
        </delete>
        <copy file="build/i2p.jar" todir="pkg-temp/lib/" />
        <copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
        <copy file="build/jasper-compiler.jar" todir="pkg-temp/lib/" />
        <copy file="build/jasper-runtime.jar" todir="pkg-temp/lib/" />
jrandom's avatar
jrandom committed
        <copy file="build/commons-logging.jar" todir="pkg-temp/lib/" />
        <copy file="build/commons-el.jar" todir="pkg-temp/lib/" />
        <copy file="build/javax.servlet.jar" todir="pkg-temp/lib/" />
        <copy file="build/mstreaming.jar" todir="pkg-temp/lib/" />
jrandom's avatar
jrandom committed
        <copy file="build/streaming.jar" todir="pkg-temp/lib/" />
        <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
        <copy file="build/router.jar" todir="pkg-temp/lib/" />
        <copy file="build/routerconsole.jar" todir="pkg-temp/lib/" />
        <!-- pulled out of routerconsole.jar in 0.7.12; name without version so we can overwrite if we upgrade  -->
        <copy file="apps/jrobin/jrobin-1.4.0.jar" tofile="pkg-temp/lib/jrobin.jar" />
        <copy file="build/sam.jar" todir="pkg-temp/lib/" />
        <copy file="build/BOB.jar" todir="pkg-temp/lib/" />
        <copy file="build/systray.jar" todir="pkg-temp/lib" />
jrandom's avatar
jrandom committed
        <copy file="build/i2psnark.jar" todir="pkg-temp/lib/" />
        <copy file="apps/systray/java/lib/systray4j.jar" todir="pkg-temp/lib" />
        <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
        <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
jrandom's avatar
jrandom committed
        <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
jrandom's avatar
jrandom committed
        <copy file="build/susimail.war" todir="pkg-temp/webapps/" />
jrandom's avatar
jrandom committed
        <copy file="build/susidns.war" todir="pkg-temp/webapps/" />
        <copy file="apps/susidns/src/WEB-INF/lib/jstl.jar" todir="pkg-temp/lib/" />
        <copy file="apps/susidns/src/WEB-INF/lib/standard.jar" todir="pkg-temp/lib/" />
jrandom's avatar
jrandom committed
        <copy file="build/i2psnark.war" todir="pkg-temp/webapps/" />
jrandom's avatar
jrandom committed
        <copy file="apps/i2psnark/jetty-i2psnark.xml" todir="pkg-temp/" />
zzz's avatar
zzz committed
        <copy file="apps/i2psnark/i2psnark.config" todir="pkg-temp/" />
zzz's avatar
zzz committed
        <copy file="installer/resources/blocklist.txt" todir="pkg-temp/" />
        <copy file="installer/resources/clients.config" todir="pkg-temp/" />
        <copy file="installer/resources/i2ptunnel.config" todir="pkg-temp/" />
        <copy file="installer/resources/systray.config" todir="pkg-temp/" />
        <copy file="installer/resources/wrapper.config" todir="pkg-temp/" />
        <copy file="installer/resources/hosts.txt" todir="pkg-temp/" />
zzz's avatar
zzz committed
        <copy file="INSTALL-headless.txt" todir="pkg-temp/" />
zzz's avatar
zzz committed
        <!-- overwrite the truncated history put in by the updater -->
        <copy file="history.txt" todir="pkg-temp/" overwrite="true" />
smeghead's avatar
smeghead committed
        <mkdir dir="pkg-temp/scripts" />
        <copy file="apps/proxyscript/i2pProxy.pac" todir="pkg-temp/scripts/" />
        <!-- overwrite the news put in by the updater -->
        <copy file="installer/resources/initialNews.xml" tofile="pkg-temp/docs/news.xml" overwrite="true" />
jrandom's avatar
jrandom committed
        <copy file="installer/resources/startconsole.html" todir="pkg-temp/docs/" />
        <copy file="installer/resources/start.ico" todir="pkg-temp/docs/" />
        <copy file="installer/resources/console.ico" todir="pkg-temp/docs/" />
        <copy file="installer/resources/uninstall.ico" todir="pkg-temp/docs/" />
jrandom's avatar
jrandom committed
        <mkdir dir="pkg-temp/docs/themes/" />
        <copy todir="pkg-temp/docs/themes/" >
          <fileset dir="installer/resources/themes/" />
        </copy>
        <!-- Eepsite stuff here -->
jrandom's avatar
jrandom committed
        <mkdir dir="pkg-temp/eepsite" />
        <mkdir dir="pkg-temp/eepsite/webapps" />
        <mkdir dir="pkg-temp/eepsite/logs" />
jrandom's avatar
jrandom committed
        <mkdir dir="pkg-temp/eepsite/cgi-bin" />
        <mkdir dir="pkg-temp/eepsite/docroot" />
        <mkdir dir="pkg-temp/eepsite/docroot/help" />
        <mkdir dir="pkg-temp/eepsite/docroot/help/lib" />
        <copy todir="pkg-temp/eepsite/docroot/" >
            <fileset dir="installer/resources/eepsite.help/"  includes="robots.txt index.html help/pagetemplate.html help/index*.html **/*.png **/*.css" />
        <copy file="installer/resources/themes/console/images/favicon.ico" tofile="pkg-temp/eepsite/docroot/favicon.ico" />
jrandom's avatar
jrandom committed
        <copy file="installer/resources/jetty.xml" tofile="pkg-temp/eepsite/jetty.xml" />
    <target name="preplicenses">
zzz's avatar
zzz committed
        <copy file="LICENSE.txt" todir="pkg-temp/" />
        <copy todir="pkg-temp/licenses/" >
          <fileset dir="licenses/" />
        </copy>
        <!--
              The license in launch4j/ is a BSD license for launch4j
              The license in launch4j/head is a MIT license for the code that is actually wrapped around the jars
              So we include the MIT one in our binary package
         -->
        <copy file="installer/lib/launch4j/head/LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-Launch4j.txt" />
        <!--  Not sure if these are used or should be included -->
        <copy file="installer/lib/launch4j/lib/foxtrot.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-Foxtrot.txt" />
        <copy file="installer/lib/launch4j/lib/JGoodies.Forms.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-JGoodies-Forms.txt" />
        <copy file="installer/lib/launch4j/lib/JGoodies.Looks.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-JGoodies-Looks.txt" />
        <copy file="installer/lib/launch4j/lib/XStream.LICENSE.txt" tofile="pkg-temp/licenses/LICENSE-XStream.txt" />
    <target name="prepthemeupdates">
        <!-- Migrated all Snark content to its own dir. Need to ensure snark dir excluded from console theme choices!! -->
        <!-- Snark's visible Assets -->
        <copy todir="pkg-temp/docs/themes/snark/ubergine/" >
            <fileset dir="installer/resources/themes/snark/ubergine/" />
        <!-- No need to copy these individually, we're copying the whole dir below.. 
        <copy file="installer/resources/themes/console/images/favicon.ico" todir="pkg-temp/docs/themes/console/images/" />
        <copy file="installer/resources/themes/console/images/i2plogo.png" todir="pkg-temp/docs/themes/console/images/" />
        <!-- Since the logo moved, we have to update the error pages -->
        <copy todir="pkg-temp/docs/" >
zzz's avatar
zzz committed
          <fileset dir="installer/resources/proxy" />
        <!-- make a "classic" theme -->
        <copy todir="pkg-temp/docs/themes/console/classic/" >
            <fileset  dir="installer/resources/themes/console/classic/" />
z3d's avatar
z3d committed
        <!-- Add dark theme -->
        <copy todir="pkg-temp/docs/themes/console/dark/" >
            <fileset  dir="installer/resources/themes/console/dark/" />
z3d's avatar
z3d committed
        </copy>
        <!-- Add light theme -->
        <copy todir="pkg-temp/docs/themes/console/light/" >
            <fileset  dir="installer/resources/themes/console/light/" />
         <!-- Add midnight theme -->
        <copy todir="pkg-temp/docs/themes/console/midnight/" >
            <fileset  dir="installer/resources/themes/console/midnight/" />
        <!-- Add shared images.. these are subject to flux and change! -->
        <copy todir="pkg-temp/docs/themes/console/images/" >
            <fileset  dir="installer/resources/themes/console/images/" />
        </copy>          
zzz's avatar
zzz committed
        <copy todir="pkg-temp/docs/" >
          <fileset dir="installer/resources/readme/" includes="readme*.html" />
zzz's avatar
zzz committed
        </copy>
    <!-- this is no longer required, izpack 4.3.0 supports headless installs with java -jar i2pinstall.exe -console -->
    <target name="tarball" depends="preppkg">
        <tar compression="bzip2" destfile="i2p.tar.bz2">
            <tarfileset dir="pkg-temp" includes="**/*" prefix="i2p" />
        </tar>
    </target>
    <target name="deletepkg-temp">
zzz's avatar
zzz committed
        <delete dir="pkg-temp" />
    <target name="prepconsoleDocs" depends="prepgeoupdate">
zzz's avatar
zzz committed
        <copy todir="pkg-temp/docs/" >
zzz's avatar
zzz committed
          <fileset dir="installer/resources/readme/" includes="readme*.html" />
zzz's avatar
zzz committed
          <fileset dir="installer/resources/proxy" />
zzz's avatar
zzz committed
        </copy>
    </target>
    <target name="consoleDocs" depends="deletepkg-temp, prepconsoleDocs">
        <zip destfile="docs.zip" basedir="pkg-temp" whenempty="fail" />
    </target>
    <target name="updater200" depends="prepupdate, preplicenses, pack200, zipit200" />
    <target name="updater200WithJettyFixes" depends="prepjupdatefixes, preplicenses, pack200, zipit200" />
    <target name="updater" depends="prepupdate, preplicenses, zipit" />
    <target name="updaterWithGeoIP" depends="prepupdate, prepgeoupdate, preplicenses, zipit" />
    <target name="updaterWithJetty" depends="prepjupdate, preplicenses, zipit" />
    <target name="updaterWithJettyFixes" depends="prepjupdatefixes, preplicenses, zipit" />
    <target name="updaterWithJettyFixesAndGeoIP" depends="prepjupdatefixes, prepgeoupdate, preplicenses, zipit" />
zzz's avatar
zzz committed
    <target name="updaterSmall" depends="prepupdateSmall, zipit" />
    <target name="updaterRouter" depends="prepupdateRouter, zipit" />
    <target name="zipit">
        <zip destfile="i2pupdate.zip" basedir="pkg-temp" whenempty="fail" />
       <!-- just a test, makes almost no difference
        <tar destfile="i2pupdate.tgz" basedir="pkg-temp" compression="gzip" />
        <tar destfile="i2pupdate.tbz" basedir="pkg-temp" compression="bzip2" />
       -->
    </target>
    <target name="zipit200">
        <zip destfile="i2pupdate200.zip" basedir="pkg-temp" whenempty="fail" />
    </target>
walking's avatar
walking committed
<!-- *nix here -->
        <exec executable="sh" osfamily="unix" failonerror="true">
walking's avatar
walking committed
            <arg value="-c" />
            <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" />
        </exec>
        <exec executable="sh" osfamily="mac" failonerror="true">
            <arg value="-c" />
            <!-- pack200 will only pack to a .pack file, and only from a .jar file, so we put another .jar on the end -->
            <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" />
        </exec>
walking's avatar
walking committed
<!-- windoz here : i admit, i hate escaped symbols in xml, indeed = =! -->
		<exec executable="cmd" osfamily="windows" failonerror="true">
walking's avatar
walking committed
			<arg value="/c" />
			<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" />
        </exec>
		<exec executable="cmd" osfamily="windows" failonerror="true">
walking's avatar
walking committed
			<arg value="/c" />
			<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" />
        </exec>
jrandom's avatar
jrandom committed
    <target name="updateTest" depends="prepupdate">
        <ant dir="core/java/" target="jarTest" />    
        <copy file="core/java/build/i2ptest.jar" todir="pkg-temp/lib" />
        <zip destfile="i2pupdate.zip" basedir="pkg-temp" />
    </target>
zzz's avatar
zzz committed
    <target name="prepupdate" depends="build2, prepupdateSmall">
        <copy file="build/BOB.jar" todir="pkg-temp/lib/" />
        <copy file="build/sam.jar" todir="pkg-temp/lib/" />
        <copy file="build/i2psnark.jar" todir="pkg-temp/lib" />
zzz's avatar
zzz committed
        <!-- include systray changes in 0.7.5 -->
zzz's avatar
zzz committed
        <copy file="build/systray.jar" todir="pkg-temp/lib/" />
        <copy file="build/susimail.war" todir="pkg-temp/webapps/" />
        <copy file="build/susidns.war" todir="pkg-temp/webapps/" />
        <!-- as of 0.7.12; someday, we can remove these from the updater -->
        <copy file="apps/susidns/src/WEB-INF/lib/jstl.jar" todir="pkg-temp/lib/" />
        <copy file="apps/susidns/src/WEB-INF/lib/standard.jar" todir="pkg-temp/lib/" />
        <copy file="build/i2psnark.war" todir="pkg-temp/webapps/" />
        <copy file="history.txt" todir="pkg-temp/" />
zzz's avatar
zzz committed
        <!-- the following overwrites history.txt on unix to shrink the update file -->
        <exec executable="head" osfamily="unix" failifexecutionfails="true" output="pkg-temp/history.txt">
            <arg value="-n" />
            <arg value="1500" />
            <arg value="history.txt" />
        </exec>
        <exec executable="echo" osfamily="unix" failifexecutionfails="true" output="pkg-temp/history.txt" append="true">
            <arg value="EARLIER HISTORY IS AVAILABLE IN THE SOURCE PACKAGE" />
        </exec>
zzz's avatar
zzz committed
      <!-- May be pointless now, people with split directories will never see this,
           and for flat installs we don't want to overwrite news more recent than the update package.
        <copy file="installer/resources/news.xml" todir="pkg-temp/docs/" />
zzz's avatar
zzz committed
       -->
    <target name="prepupdateSmall" depends="buildSmall, prepupdateRouter, prepthemeupdates">
jrandom's avatar
jrandom committed
        <copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
        <copy file="build/mstreaming.jar" todir="pkg-temp/lib/" />
jrandom's avatar
jrandom committed
        <copy file="build/streaming.jar" todir="pkg-temp/lib/" />
jrandom's avatar
jrandom committed
        <copy file="build/routerconsole.jar" todir="pkg-temp/lib/" />
        <!-- pulled out of routerconsole.jar in 0.7.12, someday we can take out of updater -->
        <!-- name without version so we can overwrite if we upgrade  -->
        <copy file="apps/jrobin/jrobin-1.4.0.jar" tofile="pkg-temp/lib/jrobin.jar" />
jrandom's avatar
jrandom committed
        <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
        <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
jrandom's avatar
jrandom committed
        <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
zzz's avatar
zzz committed
        <!-- decapitalized the file in 0.7.8 -->
walking's avatar
walking committed
       <copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
jrandom's avatar
jrandom committed
    </target>
    <target name="prepupdateRouter" depends="buildrouter, deletepkg-temp">
        <copy file="build/i2p.jar" todir="pkg-temp/lib/" />
        <copy file="build/router.jar" todir="pkg-temp/lib/" />
    </target>
    <target name="prepgeoupdate">
zzz's avatar
zzz committed
        <copy file="installer/resources/geoip.txt" todir="pkg-temp/geoip/" />
        <copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
zzz's avatar
zzz committed
        <copy todir="pkg-temp/docs/icons/flags" >
zzz's avatar
zzz committed
          <fileset dir="installer/resources/icons/flags" />
        </copy>
    </target>
zzz's avatar
zzz committed
    <target name="prepjupdate" depends="prepupdate, buildWEB">
        <copy file="build/jasper-compiler.jar" todir="pkg-temp/lib/" />
        <copy file="build/jasper-runtime.jar" todir="pkg-temp/lib/" />
        <copy file="build/commons-logging.jar" todir="pkg-temp/lib/" />
        <copy file="build/commons-el.jar" todir="pkg-temp/lib/" />
        <copy file="build/javax.servlet.jar" todir="pkg-temp/lib/" />
        <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
    </target>
    <target name="prepjupdatefixes" depends="prepupdate, buildWEB">
        <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
    </target>
    <target name="installer" depends="preppkg">
jrandom's avatar
jrandom committed
        <taskdef name="izpack" classpath="${basedir}/installer/lib/izpack/standalone-compiler.jar" classname="com.izforge.izpack.ant.IzPackTask" />
zzz's avatar
zzz committed
        <mkdir dir="pkg-temp/installer" />
        <jar destfile="./pkg-temp/installer/copy.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Copy.class net/i2p/util/FileUtil.class">
jrandom's avatar
jrandom committed
            <manifest><attribute name="Main-Class" value="net.i2p.util.Copy" /></manifest>
        </jar>
zzz's avatar
zzz committed
        <jar destfile="./pkg-temp/installer/delete.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Delete.class net/i2p/util/FileUtil.class">
jrandom's avatar
jrandom committed
            <manifest><attribute name="Main-Class" value="net.i2p.util.Delete" /></manifest>
        </jar>
zzz's avatar
zzz committed
        <jar destfile="./pkg-temp/installer/exec.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Exec.class">
jrandom's avatar
jrandom committed
            <manifest><attribute name="Main-Class" value="net.i2p.util.Exec" /></manifest>
        </jar>
        <!--
          Force 1.5 pack200 output
          Doesnt work!
          http://jira.codehaus.org/browse/IZPACK-404
          http://forums.sun.com/thread.jspa?threadID=773439
          http://bfo.co.uk/blog/2010/05/13/combining_ant_jar_signatures_and_pack200.html
        <property name="com.sun.java.util.jar.pack.package.majver" value="150" />
        <property name="com.sun.java.util.jar.pack.package.minver" value="7" />
        -->
        <izpack input="${basedir}/installer/install.xml" output="${basedir}/install.jar" installerType="standard" basedir="${basedir}" />
jrandom's avatar
jrandom committed

        <ant target="installerexe" />
    </target>
    <target name="installerexe">
        <condition property="noExe">
	    <os arch="x86_64" />
	</condition>
        <condition property="noExe">
	    <os arch="amd64" />
	</condition>
	<condition property="noExe">
	   <not>
	    <or>
	     <os name="Linux" />
	     <os family="windows" />
	    </or>
	   </not>
	</condition>
jrandom's avatar
jrandom committed
	<ant target="doInstallerEXE" />
    </target>
    <target name="doInstallerEXE" unless="noExe">
jrandom's avatar
jrandom committed
	<!-- now the installer exe -->
	<taskdef name="launch4j"
                 classname="net.sf.launch4j.ant.Launch4jTask"
                 classpath="${basedir}/installer/lib/launch4j/launch4j.jar:${basedir}/installer/lib/launch4j/lib/xstream.jar" />
        <launch4j configFile="./installer/i2pinstaller.xml" />
        <launch4j configFile="./installer/i2pstandalone.xml" />
	<!-- thazzit -->
comwiz's avatar
comwiz committed
    <target name="test">
        <ant dir="core/java/" target="test" />
    </target>
    <target name="junit.report">
        <ant dir="core/java/" target="junit.report" />
    </target>
    <target name="clover.report">
        <ant dir="core/java/" target="clover.report" />
    </target>
    <target name="test.report" depends="junit.report, clover.report"/>
    <target name="fulltest">
		<ant dir="core/java/" target="fulltest" />
comwiz's avatar
comwiz committed
		<ant dir="router/java/" target="fulltest" />
    </target>
    <target name="fullclovertest">
		<ant dir="core/java/" target="fullclovertest" />
		<ant dir="router/java/" target="fullclovertest" />
comwiz's avatar
comwiz committed
    </target>
jrandom's avatar
jrandom committed
    <target name="syndie" >
        <ant dir="apps/syndie/java/" target="standalone" />
        <copy file="apps/syndie/java/syndie-standalone.zip" todir="." />
    </target>
jrandom's avatar
jrandom committed
    <target name="i2psnark">
        <ant dir="apps/i2psnark/java" target="standalone" />
        <copy file="apps/i2psnark/java/i2psnark-standalone.zip" todir="." />
    </target>
    <target name="slackpkg">
        <echo message="Building Slackware package." />
        <ant dir="Slackware/i2p/" target="slackpkg" />
        <ant dir="Slackware/i2p-base/" target="slackpkg" />
    </target>
    <target name="justBOB" depends="builddepSmall">
        <ant dir="apps/BOB/" target="onejar" />
        <copy file="apps/BOB/dist/BOB-one.jar" todir="." />
    </target>
zzz's avatar
zzz committed
    <target name="findbugs" depends="build2">
        <echo message="Starting findbugs, this will take a while..." />
        <exec executable="nice">
            <arg value="findbugs"/>
            <arg value="-textui"/>
            <arg value="-projectName"/>
            <arg value="i2p"/>
            <arg value="-sortByClass"/>
            <arg value="-xml"/>
            <arg value="-output"/>
            <arg value="findbugs.xml"/>
            <arg value="-auxclasspath"/>
            <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.4.0.jar:apps/systray/java/lib/systray4j.jar:installer/lib/wrapper/linux/wrapper.jar"/>
zzz's avatar
zzz committed
            <arg value="-sourcepath"/>
            <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/"/>
            <!-- start of the files to be analyzed -->
            <arg value="build/BOB.jar"/>
            <arg value="build/addressbook.war"/>
            <arg value="build/i2p.jar"/>
            <arg value="build/i2psnark.jar"/>
            <arg value="build/i2psnark.war"/>
            <arg value="build/i2ptunnel.jar"/>
            <arg value="build/i2ptunnel.war"/>
            <arg value="build/jbigi.jar"/>
            <arg value="build/mstreaming.jar"/>
            <arg value="build/router.jar/"/>
            <!-- use the class files rather than the jar for routerconsole so we don't analyze jrobin -->
            <arg value="apps/routerconsole/java/build/obj/"/>
            <arg value="build/sam.jar"/>
            <arg value="build/streaming.jar"/>
            <arg value="build/susidns.war"/>
            <arg value="build/susimail.war"/>
            <arg value="build/systray.jar"/>
        </exec>
        <echo message="Findbugs output stored in findbugs.xml" />
    </target>
mathiasdm's avatar
mathiasdm committed
    <target name="buildWithDesktopgui" depends="buildrouter,builddepSmall">
        <ant dir="apps/desktopgui" target="build_jar" />
    </target>
    <target name="preppkgWithDesktopgui" depends="buildWithDesktopgui,preppkg">
        <copy file="apps/desktopgui/dist/desktopgui.jar" todir="pkg-temp/lib/" />
        <copy file="apps/desktopgui/lib/swing-worker.jar" todir="pkg-temp/lib/" />
        <copy file="apps/desktopgui/lib/appframework.jar" todir="pkg-temp/lib/" />
        <mkdir dir="pkg-temp/desktopgui/resources/" />
        <copy todir="pkg-temp/desktopgui/resources/">
            <fileset dir="apps/desktopgui/desktopgui/resources/" />
        </copy>
    </target>
    <target name="installerWithDesktopgui" depends="preppkgWithDesktopgui,installer" />
    <target name="prepupdateWithDesktopgui" depends="buildWithDesktopgui,prepupdate">
        <copy file="apps/desktopgui/dist/desktopgui.jar" todir="pkg-temp/lib/" />
        <copy file="apps/desktopgui/lib/swing-worker.jar" todir="pkg-temp/lib/" />
        <copy file="apps/desktopgui/lib/appframework.jar" todir="pkg-temp/lib/" />
        <mkdir dir="pkg-temp/desktopgui/resources/" />
        <copy todir="pkg-temp/desktopgui/resources/">
            <fileset dir="apps/desktopgui/desktopgui/resources/" />
        </copy>
    </target>
    <target name="updaterWithDesktopgui" depends="prepupdateWithDesktopgui,updater" />
    <target name="pkgWithDesktopgui" depends="distclean, updaterWithDesktopgui, installerWithDesktopgui, preppkg" />
    <target name="distWithDesktopgui" depends="pkgWithDesktopgui, javadoc" />
    <target name="distcleanWithDesktopgui" depends="distclean">
        <ant dir="apps/desktopgui" target="build_clean" />

    <!-- this is the same dependency as pkg, but with updater200 in the middle,
         since preppkg puts too much stuff in pkg-temp -->
    <target name="release" depends="distclean, updater, updater200, preppkg, installer" >
zzz's avatar
zzz committed
        <echo message="================================================================" />
        <echo message="Did you update these files?" />
zzz's avatar
zzz committed
        <exec executable="ls" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-l" />
            <arg value="history.txt" />
            <arg value="installer/resources/initialNews.xml" />
zzz's avatar
zzz committed
            <arg value="installer/install.xml" />
            <arg value="installer/resources/news.xml" />
zzz's avatar
zzz committed
	    <arg value="core/java/src/net/i2p/CoreVersion.java" />
	    <arg value="router/java/src/net/i2p/router/RouterVersion.java" />
        </exec>
zzz's avatar
zzz committed
        <echo message="Everything is checked in, right? Let's be sure:" />
zzz's avatar
zzz committed
        <exec executable="mtn" failonerror="true">
zzz's avatar
zzz committed
            <arg value="st" />
        </exec>
zzz's avatar
zzz committed
        <echo message="If there are any modified files above, stop now!" />
        <!-- get release version number -->
        <exec executable="grep" outputproperty="versionLine" failonerror="true" >
            <arg value="public final static String VERSION" />
	    <arg value="core/java/src/net/i2p/CoreVersion.java" />
        </exec>
        <exec executable="cut" inputstring="${versionLine}" outputproperty="release.number" failonerror="true" >
            <arg value="-f2" />
	    <arg value="-d&quot;" />
        </exec>
zzz's avatar
zzz committed
        <echo message="New version number is ${release.number}" />
zzz's avatar
zzz committed
        <copy file="i2pupdate.zip" tofile="i2pupdate_${release.number}.zip" />
        <copy file="i2pinstall.exe" tofile="i2pinstall_${release.number}.exe" />
        <delete file="i2pupdate.sud" failonerror="false" />
        <delete file="i2pupdate.su2" failonerror="false" />
zzz's avatar
zzz committed
        <input message="Enter private signing key file:" addproperty="release.privkey" />
        <fail message="You must enter a path." >
            <condition>
                <equals arg1="${release.privkey}" arg2=""/>
            </condition>
        </fail>
zzz's avatar
zzz committed
        <echo message="Key file is ${release.privkey}" />
zzz's avatar
zzz committed
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="sign" />
            <arg value="i2pupdate.zip" />
            <arg value="i2pupdate.sud" />
            <arg value="${release.privkey}" />
            <arg value="${release.number}" />
        </java>
        <echo message="Verify version and VALID signature:" />
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="verifysig" />
            <arg value="i2pupdate.sud" />
        </java>
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="showversion" />
            <arg value="i2pupdate.sud" />
        </java>
        <!-- now build and verify the packed sud from the packed zip -->
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="sign" />
            <arg value="i2pupdate200.zip" />
            <arg value="i2pupdate.su2" />
            <arg value="${release.privkey}" />
            <arg value="${release.number}" />
        </java>
        <echo message="Verify version and VALID signature:" />
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="verifysig" />
            <arg value="i2pupdate.su2" />
        </java>
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="showversion" />
            <arg value="i2pupdate.su2" />
        </java>
zzz's avatar
zzz committed
        <!-- will this use the monotonerc file in the current workspace? -->
zzz's avatar
zzz committed
        <echo message="Checking out fresh copy into ../i2p-${release.number} for tarballing:" />
zzz's avatar
zzz committed
        <delete dir="../i2p-${release.number}" />
zzz's avatar
zzz committed
        <exec executable="mtn" failonerror="true">
zzz's avatar
zzz committed
            <arg value="co" />
            <arg value="-b" />
            <arg value="i2p.i2p" />
zzz's avatar
zzz committed
            <!-- w: is the revision of the current workspace -->
            <arg value="-r" />
            <arg value="w:" />
zzz's avatar
zzz committed
            <arg value="../i2p-${release.number}/" />
        </exec>
zzz's avatar
zzz committed
        <exec executable="tar" failonerror="true">
zzz's avatar
zzz committed
            <arg value="cjf" />
            <arg value="i2psource_${release.number}.tar.bz2" />
            <arg value="-C" />
            <arg value=".." />
            <arg value="--exclude" />
zzz's avatar
zzz committed
            <arg value="i2p-${release.number}/_MTN*" />
zzz's avatar
zzz committed
            <arg value="i2p-${release.number}/" />
        </exec>
        <echo message="Sign the files:" />
zzz's avatar
zzz committed
        <delete file="i2pinstall_${release.number}.exe.sig" />
        <delete file="i2psource_${release.number}.tar.bz2.sig" />
        <delete file="i2pupdate_${release.number}.zip.sig" />
zzz's avatar
zzz committed
        <exec executable="gpg" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-b" />
            <arg value="i2pinstall_${release.number}.exe" />
        </exec>
zzz's avatar
zzz committed
        <exec executable="gpg" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-b" />
            <arg value="i2psource_${release.number}.tar.bz2" />
        </exec>
zzz's avatar
zzz committed
        <exec executable="gpg" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-b" />
            <arg value="i2pupdate_${release.number}.zip" />
        </exec>
        <echo message="File sizes:" />
zzz's avatar
zzz committed
        <exec executable="ls" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-l" />
            <arg value="i2pinstall_${release.number}.exe" />
            <arg value="i2psource_${release.number}.tar.bz2" />
            <arg value="i2pupdate_${release.number}.zip" />
            <arg value="i2pupdate.su2" />
zzz's avatar
zzz committed
            <arg value="i2pupdate.sud" />
            <arg value="i2pinstall_${release.number}.exe.sig" />
            <arg value="i2psource_${release.number}.tar.bz2.sig" />
            <arg value="i2pupdate_${release.number}.zip.sig" />
        </exec>
        <echo message="SHA256 sums:" />
zzz's avatar
zzz committed
        <exec executable="sha256sum" failonerror="true">
zzz's avatar
zzz committed
            <arg value="i2pinstall_${release.number}.exe" />
            <arg value="i2psource_${release.number}.tar.bz2" />
            <arg value="i2pupdate_${release.number}.zip" />
            <arg value="i2pupdate.su2" />
zzz's avatar
zzz committed
            <arg value="i2pupdate.sud" />
        </exec>
zzz's avatar
zzz committed
        <echo message="Don't forget to mtn tag w: i2p-${release.number}" />
zzz's avatar
zzz committed
        <echo message="... and mtn cert t:i2p-${release.number} branch i2p.i2p.release" />
zzz's avatar
zzz committed
    </target>
    <target name="debian" depends="distclean, debian-source, debian-binary" />

    <target name="debian-binary">
HungryHobo's avatar
HungryHobo committed
        <echo message="Did you update the version in these files?" />
        <exec executable="ls" failonerror="true">
            <arg value="-l" />
            <arg value="debian/changelog" />
        </exec>
        <echo message="====================" />
        <!-- bundle the 20MB jetty 5 lib since there probably isn't a deb for it -->
        <ant dir="apps/jetty" target="ensureJettylib" />
	
        <exec dir="debian" executable="./buildpackage.sh" failonerror="true">
            <arg value="i386" />
        <exec dir="debian" executable="./buildpackage.sh" failonerror="true">
            <arg value="amd64" />
    <target name="debian-source">
        <!-- bundle the 20MB jetty 5 lib since there probably isn't a deb for it -->
        <ant dir="apps/jetty" target="ensureJettylib" />
        <echo message="Did you update the version in these files?" />
        <exec executable="ls" failonerror="true">
            <arg value="-l" />
            <arg value="debian/changelog" />
        </exec>
        <echo message="====================" />
        <exec dir="debian" executable="./buildpackage.sh" failonerror="true">
            <arg value="source" />
        </exec>
    </target>
HungryHobo's avatar
HungryHobo committed
    <target name="debianrepo" depends="debian">
        <exec dir="debian" executable="./makerepo.sh" failonerror="true"/>
HungryHobo's avatar
HungryHobo committed
    </target>
<!-- the following are appened to help build barebone portable version, 
     none of the above is modified for this purpose -->
	<target name = "pkg-portable-clean">
		<delete dir="build/" />
walking's avatar
walking committed
		<delete dir="pkg-temp/" />
		<delete>
			<fileset dir="." includes="portable-**.zip**" />
		</delete>
	</target>
<!-- build a portable archive -->
walking's avatar
walking committed

<!-- *0* Since we simply pack all files in folder "build/" into our archieve, 
		we need to make sure its small, with NO redundent jars or wars.
		thus cleaning is required before each build-->
	<target name="buildSmallOnly" depends="pkg-portable-clean,buildSmall"/>
<!-- *1* preparing the jars by OS dependent de-bloating -->
walking's avatar
walking committed
	<target name="preppkg-portable-win32-jbigi" depends="buildSmallOnly">
		<!-- rip the non-windows stuff out of jbigi.jar -->
		<mkdir dir="tmpextract" />
		<unjar src="build/jbigi.jar" dest="tmpextract/" />
		<jar destfile="build/jbigi.jar" >
			<fileset dir="tmpextract/" includes="*windows*" />
		</jar>
		<delete dir="tmpextract/" />
	</target>
walking's avatar
walking committed
	<target name="preppkg-portable-linux-jbigi"  depends="buildSmallOnly">
		<!-- rip the non-linux stuff out of jbigi.jar -->
		<mkdir dir="tmpextract" />
		<unjar src="build/jbigi.jar" dest="tmpextract/" />
walking's avatar
walking committed
		<jar destfile="build/jbigi.jar" >
			<fileset dir="tmpextract/" includes="*linux*" />
		</jar>
		<delete dir="tmpextract/" />
	</target>
walking's avatar
walking committed

<!-- *2* os independent procedure  -->