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

Skip to content
Snippets Groups Projects
build.xml 36.6 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" />
    -->

    <!-- You probably don't want to change anything from here down -->
    <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" />
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="  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)" />
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" />
mihi's avatar
mihi committed
        <ant dir="apps/i2ptunnel/java/" target="jar" />
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="javadoc">
        <mkdir dir="./build" />
        <mkdir dir="./build/javadoc" />
            destdir="./build/javadoc" 
            packagenames="*" 
            use="true" 
jrandom's avatar
jrandom committed
            group="SDK net.i2p:net.i2p.*:net.i2p.client:net.i2p.client.*:freenet.support.CPUInformation,
                   Streaming net.i2p.client.streaming,
                   BOB net.i2p.BOB,
                   SAM net.i2p.sam:net.i2p.sam.client,
jrandom's avatar
jrandom committed
                   RouterConsole net.i2p.router.web,
                   Router net.i2p.router:net.i2p.router.*:net.i2p.data.i2np,
                   Systray net.i2p.apps.systray,
                   I2PTunnel net.i2p.i2ptunnel:net.i2p.i2ptunnel.*"
            splitindex="true" 
jrandom's avatar
jrandom committed
            windowtitle="I2P">
            <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" />
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>
        </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" />
    </target>
    <target name="distclean" depends="clean">
        <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" />
        <delete>
            <fileset dir="." includes="**/*.class" />
            <fileset dir="." includes="**/*.java~" />
        </delete>
    </target>
zzz's avatar
zzz committed
    <target name="pkg" depends="distclean, updater, preppkg, installer" />
    <target name="pkgclean" depends="deletepkg-temp">
jrandom's avatar
jrandom committed
            <fileset dir="." includes="i2p.tar.bz2 install.jar i2pupdate.zip" />
        </delete>
    </target>
    <target name="preppkg" depends="build, buildexe, preplicenses, prepconsoleDocs">
        <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/jbigi.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/" />
        <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" />
complication's avatar
complication committed
        <!-- <copy file="build/sucker.jar" todir="pkg-temp/lib" /> -->
jrandom's avatar
jrandom committed
        <copy file="build/i2psnark.jar" todir="pkg-temp/lib/" />
jrandom's avatar
jrandom committed
        <copy file="i2p.exe" todir="pkg-temp/" failonerror="false" />
jrandom's avatar
jrandom committed
        <copy file="installer/resources/runplain.sh" todir="pkg-temp/" />
        <copy file="apps/systray/java/lib/systray4j.jar" todir="pkg-temp/lib" />
        <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="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/" />
zzz's avatar
zzz committed
        <!-- <copy file="build/syndie.war" todir="pkg-temp/webapps/" /> -->
jrandom's avatar
jrandom committed
        <copy file="build/i2psnark.war" todir="pkg-temp/webapps/" />
zzz's avatar
zzz committed
        <copy file="apps/i2psnark/launch-i2psnark" todir="pkg-temp/" />
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/eepget" todir="pkg-temp/" />
        <copy file="installer/resources/i2prouter" 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/i2ptunnel.config" todir="pkg-temp/" />
hypercubus's avatar
hypercubus committed
        <!-- <copy file="installer/resources/install_i2p_service_unix" todir="pkg-temp/" /> -->
        <copy file="installer/resources/install_i2p_service_winnt.bat" todir="pkg-temp/" />
        <copy file="installer/resources/osid" todir="pkg-temp/" />
        <copy file="installer/resources/postinstall.bat" todir="pkg-temp/" />
        <copy file="installer/resources/postinstall.sh" todir="pkg-temp/" />
        <copy file="installer/resources/systray.config" todir="pkg-temp/" />
hypercubus's avatar
hypercubus committed
        <!-- <copy file="installer/resources/uninstall_i2p_service_unix" todir="pkg-temp/" /> -->
        <copy file="installer/resources/uninstall_i2p_service_winnt.bat" todir="pkg-temp/" />
        <copy file="installer/resources/wrapper.config" todir="pkg-temp/" />
        <copy todir="pkg-temp/lib/wrapper/freebsd/">
            <fileset dir="installer/lib/wrapper/freebsd/" />
        </copy>
        <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>
        <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>
        <copy todir="pkg-temp/lib/wrapper/win32/">
            <fileset dir="installer/lib/wrapper/win32/" />
        </copy>
        <copy file="hosts.txt" todir="pkg-temp/" />
zzz's avatar
zzz committed
        <copy file="INSTALL-headless.txt" todir="pkg-temp/" />
smeghead's avatar
smeghead committed
        <mkdir dir="pkg-temp/scripts" />
        <copy file="apps/proxyscript/i2pProxy.pac" todir="pkg-temp/scripts/" />
        <copy file="core/perl/i2pbench.sh" todir="pkg-temp/scripts/" />
        <copy file="core/perl/i2ptest.sh" todir="pkg-temp/scripts/" />
        <!-- polecat: please put your modified toolbar.html in installer/resources/toolbar.html 
             and uncomment the following -->
        <!-- <copy file="installer/resources/toolbar.html" todir="pkg-temp/docs/" /> -->
jrandom's avatar
jrandom committed
        <copy file="initialNews.xml" tofile="pkg-temp/docs/news.xml" />
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>
jrandom's avatar
jrandom committed
        <mkdir dir="pkg-temp/eepsite" />
        <mkdir dir="pkg-temp/eepsite/webapps" />
        <mkdir dir="pkg-temp/eepsite/logs" />
        <mkdir dir="pkg-temp/eepsite/docroot" />
jrandom's avatar
jrandom committed
        <mkdir dir="pkg-temp/eepsite/cgi-bin" />
jrandom's avatar
jrandom committed
        <copy file="installer/resources/eepsite_index.html" tofile="pkg-temp/eepsite/docroot/index.html" />
        <copy file="installer/resources/eepsite_index_de.html" tofile="pkg-temp/eepsite/docroot/index_de.html" />
        <copy file="installer/resources/eepsite.css" todir="pkg-temp/eepsite/docroot/" />
        <copy file="installer/resources/robots.txt" todir="pkg-temp/eepsite/docroot/" />
        <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>
    <target name="preplicenses">
zzz's avatar
zzz committed
        <copy file="LICENSE.txt" todir="pkg-temp/" />
        <copy todir="pkg-temp/licenses/" >
          <fileset dir="licenses/" />
        </copy>
        <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">
        <!-- Add extricated I2PSnark css here, for now -->
        <copy file="installer/resources/themes/console/snark.css" todir="pkg-temp/docs/themes/console/" />
        <!-- these files now in docs/, not in the .war -->
        <!-- 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/" >
          <fileset dir="installer/resources/" includes="*-header.ht" />
        </copy>
        <!-- make a "classic" theme -->
        <copy todir="pkg-temp/docs/themes/console/classic/" >
            <fileset  dir="installer/resources/themes/console/classic/" />
        </copy>
z3d's avatar
z3d committed
        <!-- Add dark theme -->
        <copy todir="pkg-temp/docs/themes/console/dark/" >
            <fileset  dir="installer/resources/themes/console/dark/" />
        </copy>
        <!-- Add light theme -->
        <copy todir="pkg-temp/docs/themes/console/light/" >
            <fileset  dir="installer/resources/themes/console/light/" />
        </copy>
        <!-- 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="." includes="readme*.html" />
        </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/" >
          <fileset dir="." includes="readme*.html" />
          <fileset dir="installer/resources/" includes="*-header.ht" />
        </copy>
    </target>
    <target name="consoleDocs" depends="deletepkg-temp, prepconsoleDocs">
        <zip destfile="docs.zip" basedir="pkg-temp" whenempty="fail" />
    </target>
    <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" />
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/" />
        <copy file="build/i2psnark.war" todir="pkg-temp/webapps/" />
        <copy file="history.txt" todir="pkg-temp/" />
        <copy file="news.xml" todir="pkg-temp/docs/" />
    </target>
    <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/" />
        <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
    </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>
        <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>
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" />
zzz's avatar
zzz committed
    <target name="release" depends="pkg">
        <echo message="================================================================" />
        <echo message="Did you update these files?" />
        <exec executable="ls">
            <arg value="-l" />
            <arg value="history.txt" />
            <arg value="initialNews.xml" />
            <arg value="installer/install.xml" />
            <arg value="news.xml" />
	    <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:" />
        <exec executable="mtn">
            <arg value="st" />
        </exec>
zzz's avatar
zzz committed
        <input message="Enter new version number:" addproperty="release.number" />
        <fail message="You must enter a version number." >
            <condition>
                <equals arg1="${release.number}" arg2=""/>
            </condition>
        </fail>
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" />
        <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>
        <fail message="i2pupdate.sud generation failed!" >
            <condition>
                <length file="i2pupdate.sud" when="lt" length="1000000" />
            </condition>
        </fail>
        <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>
        <!-- will this use the monotonerc file in the current workspace? -->
        <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">
            <arg value="co" />
            <arg value="-b" />
            <arg value="i2p.i2p" />
            <arg value="../i2p-${release.number}/" />
        </exec>
        <exec executable="tar">
            <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">
            <arg value="-b" />
            <arg value="i2pinstall_${release.number}.exe" />
        </exec>
        <exec executable="gpg">
            <arg value="-b" />
            <arg value="i2psource_${release.number}.tar.bz2" />
        </exec>
        <exec executable="gpg">
            <arg value="-b" />
            <arg value="i2pupdate_${release.number}.zip" />
        </exec>
        <echo message="File sizes:" />
        <exec executable="ls">
            <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.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:" />
        <exec executable="sha256sum">
            <arg value="i2pinstall_${release.number}.exe" />
            <arg value="i2psource_${release.number}.tar.bz2" />
            <arg value="i2pupdate_${release.number}.zip" />
            <arg value="i2pupdate.sud" />
        </exec>
        <echo message="Don't forget to mtn tag h: i2p-${release-number}" />
    </target>
</project>