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

Skip to content
Snippets Groups Projects
build.xml 101 KiB
Newer Older
zzz's avatar
zzz committed
          <fileset dir="installer/resources/certificates/" />
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>
zzz's avatar
zzz committed

    <target name="deletepkg-temp">
zzz's avatar
zzz committed
        <delete dir="pkg-temp" />
zzz's avatar
zzz committed

    <!-- readme and proxy error page files, initialNews.xml files, GeoIP files, and flag icons -->
    <target name="prepConsoleDocs" depends="prepConsoleDocUpdates, prepgeoupdate" >
        <copy todir="pkg-temp/docs/initialNews/">
          <fileset dir="installer/resources/initialNews/" />
        </copy>
kytv's avatar
kytv committed
        <!-- ensure the proxy files have the correct line endings -->
        <fixcrlf srcdir="pkg-temp/docs" includes="*.ht" encoding="utf8" eol="crlf" />
zzz's avatar
zzz committed

    <!-- readme and proxy error page files -->
    <target name="prepConsoleDocUpdates">
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/" includes="*.ht" />
          <!-- lang_ar.png added in 0.8.4; a1,a2,je, and eu.png added in 0.8.9; gg.png added in 0.8.10; im.png added in 0.8.12; cw.png added in 0.9.5 -->
          <fileset dir="installer/resources/" includes="icons/flags/lang_ar.png icons/flags/gg.png icons/flags/je.png icons/flags/eu.png icons/flags/im.png icons/flags/a1.png icons/flags/a2.png icons/flags/cw.png" />
zzz's avatar
zzz committed
        </copy>
    </target>
zzz's avatar
zzz committed

    <target name="consoleDocs" depends="deletepkg-temp, prepConsoleDocs">
        <zip destfile="docs.zip" basedir="pkg-temp" whenempty="fail" />
    </target>
zzz's avatar
zzz committed
    <target name="copyJavadoc" depends="javadoc">
        <copy todir="pkg-temp/docs/javadoc" >
          <fileset dir="build/javadoc/" />
        </copy>
    </target>

    <target name="updater200" depends="prepupdate, preplicenses, pack200, zipit200" />
kytv's avatar
kytv committed
    <target name="updater200WithJetty" depends="prepjupdate, preplicenses, pack200, zipit200" />
    <target name="updater200WithJettyFixes" depends="prepjupdatefixes, preplicenses, pack200, zipit200" />
    <target name="updater200WithJettyFixesAndJbigi" depends="prepjupdatefixes, prepjbigiupdate, preplicenses, pack200, zipit200" />
    <target name="updater" depends="prepupdate, preplicenses, zipit" />
    <target name="updaterRepack" depends="prepupdate, preplicenses, repack200, zipit" />
zzz's avatar
zzz committed
    <target name="updaterWithJavadoc" depends="prepupdate, preplicenses, copyJavadoc, zipit" />
    <target name="updater200WithJavadoc" depends="prepupdate, preplicenses, copyJavadoc, pack200, zipit200" />
    <target name="updaterWithJavadocAndJetty" depends="prepjupdate, preplicenses, copyJavadoc, zipit" />
    <target name="updater200WithJavadocAndJetty" depends="prepjupdate, preplicenses, copyJavadoc, pack200, zipit200" />
    <target name="updaterWithGeoIP" depends="prepupdate, prepgeoupdate, preplicenses, zipit" />
    <target name="updaterWithJetty" depends="prepjupdate, preplicenses, zipit" />
    <target name="updaterWithJettyRepack" depends="prepjupdate, preplicenses, repack200, zipit" />
    <target name="updaterWithJettyFixes" depends="prepjupdatefixes, preplicenses, zipit" />
    <target name="updaterWithJettyFixesAndJbigi" depends="prepjupdatefixes, prepjbigiupdate, 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" />
zzz's avatar
zzz committed

    <target name="zipit" depends="getReleaseNumber" >
        <!--
             As of release 0.8.8, the router will enforce a zipfile comment equal to the
             version number in the sud/su2 header, since the version in the header is NOT
             covered by the signature.
         -->
        <zip destfile="i2pupdate.zip" basedir="pkg-temp" whenempty="fail" comment="${release.number}" />
       <!-- 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>
zzz's avatar
zzz committed

    <target name="zipit200" depends="getReleaseNumber" >
        <zip destfile="i2pupdate200.zip" basedir="pkg-temp" whenempty="fail" comment="${release.number}" />
        <!-- pack200 will only pack to a .pack file, and only from a .jar file, so we put another .jar on the end -->
        <!-- can't pack an empty jar or one without classes, it will fail to unpack on Java 5;
          -  see http://bugs.sun.com/view_bug.do?bug_id=6712743
          -->
        <exec executable="sh" osfamily="unix" failonerror="true">
walking's avatar
walking committed
            <arg value="-c" />
zzz's avatar
zzz committed
            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar -o $i = pkg-temp/lib/jetty-java5-threadpool.jar -o $i = pkg-temp/lib/jetty-sslengine.jar ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
walking's avatar
walking committed
        </exec>
        <exec executable="sh" osfamily="mac" failonerror="true">
zzz's avatar
zzz committed
            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar -o $i = pkg-temp/lib/jetty-java5-threadpool.jar -o $i = pkg-temp/lib/jetty-sslengine.jar ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
        <!-- windoz here : i admit, i hate escaped symbols in xml, indeed = =! -->
        <exec executable="cmd" osfamily="windows" failonerror="true">
            <arg value="/c" />
            <!-- TODO implement fix above -->
            <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">
                <arg value="/c" />
                <arg value="for %i in (pkg-temp\lib\*.jar) do pack200 -g %i.pack %i &amp;&amp; del %i" />
        </exec>
    </target>

    <!-- saves about 1% on average (more on jars with multiple compiled po files since they have lots of common strings) -->
    <target name="repack200">
        <!-- pack200 will only repack a .jar file, so we put another .jar on the end -->
        <!-- *nix here -->
        <exec executable="sh" osfamily="unix" failonerror="true">
            <arg value="-c" />
            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do echo pack200 -r $i; mv $i $i.jar; pack200 -r $i.jar; mv $i.jar $i; done" />
        </exec>
        <exec executable="sh" osfamily="mac" failonerror="true">
            <arg value="-c" />
            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do echo pack200 -r $i; mv $i $i.jar; pack200 -r $i.jar; mv $i.jar $i; done" />
        </exec>
        <!-- windoz here : i admit, i hate escaped symbols in xml, indeed = =! -->
        <exec executable="cmd" osfamily="windows" failonerror="true">
            <arg value="/c" />
            <arg value="for %i in (pkg-temp\webapps\*.war) do move %i %i.jar &amp;&amp; pack200 -r %i.jar &amp;&amp; move %i.jar %i" />
walking's avatar
walking committed
        </exec>
        <exec executable="cmd" osfamily="windows" failonerror="true">
                <arg value="/c" />
                <arg value="for %i in (pkg-temp\lib\*.jar) do pack200 -r %i" />
walking's avatar
walking committed
        </exec>
    <target name="prepupdate" depends="build2, prepupdateSmall, prepConsoleDocUpdates, prepCertificates, prep-script-translation">
        <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/" />
zzz's avatar
zzz committed
       <!-- removed from updater in 0.9
        <copy file="build/desktopgui.jar" todir="pkg-temp/lib/" />
zzz's avatar
zzz committed
       -->
        <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 -->
        <copy file="history.txt" tofile="pkg-temp/history.txt" overwrite="true">
            <filterchain>
                <headfilter lines="1500" />
            </filterchain>
        </copy>
        <concat append="true" destfile="pkg-temp/history.txt">&#10;&#10;----------------&#10;&#10;EARLIER HISTORY IS AVAILABLE IN THE SOURCE PACKAGE"</concat>
        <copy file="installer/resources/deletelist.txt" todir="pkg-temp/" />
zzz's avatar
zzz committed

    <target name="prepupdateSmall" depends="buildSmall, prepupdateRouter, prepjupdatefixes, 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  -->
zzz's avatar
zzz committed
        <copy file="build/jrobin.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 -->
zzz's avatar
zzz committed
        <copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
        <!-- small enough to include for now -->
        <copy file="installer/resources/geoipv6.dat.gz" todir="pkg-temp/geoip/" />
jrandom's avatar
jrandom committed
    </target>
zzz's avatar
zzz committed

    <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>
zzz's avatar
zzz committed

    <!-- jbigi.jar -->
    <target name="prepjbigiupdate" depends="jbigi">
        <copy file="build/jbigi.jar" todir="pkg-temp/lib/" />
    </target>

zzz's avatar
zzz committed
    <!-- GeoIP files and flag icons -->
    <target name="prepgeoupdate">
zzz's avatar
zzz committed
        <copy file="installer/resources/geoip.txt" todir="pkg-temp/geoip/" />
zzz's avatar
zzz committed
        <copy file="installer/resources/geoipv6.dat.gz" todir="pkg-temp/geoip/" />
zzz's avatar
zzz committed
        <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

    <!-- All jetty jars required for update.
         We don't need commons-el or commons-logging, they haven't changed.
         TODO do we need to bother updating jasper?
         TODO where is JMX? We don't need it I hope.
      -->
zzz's avatar
zzz committed
    <target name="prepjupdate" depends="prepupdate, buildWEB">
zzz's avatar
zzz committed
        <copy todir="pkg-temp/lib" >
zzz's avatar
zzz committed
            <fileset dir="build" includes="commons*.jar jasper*.jar javax*.jar jetty*.jar jsp*.jar org.mortbay.*.jar" />
zzz's avatar
zzz committed
        </copy>
zzz's avatar
zzz committed
        <!--  We have to package the new eepsite files for MigrateJetty.java, but we
              can't overwrite an existing eepsite dir in a non-split configuration.
          -->
zzz's avatar
zzz committed
        <copy todir="pkg-temp/eepsite-jetty7" >
            <fileset dir="installer/resources/eepsite" includes="*.xml contexts/* etc/*" />
zzz's avatar
zzz committed
    </target>
zzz's avatar
zzz committed
    <target name="delete-j6-update">
zzz's avatar
zzz committed
        <delete dir="pkg-temp/eepsite-jetty7" />
zzz's avatar
zzz committed
    </target>

zzz's avatar
zzz committed
    <!-- Jetty 6 I2P logging addons, not really fixes -->
    <target name="prepjupdatefixes" depends="buildWEB">
zzz's avatar
zzz committed
        <copy file="build/jetty-i2p.jar" todir="pkg-temp/lib/" />

    <target name="util-list-changes" depends="checkForMtn" if="mtn.available" >
zzz's avatar
zzz committed
        <exec executable="mtn" outputproperty="workspace.changes.util" errorproperty="mtn.error.util" failifexecutionfails="false" >
            <arg value="list" />
            <arg value="changed" />
            <arg value="core/java/src/net/i2p/util" />
        </exec>
        <!-- \n in an attribute value generates an invalid manifest -->
        <exec executable="tr" inputstring="${workspace.changes.util}" outputproperty="workspace.changes.util.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
            <arg value="-s" />
            <arg value="[:space:]" />
            <arg value="," />
        </exec>
    <target name="izpack-patches" >
kytv's avatar
kytv committed
            <taskdef name="izpack"
                     classpath="${basedir}/installer/lib/izpack/patches.jar:${basedir}/installer/lib/izpack/standalone-compiler.jar"
                     classname="com.izforge.izpack.ant.IzPackTask" />
        <jar destfile="${basedir}/installer/lib/izpack/patches.jar"
             basedir="${basedir}/installer/lib/izpack/patches" />
    </target>

    <target name="buildUtilityJar" depends="buildCore">
        <ant dir="installer/java" target="build" />
    <target name="installer" depends="preppkg, buildProperties, util-list-changes, izpack-patches, buildUtilityJar" >
        <!--
          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>
zzz's avatar
zzz committed
    <!-- this makes i2pinstall.exe from install.jar -->
    <target name="installerexe" depends="launch4j" unless="noExe">
kytv's avatar
kytv committed
        <echo message="See the file &quot;build.properties&quot; if this step fails." />
        <!-- now the installer exe -->
jrandom's avatar
jrandom committed
        <launch4j configFile="./installer/i2pinstaller.xml" />
zzz's avatar
zzz committed

zzz's avatar
zzz committed
    <target name="installer-nowindows" depends="clean, preppkg-nowindows, izpack-patches" >
kytv's avatar
kytv committed
        <fixcrlf srcdir="pkg-temp" includes="*.config **/*.xml **/*.properties **/*.txt scripts/*" encoding="utf8" eol="lf" />
        <izpack input="${basedir}/installer/install.xml" output="${basedir}/i2pinstall_${full.version}.jar" installerType="standard" basedir="${basedir}" />
zzz's avatar
zzz committed
    <target name="installer-freebsd" depends="clean, preppkg-freebsd-only, izpack-patches" >
kytv's avatar
kytv committed
        <fixcrlf srcdir="pkg-temp" includes="*.config **/*.xml **/*.properties **/*.txt scripts/*" encoding="utf8" eol="lf" />
        <izpack input="${basedir}/installer/install.xml" output="${basedir}/i2pinstall_${full.version}_freebsd-only.jar" installerType="standard" basedir="${basedir}" />
zzz's avatar
zzz committed
    <target name="installer-linux" depends="clean, preppkg-linux-only, izpack-patches" >
kytv's avatar
kytv committed
        <fixcrlf srcdir="pkg-temp" includes="*.config **/*.xml **/*.properties **/*.txt scripts/*" encoding="utf8" eol="lf" />
        <izpack input="${basedir}/installer/install.xml" output="${basedir}/i2pinstall_${full.version}_linux-only.jar" installerType="standard" basedir="${basedir}" />
zzz's avatar
zzz committed
    <target name="installer-osx" depends="clean, checkForIzpack2App, preppkg-osx-only, izpack-patches">
kytv's avatar
kytv committed
        <fixcrlf srcdir="pkg-temp" includes="*.config **/*.xml **/*.properties **/*.txt scripts/*" encoding="utf8" eol="lf" />
        <mkdir dir="pkg-temp/osx" />
        <izpack input="${basedir}/installer/install.xml" output="${basedir}/i2pinstall_${full.version}_osx-only.jar" installerType="standard" basedir="${basedir}" />
        <ant target="installer2app" />
        <delete dir="pkg-temp/osx" />
    </target>

    <target name="checkForIzpack2App">
        <!-- we'll set the izpack2app binary name if it's not been set elsewhere yet -->
        <property name="izpack2app.binary" value="${user.home}/IzPack/utils/wrappers/izpack2app/izpack2app.py" />
        <available property="izpack2app.available" file="${izpack2app.binary}" />
    </target>

    <target name="installer2app" if="izpack2app.available">
        <mkdir dir="pkg-temp/osx" />
        <exec executable="python" failonerror="true">
            <arg value="${izpack2app.binary}" />
            <arg value="${basedir}/i2pinstall_${full.version}_osx-only.jar" />
            <arg value="${basedir}/pkg-temp/osx/i2p-${full.version}_osx-install.app" />
        </exec>

        <tar longfile="gnu" destfile="${basedir}/i2pinstall_${full.version}_osx.tar.bz2" compression="bzip2">
            <tarfileset dir="${basedir}/pkg-temp/osx/i2p-${full.version}_osx-install.app" prefix="/i2p-${full.version}_osx-install.app" filemode="644">
                <include name="**/**" />
                <exclude name="Contents/MacOS/*" />
            </tarfileset>
            <tarfileset dir="${basedir}/pkg-temp/osx/i2p-${full.version}_osx-install.app" prefix="/i2p-${full.version}_osx-install.app" filemode="755">
                <include name="Contents/MacOS/*" />
            </tarfileset>
        </tar>
zzz's avatar
zzz committed
    <!-- call between installer-xxx and installer-windows -->
    <target name="delete-nonwindows">
        <delete dir="pkg-temp/lib/wrapper/" />
        <delete dir="pkg-temp/locale/" />
        <delete dir="pkg-temp/man/" />
        <delete dir="pkg-temp/Start I2P Router.app/" />
        <delete dir="pkg-temp" includes="eepget i2prouter INSTALL-headless.txt osid postinstall.sh runplain.sh" />
    </target>

    <target name="installer-windows" depends="clean, preppkg-windows-only, util-list-changes, izpack-patches, buildUtilityJar" >
kytv's avatar
kytv committed
        <fixcrlf srcdir="pkg-temp" includes="*.config *.bat *.cmd **/*.xml **/*.properties **/*.txt scripts/*" encoding="utf8" eol="crlf"/>
        <izpack input="${basedir}/installer/install.xml" output="${basedir}/install.jar" installerType="standard" basedir="${basedir}" />
zzz's avatar
zzz committed
        <ant target="installerexe" />
        <delete file="${basedir}/install.jar" />
        <move file="${basedir}/i2pinstall.exe" tofile="${basedir}/i2pinstall_${full.version}_windows-only.exe" />
zzz's avatar
zzz committed
    <!-- this is broken as installer-xxx targets may delete (or not delete) things in pkg-temp -->
    <target name="installer-all" depends="installer-freebsd, installer-linux, installer-osx, installer-windows, installer-nowindows, installer" >
    </target>
    <!-- end custom installers -->
kytv's avatar
kytv committed

    <target name="buildTest">
        <ant dir="core/java/" target="jarTest" />
        <ant dir="router/java/" target="jarTest" />
        <copy file="core/java/build/i2ptest.jar" todir="build" />
        <copy file="router/java/build/routertest.jar" todir="build" />
    <target name="prepTest" depends="prepupdate, buildTest">
        <!-- overwrite i2p.jar and router.jar with the test versions -->
        <copy file="build/i2ptest.jar" tofile="pkg-temp/lib/i2p.jar" overwrite="true" />
        <copy file="build/routertest.jar" tofile="pkg-temp/lib/router.jar" overwrite="true" />
    <target name="updateTest" depends="prepTest, zipit" />
    <target name="junit.test" depends="buildProperties, jbigi" >
        <ant dir="core/java/" target="junit.test" />
        <ant dir="router/java/" target="junit.test" />
        <ant dir="apps/streaming/java/" target="junit.test" />
    </target>
    <target name="scalatest.test" depends="buildProperties, jbigi" >
        <ant dir="core/java/" target="scalatest.test" />
        <!-- note there are no router scala tests yet -->
        <ant dir="router/java/" target="scalatest.test" />
    </target>
    <target name="test" depends="buildProperties, jbigi" >
        <!-- both junit and scala -->
comwiz's avatar
comwiz committed
        <ant dir="core/java/" target="test" />
        <ant dir="router/java/" target="test" />
        <ant dir="apps/streaming/java/" target="test" />
comwiz's avatar
comwiz committed
    </target>
    <target name="scalatest.report" depends="buildProperties" >
        <ant dir="core/java/" target="scalatest.report" />
        <ant dir="router/java/" target="scalatest.report" />
    </target>
zzz's avatar
zzz committed
    <target name="junit.report" depends="buildProperties" >
comwiz's avatar
comwiz committed
        <ant dir="core/java/" target="junit.report" />
        <ant dir="router/java/" target="junit.report" />
        <ant dir="apps/streaming/java/" target="junit.report" />
comwiz's avatar
comwiz committed
    </target>
    <target name="clover.report" depends="buildProperties" if="with.clover">
comwiz's avatar
comwiz committed
        <ant dir="core/java/" target="clover.report" />
        <ant dir="router/java/" target="clover.report" />
	<ant dir="apps/streaming/java" target="clover.report" />
comwiz's avatar
comwiz committed
    </target>
    <target name="cobertura.report" depends="buildProperties" if="with.cobertura">
        <ant dir="core/java/" target="cobertura.report" />
        <ant dir="router/java/" target="cobertura.report" />
	<ant dir="apps/streaming/java" target="cobertura.report" />
    <target name="test.report" depends="junit.report, scalatest.report, clover.report, cobertura.report"/>
    <target name="fulltest" depends="buildProperties, jbigi" >
        <ant dir="core/java/" target="fulltest" />
        <ant dir="router/java/" target="fulltest" />
kytv's avatar
kytv committed
        <ant dir="apps/streaming/java" target="fulltest" />
comwiz's avatar
comwiz committed
    </target>
    <target name="jenkins.cobertura.report" depends="cobertura.report">
        <!--
             The jenkins cobertura plugin couldn't find the source files.
         -->
        <replaceregexp byline="true" file="reports/core/cobertura/coverage.xml"
            match='filename="net' replace='filename="core/java/src/net'/>
        <replaceregexp byline="true" file="reports/core/cobertura/coverage.xml"
            match="&lt;source&gt;./src" replace='&lt;source&gt;./core/java/src'/>
        <replaceregexp byline="true" file="reports/router/cobertura/coverage.xml"
            match='filename="net' replace='filename="router/java/src/net'/>
        <replaceregexp byline="true" file="reports/router/cobertura/coverage.xml"
            match="&lt;source&gt;./src" replace="&lt;source&gt;router/java/src"/>
        <replaceregexp byline="true" file="reports/streaming/cobertura/coverage.xml"
kytv's avatar
kytv committed
            match='filename="net' replace='filename="apps/streaming/java/src/net'/>
        <replaceregexp byline="true" file="reports/streaming/cobertura/coverage.xml"
kytv's avatar
kytv committed
            match="&lt;source&gt;./src" replace="&lt;source&gt;apps/streaming/java/src"/>
zzz's avatar
zzz committed

zzz's avatar
zzz committed
    <target name="testscripts" >
        <exec executable="tests/scripts/checkcerts.sh" failonerror="true" />
        <exec executable="tests/scripts/checkpo.sh" failonerror="true" />
        <exec executable="tests/scripts/checkutf8.sh" failonerror="true" />
        <exec executable="tests/scripts/checkxml.sh" failonerror="true" />
        <exec executable="tests/scripts/checkscripts.sh" failonerror="true" />
    <target name="testscripts-net" >
        <exec executable="tests/scripts/checkremotecerts.sh" failonerror="true" />
    </target>

    <target name="testscripts-all" depends="testscripts,testscripts-net" />

    <!-- <target name="syndie" >
jrandom's avatar
jrandom committed
        <ant dir="apps/syndie/java/" target="standalone" />
        <copy file="apps/syndie/java/syndie-standalone.zip" todir="." />
zzz's avatar
zzz committed
    <target name="i2psnark" depends="buildProperties" >
jrandom's avatar
jrandom committed
        <ant dir="apps/i2psnark/java" target="standalone" />
        <copy file="apps/i2psnark/java/i2psnark-standalone.zip" todir="." />
    </target>
    <target name="slackpkg">
        <ant dir="Slackware/i2p/" target="slackpkg" />
    </target>
    <target name="justBOB" depends="builddepSmall, jbigi">
        <ant dir="apps/BOB/" target="onejar" />
        <copy file="apps/BOB/dist/BOB-one.jar" todir="." />
    </target>
kytv's avatar
kytv committed

    <target name="sloccount.report">
        <property name="sloccount.report.file" value="sloccount.sc" />
        <echo message="Generating sloccount report (this will take awhile)" />
kytv's avatar
kytv committed
        <exec executable="sloccount" failonerror="true">
            <arg value="--details"/>
            <arg value="--wide"/>
            <redirector output="${sloccount.report.file}">
kytv's avatar
kytv committed
                <outputfilterchain>
                    <linecontainsregexp negate="true">
                        <regexp pattern="(Warning: |lib/launch4j|_MTN|reports|pkg-temp|licenses|i2p\.fba|gmp-|WEB-INF)" />
kytv's avatar
kytv committed
                    </linecontainsregexp>
                    <linecontains negate="true">
                        <contains value="${sloccount.report.file}" />
                    </linecontains>
kytv's avatar
kytv committed
                </outputfilterchain>
            </redirector>
        </exec>
        <echo message="sloccount report saved to the file &quot;${sloccount.report.file}&quot;" />
kytv's avatar
kytv committed
    </target>

    <target name="findbugs" depends="build2, buildUtilityJar">
zzz's avatar
zzz committed
        <echo message="Starting findbugs, this will take a while..." />
zzz's avatar
zzz committed
        <exec executable="nice" failonerror="true">
zzz's avatar
zzz committed
            <arg value="findbugs"/>
            <arg value="-textui"/>
            <arg value="-projectName"/>
            <arg value="i2p"/>
            <arg value="-sortByClass"/>
            <arg value="-xml"/>
            <arg value="-output"/>
zzz's avatar
zzz committed
            <arg value="i2p.fba"/>
zzz's avatar
zzz committed
            <arg value="-auxclasspath"/>
            <arg value="build/commons-el.jar:build/commons-logging.jar:build/jasper-runtime.jar:build/javax.servlet.jar:build/org.mortbay.jetty.jar:apps/jrobin/jrobin-1.5.9.1.jar:apps/systray/java/lib/systray4j.jar:installer/lib/wrapper/all/wrapper.jar:apps/susidns/src/WEB-INF/lib/standard.jar:apps/susidns/src/WEB-INF/lib/jstl.jar:apps/jrobin/jrobin-1.5.9.1.jar"/>
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/:installer/java/src"/>
zzz's avatar
zzz committed
            <!-- 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"/>
zzz's avatar
zzz committed
            <arg value="build/jetty-i2p.jar"/>
zzz's avatar
zzz committed
            <arg value="build/mstreaming.jar"/>
            <arg value="build/router.jar/"/>
            <arg value="build/desktopgui.jar"/>
zzz's avatar
zzz committed
            <arg value="build/routerconsole.jar"/>
            <arg value="build/routerconsole.war"/>
zzz's avatar
zzz committed
            <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"/>
            <arg value="build/utility.jar"/>
zzz's avatar
zzz committed
        </exec>
zzz's avatar
zzz committed
        <echo message="Findbugs output stored in i2p.fba" />
        <echo message="Now run: findbugs i2p.fba" />
zzz's avatar
zzz committed
    </target>

    <!-- this is the same dependency as pkg, but with updater200 in the middle,
         since preppkg puts too much stuff in pkg-temp -->
zzz's avatar
zzz committed
    <target name="release" depends="distclean, updaterWithJettyFixesAndJbigi , updater200WithJettyFixes, preppkg, installer, getReleaseNumber" >
zzz's avatar
zzz committed
-->
    <target name="release" depends="verifyReleaseBuildNumbers, -pre-release, distclean, testscripts, updaterWithJettyRepack, updater200WithJetty, delete-j6-update, installer-nowindows, delete-nonwindows, installer-windows" >
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" />
zzz's avatar
zzz committed
        <copy file="i2pinstall_${full.version}_windows-only.exe" tofile="i2pinstall_${release.number}_windows.exe" />
        <copy file="i2pinstall_${full.version}.jar" tofile="i2pinstall_${release.number}.jar" />
zzz's avatar
zzz committed
        <delete file="i2pupdate.sud" />
        <delete file="i2pupdate.su2" />
        <!-- make this a lot easier by putting release.privkey=/path/to/privkey in override.properties -->
zzz's avatar
zzz committed
        <input message="Enter private signing key file:" addproperty="release.privkey" />
zzz's avatar
zzz committed
        <fail message="You must enter an existing file path." >
zzz's avatar
zzz committed
            <condition>
zzz's avatar
zzz committed
                <or>
                    <equals arg1="${release.privkey}" arg2=""/>
                    <not>
                        <length file="${release.privkey}" when="greater" length="0" />
                    </not>
                </or>
zzz's avatar
zzz committed
            </condition>
        </fail>
zzz's avatar
zzz committed
        <echo message="Key file is ${release.privkey}" />
zzz's avatar
zzz committed
        <!-- now build and verify the unpacked sud from the unpacked zip -->
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>
zzz's avatar
zzz committed
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="verifyversion" />
            <arg value="i2pupdate.sud" />
        </java>
zzz's avatar
zzz committed
        <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>
zzz's avatar
zzz committed
        <!-- now build and verify the packed su2 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>
zzz's avatar
zzz committed
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="verifyversion" />
            <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
        <!-- now build and verify the packed su3 from the packed zip -->
        <input message="Enter su3 private signing key store:" addproperty="release.privkey.su3" />
zzz's avatar
zzz committed
        <fail message="You must enter an existing file path." >
zzz's avatar
zzz committed
            <condition>
zzz's avatar
zzz committed
                <or>
                    <equals arg1="${release.privkey.su3}" arg2=""/>
                    <not>
                        <length file="${release.privkey.su3}" when="greater" length="0" />
                    </not>
                </or>
zzz's avatar
zzz committed
            </condition>
        </fail>
        <input message="Enter key name (you@mail.i2p):" addproperty="release.signer.su3" />
        <fail message="You must enter a name." >
            <condition>
                <equals arg1="${release.signer.su3}" arg2=""/>
            </condition>
        </fail>
        <input message="Enter key password for ${release.signer.su3}:" addproperty="release.password.su3" />
        <fail message="You must enter a password." >
            <condition>
                <equals arg1="${release.password.su3}" arg2=""/>
            </condition>
        </fail>
        <java classname="net.i2p.crypto.SU3File" inputstring="${release.password.su3}" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="sign" />
            <arg value="-c" />
            <arg value="ROUTER" />
            <arg value="-t" />
            <arg value="RSA_SHA512_4096" />
            <arg value="i2pupdate200.zip" />
            <arg value="i2pupdate.su3" />
            <arg value="${release.privkey.su3}" />
            <arg value="${release.number}" />
            <arg value="${release.signer.su3}" />
        </java>
        <echo message="Verify version and VALID signature:" />
        <java classname="net.i2p.crypto.SU3File" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <!-- set base dir so it can find the pubkey cert -->
            <jvmarg value="-Di2p.dir.base=installer/resources" />
            <arg value="verifysig" />
            <arg value="i2pupdate.su3" />
        </java>
        <java classname="net.i2p.crypto.SU3File" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <!-- set base dir so it can find the pubkey cert -->
            <jvmarg value="-Di2p.dir.base=installer/resources" />
            <arg value="showversion" />
            <arg value="i2pupdate.su3" />
        </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" />
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
        <input message="Enter GPG key ID (e.g. 0x12345678) for signing:" addproperty="release.gpg.keyid" />
        <fail message="You must enter a key ID." >
            <condition>
                <equals arg1="${release.gpg.keyid}" arg2=""/>
            </condition>
        </fail>
zzz's avatar
zzz committed
        <delete file="i2pinstall_${release.number}_windows.exe.sig" />
        <delete file="i2pinstall_${release.number}.jar.sig" />
zzz's avatar
zzz committed
        <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="--default-key" />
            <arg value="${release.gpg.keyid}" />
zzz's avatar
zzz committed
            <arg value="-b" />
zzz's avatar
zzz committed
            <arg value="i2pinstall_${release.number}_windows.exe" />
zzz's avatar
zzz committed
        </exec>
        <exec executable="gpg" failonerror="true">
zzz's avatar
zzz committed
            <arg value="--default-key" />
            <arg value="${release.gpg.keyid}" />
            <arg value="-b" />
            <arg value="i2pinstall_${release.number}.jar" />
        </exec>
zzz's avatar
zzz committed
        <exec executable="gpg" failonerror="true">
zzz's avatar
zzz committed
            <arg value="--default-key" />
            <arg value="${release.gpg.keyid}" />
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="--default-key" />
            <arg value="${release.gpg.keyid}" />
zzz's avatar
zzz committed
            <arg value="-b" />
            <arg value="i2pupdate_${release.number}.zip" />
        </exec>
zzz's avatar
zzz committed
        <exec executable="chmod" failonerror="true">
            <arg value="444" />
zzz's avatar
zzz committed
            <arg value="i2pinstall_${release.number}_windows.exe" />
            <arg value="i2pinstall_${release.number}.jar" />
zzz's avatar
zzz committed
            <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.su3" />
zzz's avatar
zzz committed
            <arg value="i2pupdate.sud" />
zzz's avatar
zzz committed
            <arg value="i2pinstall_${release.number}_windows.exe.sig" />
            <arg value="i2pinstall_${release.number}.jar.sig" />
zzz's avatar
zzz committed
            <arg value="i2psource_${release.number}.tar.bz2.sig" />
            <arg value="i2pupdate_${release.number}.zip.sig" />
        </exec>
zzz's avatar
zzz committed
        <echo message="File sizes:" />
zzz's avatar
zzz committed
        <exec executable="ls" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-l" />
zzz's avatar
zzz committed
            <arg value="i2pinstall_${release.number}_windows.exe" />
            <arg value="i2pinstall_${release.number}.jar" />
zzz's avatar
zzz committed
            <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.su3" />
zzz's avatar
zzz committed
            <arg value="i2pupdate.sud" />
zzz's avatar
zzz committed
            <arg value="i2pinstall_${release.number}_windows.exe.sig" />
            <arg value="i2pinstall_${release.number}.jar.sig" />
zzz's avatar
zzz committed
            <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}_windows.exe" />
            <arg value="i2pinstall_${release.number}.jar" />
zzz's avatar
zzz committed
            <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.su3" />
zzz's avatar
zzz committed
            <arg value="i2pupdate.sud" />
        </exec>
        <!-- make torrent files -->
        <copy file="i2pupdate.sud" tofile="i2pupdate-${release.number}.sud" />
        <java classname="org.klomp.snark.Storage" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
                <pathelement location="build/i2psnark.jar" />
            </classpath>
zzz's avatar
zzz committed
            <arg value="i2pupdate-${release.number}.sud" />
zzz's avatar
zzz committed
            <arg value="http://tracker2.postman.i2p/announce.php" />
        <copy file="i2pupdate.su2" tofile="i2pupdate-${release.number}.su2" />
        <java classname="org.klomp.snark.Storage" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
                <pathelement location="build/i2psnark.jar" />
            </classpath>
zzz's avatar
zzz committed
            <arg value="i2pupdate-${release.number}.su2" />
zzz's avatar
zzz committed
            <arg value="http://tracker2.postman.i2p/announce.php" />
zzz's avatar
zzz committed
        <copy file="i2pupdate.su3" tofile="i2pupdate-${release.number}.su3" />
        <java classname="org.klomp.snark.Storage" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
                <pathelement location="build/i2psnark.jar" />
            </classpath>
            <arg value="i2pupdate-${release.number}.su3" />
            <arg value="http://tracker2.postman.i2p/announce.php" />
        </java>
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>
kytv's avatar
kytv committed
    <target name="debian" depends="debian-clean, debchange, debian-binary" />
kytv's avatar
kytv committed
    <target name="getExtendedVersion" depends="buildProperties, trimMtnRev">
        <property name="MtnShortHash" value="unknown" />
        <condition property="Extended.Version" value="${full.version}-${MtnShortHash}">
            <not>
                <or>
                    <equals arg1="${MtnShortHash}" arg2="" />
                    <equals arg1="${MtnShortHash}" arg2="unknown" />
                </or>
            </not>
        </condition>
        <!-- if not set above we'll set it here -->
        <property name="Extended.Version" value="${full.version}" />
    </target>

    <target name="debchange" depends="getExtendedVersion" unless="noAutoDebchange">
        <echo message= "Debian version is ${Extended.Version}-1" />
        <exec executable="dch" failonerror="true">
            <arg value="-b" />
            <arg value="--check-dirname-level" />
            <arg value="0" />
            <arg value="-v" />
            <arg value="${Extended.Version}-1" />
            <arg value="Unofficial Debian package built using &quot;ant debian&quot;" />
kytv's avatar
kytv committed
    </target>
kytv's avatar
kytv committed
    <target name="debian-binary" depends="getExtendedVersion">
        <exec executable="fakeroot" failonerror="true">
            <arg value="debian/rules" />
            <arg value="patch" />
            <arg value="binary" />
            <arg value="clean" />
kytv's avatar
kytv committed
        <move todir=".">
            <fileset dir=".." includes="libjbigi*${release.number}*.deb i2p*${release.number}*.deb" />
kytv's avatar
kytv committed
        </move>
        <echo message="" />
        <echo message="====================" />
        <echo message="Packages have been built and moved to ${basedir}" />
        <echo message="====================" />
kytv's avatar
kytv committed
    </target>
kytv's avatar
kytv committed
    <target name="debian-clean" depends="getExtendedVersion" >
kytv's avatar
kytv committed
        <exec executable="fakeroot" failonerror="true">
            <arg value="debian/rules" />
            <arg value="clean" />
kytv's avatar
kytv committed
    <target name="debian-tarball" depends="getExtendedVersion">
        <!-- will this use the monotonerc file in the current workspace? -->
        <fail message="This target cannot be used without Monotone! Use &quot;fakeroot debian/rules get-orig-source&quot; instead.">
            <condition>
                <not>
                    <isset property="mtn.available" />
                </not>
            </condition>
        </fail>
        <property name="debian.tarball.name" value="i2p_${Extended.Version}.orig.tar.bz2" />
        <echo message="Checking out fresh copy into ../i2p-${Extended.Version} for tarballing:" />
        <delete dir="../i2p-${Extended.Version}" />
        <exec executable="mtn" failonerror="true">
            <arg value="co" />
            <arg value="-b" />
            <arg value="i2p.i2p" />
            <!-- w: is the revision of the current workspace -->
            <arg value="-r" />
            <arg value="w:" />
            <arg value="../i2p-${Extended.Version}" />
        </exec>
        <delete includeemptydirs="true" quiet="false">
            <fileset dir="../i2p-${Extended.Version}/installer/lib/" />
            <fileset dir="../i2p-${Extended.Version}/Slackware" />
            <fileset dir="../i2p-${Extended.Version}/_MTN" />
        </delete>
        <tar longfile="gnu" destfile="../${debian.tarball.name}" compression="bzip2">
            <tarfileset dir="../i2p-${Extended.Version}" prefix="/i2p-${Extended.Version}">
                <include name="**/**" />
                <exclude name="debian/**"/>
                <exclude name="**/*.sh"/>
            </tarfileset>
            <tarfileset dir="../i2p-${Extended.Version}" prefix="/i2p-${Extended.Version}" filemode="755">
                <exclude name="debian/**" />
                <include name="**/*.sh" />
kytv's avatar
kytv committed
            </tarfileset>
        </tar>
    </target>

    <target name="debian-patch" depends="getExtendedVersion" >
kytv's avatar
kytv committed
        <exec executable="quilt" failonerror="true">
            <arg value="-a" />
            <arg value="push" />
        </exec>
        <echo message="====================" />
kytv's avatar
kytv committed
    </target>
    <target name="debian-unpatch" depends="buildProperties">
        <exec executable="quilt" failonerror="false">
            <arg value="-a" />
            <arg value="pop" />
        </exec>
    </target>
kytv's avatar
kytv committed

HungryHobo's avatar
HungryHobo committed
    <target name="debianrepo" depends="debian">
        <exec dir="debian" executable="./makerepo.sh" failonerror="true"/>
HungryHobo's avatar
HungryHobo committed
    </target>
kytv's avatar
kytv committed
<!-- 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 -->
kytv's avatar
kytv committed
<!-- *0* Since we simply pack all files in folder "build/" into our archieve,
walking's avatar
walking committed
		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 -->
	<target name="preppkg-portable-win32-jbigi" depends="buildSmallOnly, jbigi-windows-only" />

	<target name="preppkg-portable-linux-jbigi"  depends="buildSmallOnly, jbigi-linux-only" />
walking's avatar
walking committed

<!-- *2* os independent procedure  -->
	<target name="preppkg-portable-basic" >
walking's avatar
walking committed
		<mkdir dir="pkg-temp" />
			<!-- non OS dependent configurations only, dont add *nux/win stuff here -->
walking's avatar
walking committed
			<copy todir="pkg-temp">
				<fileset dir="installer/resources/portable/configs/" />
			</copy>
walking's avatar
walking committed
			<copy file="installer/resources/blocklist.txt" todir="pkg-temp/" />
			<copy file="installer/resources/hosts.txt" todir="pkg-temp/" />
			<copy file="installer/resources/readme.license.txt" todir="pkg-temp/" />
		<mkdir dir="pkg-temp/addressbook" />
			<copy file="apps/addressbook/subscriptions.txt" todir="pkg-temp/addressbook/" />
			<copy file="apps/addressbook/myhosts.txt"  todir="pkg-temp/addressbook/" />
			<!-- config.txt is in installer/resources/portable -->
walking's avatar
walking committed
		<mkdir dir="pkg-temp/docs" />
			<copy file="installer/resources/initialNews/initialNews.xml" tofile="pkg-temp/docs/news.xml" overwrite="true" />
walking's avatar
walking committed
			<copy file="installer/resources/readme/readme.html" tofile="pkg-temp/docs/readme.html" />
			<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/" />
			<!-- HTTP Header files, english only,
				if you need a different lang do it in a seperate target -->
walking's avatar
walking committed
			<copy todir="pkg-temp/docs/" >
				<fileset dir="installer/resources/proxy/"  includes="**-header.ht" />
			</copy>
walking's avatar
walking committed
			<!-- Theme light only -->
			<copy todir="pkg-temp/docs/themes/console/light/" overwrite="true" >
				<fileset dir="installer/resources/themes/console/light/" includes="**.css" />
			</copy>
			<copy file="installer/resources/themes/console/light/console_big.css" todir="portable/docs/themes/console/light/" />
walking's avatar
walking committed
			<copy todir="pkg-temp/docs/themes/console/images/" >
				<fileset dir="installer/resources/themes/console/images/" />
			</copy>
walking's avatar
walking committed
			<!-- FLAGs for language icon (not for ip)-->
			<copy todir="pkg-temp/docs/icons/flags" >
				<fileset dir="installer/resources/icons/flags/" includes="cn.png,de.png,fr.png,nl.png,ru.png,se.png,us.png" />
			</copy>
walking's avatar
walking committed
		<mkdir dir="pkg-temp/webapps" />
			<copy todir="pkg-temp/webapps/">
				<fileset dir="build/" includes="**.war" />
			</copy>
walking's avatar
walking committed
		<mkdir dir="pkg-temp/lib" />
			<copy todir ="pkg-temp/lib/" >
				<fileset dir="build/" includes="**.jar" />
			</copy>
			<!-- 3rd party jars from apps/  -->
				<!-- jrobin - without jobin , you lost graph and get a lot error entry in logs -->
zzz's avatar
zzz committed
			<copy file="build/jrobin.jar" tofile="pkg-temp/lib/jrobin.jar" />
	</target>
<!-- *3* os dependent procedure/commands -->
walking's avatar
walking committed
	<target name = "preppkg-portable-win32" depends="preppkg-portable-win32-jbigi,preppkg-portable-basic">
			<!-- systray4.j  - why do we need trayicons for portable version ? dependency hardcoded in console -->
walking's avatar
walking committed
		<copy file="apps/systray/java/lib/systray4j.dll" todir="pkg-temp/lib" />
		<copy file="apps/systray/java/lib/systray4j.jar" todir="pkg-temp/lib" />
			<!--wrapper - dont even think about it. i2p cosumes appreantly more mem without it on win32-->
walking's avatar
walking committed
		<copy file="installer/lib/wrapper/win32/wrapper.dll" todir="pkg-temp/lib" />
		<copy file="installer/lib/wrapper/all/wrapper.jar" todir="pkg-temp/lib" />
walking's avatar
walking committed
		<copy file="installer/lib/wrapper/win32/I2Psvc.exe" tofile="pkg-temp/i2psvc.ex_" />
			<!--  copy the unpack/start batchfiles -->
		<copy todir="pkg-temp">
			<fileset dir="installer/resources/portable/win32/" />
		</copy>
	</target>
walking's avatar
walking committed
<!-- *4* command for windows package -->
	<target name = "pkg-portable-win32"	depends="preppkg-portable-win32, pack200" >
		<!-- i need the portable\ folder in .zip so basedir is set to . -->
		<move file="pkg-temp" tofile="portable"/>
		<zip destfile="portable-win32.zip" basedir="." level="9" includes="portable\**" />
		<checksum file="portable-win32.zip" forceOverwrite="yes"/>
		<move file="portable" tofile="pkg-temp"/>
	</target>
</project>