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

Skip to content
Snippets Groups Projects
build.xml 85.2 KiB
Newer Older
        </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>
jrandom's avatar
jrandom committed
    <target name="updateTest" depends="prepupdate">
kytv's avatar
kytv committed
        <ant dir="core/java/" target="jarTest" />
jrandom's avatar
jrandom committed
        <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, 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 -->
        <exec executable="head" osfamily="unix" failifexecutionfails="true" output="pkg-temp/history.txt">
            <arg value="-n" />
            <arg value="1500" />
            <arg value="history.txt" />
        </exec>
        <exec executable="echo" osfamily="unix" failifexecutionfails="true" output="pkg-temp/history.txt" append="true">
zzz's avatar
zzz committed
            <arg value="&#10;&#10;----------------&#10;&#10;EARLIER HISTORY IS AVAILABLE IN THE SOURCE PACKAGE" />
zzz's avatar
zzz committed
        </exec>
        <copy file="installer/resources/deletelist.txt" todir="pkg-temp/" />
zzz's avatar
zzz committed
      <!-- May be pointless now, people with split directories will never see this,
           and for flat installs we don't want to overwrite news more recent than the update package.
        <copy file="installer/resources/news.xml" todir="pkg-temp/docs/" />
zzz's avatar
zzz committed
       -->
zzz's avatar
zzz committed

    <target name="prepupdateSmall" depends="buildSmall, prepupdateRouter, prepthemeupdates">
jrandom's avatar
jrandom committed
        <copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
        <copy file="build/mstreaming.jar" todir="pkg-temp/lib/" />
jrandom's avatar
jrandom committed
        <copy file="build/streaming.jar" todir="pkg-temp/lib/" />
jrandom's avatar
jrandom committed
        <copy file="build/routerconsole.jar" todir="pkg-temp/lib/" />
        <!-- pulled out of routerconsole.jar in 0.7.12, someday we can take out of updater -->
        <!-- name without version so we can overwrite if we upgrade  -->
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 -->
walking's avatar
walking committed
       <copy file="installer/resources/countries.txt" 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/" />
        <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.
          -->
        <copy todir="pkg-temp/eepsite-jetty6" >
            <fileset dir="installer/resources/eepsite" includes="*.xml contexts/* etc/*" />
zzz's avatar
zzz committed
    </target>
zzz's avatar
zzz committed
    <!-- Jetty 6 I2P logging addons, not really fixes -->
    <target name="prepjupdatefixes" depends="prepupdate, 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>
    <taskdef name="izpack"
             classpath="${basedir}/installer/lib/izpack/patches.jar:${basedir}/installer/lib/izpack/standalone-compiler.jar"
             classname="com.izforge.izpack.ant.IzPackTask" />

    <target name="izpack-patches" >
        <jar destfile="${basedir}/installer/lib/izpack/patches.jar"
             basedir="${basedir}/installer/lib/izpack/patches" />
    </target>

    <target name="installer" depends="preppkg, buildProperties, util-list-changes, izpack-patches" >
        <mkdir dir="pkg-temp/installer" />
        <!-- set if unset -->
        <property name="workspace.changes.util.tr" value="" />
zzz's avatar
zzz committed
        <jar destfile="./pkg-temp/installer/copy.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Copy.class net/i2p/util/FileUtil.class">
zzz's avatar
zzz committed
            <manifest>
                <attribute name="Main-Class" value="net.i2p.util.Copy" />
                <attribute name="Built-By" value="${build.built-by}" />
zzz's avatar
zzz committed
                <attribute name="Build-Date" value="${build.timestamp}" />
                <attribute name="Base-Revision" value="${workspace.version}" />
                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
            </manifest>
jrandom's avatar
jrandom committed
        </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">
zzz's avatar
zzz committed
            <manifest>
                <attribute name="Main-Class" value="net.i2p.util.Delete" />
                <attribute name="Built-By" value="${build.built-by}" />
zzz's avatar
zzz committed
                <attribute name="Build-Date" value="${build.timestamp}" />
                <attribute name="Base-Revision" value="${workspace.version}" />
                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
            </manifest>
jrandom's avatar
jrandom committed
        </jar>
zzz's avatar
zzz committed
        <jar destfile="./pkg-temp/installer/exec.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Exec.class">
zzz's avatar
zzz committed
            <manifest>
                <attribute name="Main-Class" value="net.i2p.util.Exec" />
                <attribute name="Built-By" value="${build.built-by}" />
zzz's avatar
zzz committed
                <attribute name="Build-Date" value="${build.timestamp}" />
                <attribute name="Base-Revision" value="${workspace.version}" />
                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
            </manifest>
jrandom's avatar
jrandom committed
        </jar>
        <!--
          Force 1.5 pack200 output
          Doesnt work!
          http://jira.codehaus.org/browse/IZPACK-404
          http://forums.sun.com/thread.jspa?threadID=773439
          http://bfo.co.uk/blog/2010/05/13/combining_ant_jar_signatures_and_pack200.html
        <property name="com.sun.java.util.jar.pack.package.majver" value="150" />
        <property name="com.sun.java.util.jar.pack.package.minver" value="7" />
        -->
        <izpack input="${basedir}/installer/install.xml" output="${basedir}/install.jar" installerType="standard" basedir="${basedir}" />
jrandom's avatar
jrandom committed

        <ant target="installerexe" />
    </target>
jrandom's avatar
jrandom committed
    <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>
zzz's avatar
zzz committed
    <!-- this makes i2pinstall.exe from install.jar -->
    <target name="doInstallerEXE" unless="noExe">
jrandom's avatar
jrandom committed
	<!-- now the installer exe -->
        <launch4j configFile="./installer/i2pinstaller.xml" />
	<!-- thazzit -->
zzz's avatar
zzz committed

zzz's avatar
zzz committed
    <target name="installer-nowindows" depends="clean, preppkg-nowindows, izpack-patches" >
	<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" >
	<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" >
	<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">
	<mkdir dir="pkg-temp/osx" />
zzz's avatar
zzz committed
	<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">
        <available property="izpack2app.available" file="${user.home}/IzPack/utils/wrappers/izpack2app/izpack2app.py" />
    </target>

    <target name="installer2app" if="izpack2app.available">
	<mkdir dir="pkg-temp/osx" />
	<exec executable="python" failonerror="true">
	    <arg value="${user.home}/IzPack/utils/wrappers/izpack2app/izpack2app.py" />
zzz's avatar
zzz committed
	    <arg value="${basedir}/i2pinstall_${full.version}_osx-only.jar" />
	    <arg value="${basedir}/pkg-temp/osx/i2p-${full.version}_osx-install.app" />
	<exec executable="chmod" failonerror="true" osfamily="unix">
		<arg value="755" />
zzz's avatar
zzz committed
		<arg value="${basedir}/pkg-temp/osx/i2p-${full.version}_osx-install.app/Contents/MacOS/JavaApplicationStub" />
	</exec>
	<exec executable="tar" osfamily="unix" failonerror="true">
		<arg value="--owner=root" />
		<arg value="--group=root" />
		<arg value="-cjvf" />
zzz's avatar
zzz committed
		<arg value="${basedir}/i2pinstall_${full.version}_osx.tar.bz2" />
		<arg value="-C" />
		<arg value="${basedir}/pkg-temp/osx" />
zzz's avatar
zzz committed
		<arg value="i2p-${full.version}_osx-install.app" />
	</exec>
zzz's avatar
zzz committed
    <target name="installer-windows" depends="clean, preppkg-windows-only, util-list-changes, izpack-patches" >
        <mkdir dir="pkg-temp/installer" />
        <!-- set if unset -->
        <property name="workspace.changes.util.tr" value="" />
        <jar destfile="./pkg-temp/installer/copy.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Copy.class net/i2p/util/FileUtil.class">
            <manifest>
                <attribute name="Main-Class" value="net.i2p.util.Copy" />
                <attribute name="Built-By" value="${build.built-by}" />
                <attribute name="Build-Date" value="${build.timestamp}" />
                <attribute name="Base-Revision" value="${workspace.version}" />
                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
            </manifest>
        </jar>
        <jar destfile="./pkg-temp/installer/delete.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Delete.class net/i2p/util/FileUtil.class">
            <manifest>
                <attribute name="Main-Class" value="net.i2p.util.Delete" />
                <attribute name="Built-By" value="${build.built-by}" />
                <attribute name="Build-Date" value="${build.timestamp}" />
                <attribute name="Base-Revision" value="${workspace.version}" />
                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
            </manifest>
        </jar>
        <jar destfile="./pkg-temp/installer/exec.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Exec.class">
            <manifest>
                <attribute name="Main-Class" value="net.i2p.util.Exec" />
                <attribute name="Built-By" value="${build.built-by}" />
                <attribute name="Build-Date" value="${build.timestamp}" />
                <attribute name="Base-Revision" value="${workspace.version}" />
                <attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
            </manifest>
        </jar>
zzz's avatar
zzz committed
	<izpack input="${basedir}/installer/install.xml" output="${basedir}/install.jar" installerType="standard" basedir="${basedir}" />
        <ant target="installerexe" />
        <delete file="${basedir}/install.jar" />
        <move file="${basedir}/i2pinstall.exe" tofile="${basedir}/i2pinstall_${full.version}_windows-only.exe" />
kytv's avatar
kytv committed
    <target name="installer-all" depends="installer-freebsd, installer-linux, installer-osx, installer-windows, installer" >
    </target>
    <!-- end custom installers -->
kytv's avatar
kytv committed

    <target name="test" depends="buildProperties, jbigi" >
        <mkdir dir="reports/core/junit/" />
comwiz's avatar
comwiz committed
        <ant dir="core/java/" target="test" />
    </target>
zzz's avatar
zzz committed
    <target name="junit.report" depends="buildProperties" >
comwiz's avatar
comwiz committed
        <ant dir="core/java/" target="junit.report" />
    </target>
zzz's avatar
zzz committed
    <target name="clover.report" depends="buildProperties" >
comwiz's avatar
comwiz committed
        <ant dir="core/java/" target="clover.report" />
    </target>
    <target name="test.report" depends="junit.report, clover.report"/>
zzz's avatar
zzz committed
    <target name="fulltest" depends="buildProperties" >
comwiz's avatar
comwiz committed
		<ant dir="core/java/" target="fulltest" />
comwiz's avatar
comwiz committed
		<ant dir="router/java/" target="fulltest" />
    </target>
zzz's avatar
zzz committed
    <target name="fullclovertest" depends="buildProperties" >
comwiz's avatar
comwiz committed
		<ant dir="core/java/" target="fullclovertest" />
		<ant dir="router/java/" target="fullclovertest" />
comwiz's avatar
comwiz committed
    </target>
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" />
    </target>


    <!-- <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">
        <echo message="Building Slackware package." />
        <ant dir="Slackware/i2p/" target="slackpkg" />
        <ant dir="Slackware/i2p-base/" target="slackpkg" />
    </target>
    <target name="justBOB" depends="builddepSmall">
        <ant dir="apps/BOB/" target="onejar" />
        <copy file="apps/BOB/dist/BOB-one.jar" todir="." />
    </target>
zzz's avatar
zzz committed
    <target name="findbugs" depends="build2">
        <echo message="Starting findbugs, this will take a while..." />
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-compiler.jar:build/jasper-runtime.jar:build/javax.servlet.jar:build/org.mortbay.jetty.jar:apps/jrobin/jrobin-1.5.9.1.jar:apps/systray/java/lib/systray4j.jar:installer/lib/wrapper/all/wrapper.jar:apps/susidns/src/WEB-INF/lib/standard.jar:apps/susidns/src/WEB-INF/lib/jstl.jar:apps/jrobin/jrobin-1.5.9.1.jar"/>
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/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"/>
        </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, distclean, testscripts, updaterRepack, updater200, preppkgRepack, installer" >
zzz's avatar
zzz committed
        <echo message="================================================================" />
        <echo message="Did you update these files?" />
zzz's avatar
zzz committed
        <exec executable="ls" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-l" />
            <arg value="history.txt" />
            <arg value="installer/install.xml" />
            <arg value="installer/resources/news.xml" />
zzz's avatar
zzz committed
	    <arg value="core/java/src/net/i2p/CoreVersion.java" />
	    <arg value="router/java/src/net/i2p/router/RouterVersion.java" />
        </exec>
zzz's avatar
zzz committed
        <echo message="Everything is checked in, right? Let's be sure:" />
zzz's avatar
zzz committed
        <exec executable="mtn" failonerror="true">
zzz's avatar
zzz committed
            <arg value="st" />
        </exec>
zzz's avatar
zzz committed
        <echo message="If there are any modified files above, stop now!" />
zzz's avatar
zzz committed

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" />
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" />
        <fail message="You must enter a path." >
            <condition>
                <equals arg1="${release.privkey}" arg2=""/>
            </condition>
        </fail>
zzz's avatar
zzz committed
        <echo message="Key file is ${release.privkey}" />
zzz's avatar
zzz committed
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="sign" />
            <arg value="i2pupdate.zip" />
            <arg value="i2pupdate.sud" />
            <arg value="${release.privkey}" />
            <arg value="${release.number}" />
        </java>
        <echo message="Verify version and VALID signature:" />
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="verifysig" />
            <arg value="i2pupdate.sud" />
        </java>
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>
        <!-- now build and verify the packed sud from the packed zip -->
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="sign" />
            <arg value="i2pupdate200.zip" />
            <arg value="i2pupdate.su2" />
            <arg value="${release.privkey}" />
            <arg value="${release.number}" />
        </java>
        <echo message="Verify version and VALID signature:" />
        <java classname="net.i2p.crypto.TrustedUpdate" fork="true" failonerror="true">
            <classpath>
                <pathelement location="build/i2p.jar" />
            </classpath>
            <arg value="verifysig" />
            <arg value="i2pupdate.su2" />
        </java>
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
        <!-- will this use the monotonerc file in the current workspace? -->
zzz's avatar
zzz committed
        <echo message="Checking out fresh copy into ../i2p-${release.number} for tarballing:" />
zzz's avatar
zzz committed
        <delete dir="../i2p-${release.number}" />
zzz's avatar
zzz committed
        <exec executable="mtn" failonerror="true">
zzz's avatar
zzz committed
            <arg value="co" />
            <arg value="-b" />
            <arg value="i2p.i2p" />
zzz's avatar
zzz committed
            <!-- w: is the revision of the current workspace -->
            <arg value="-r" />
            <arg value="w:" />
zzz's avatar
zzz committed
            <arg value="../i2p-${release.number}/" />
        </exec>
zzz's avatar
zzz committed
        <exec executable="tar" failonerror="true">
zzz's avatar
zzz committed
            <arg value="cjf" />
            <arg value="i2psource_${release.number}.tar.bz2" />
            <arg value="-C" />
            <arg value=".." />
            <arg value="--exclude" />
zzz's avatar
zzz committed
            <arg value="i2p-${release.number}/_MTN*" />
zzz's avatar
zzz committed
            <arg value="i2p-${release.number}/" />
        </exec>
        <echo message="Sign the files:" />
zzz's avatar
zzz committed
        <delete file="i2pinstall_${release.number}.exe.sig" />
        <delete file="i2psource_${release.number}.tar.bz2.sig" />
        <delete file="i2pupdate_${release.number}.zip.sig" />
zzz's avatar
zzz committed
        <exec executable="gpg" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-b" />
            <arg value="i2pinstall_${release.number}.exe" />
        </exec>
zzz's avatar
zzz committed
        <exec executable="gpg" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-b" />
            <arg value="i2psource_${release.number}.tar.bz2" />
        </exec>
zzz's avatar
zzz committed
        <exec executable="gpg" failonerror="true">
zzz's avatar
zzz committed
            <arg value="-b" />
            <arg value="i2pupdate_${release.number}.zip" />
        </exec>
zzz's avatar
zzz committed
        <exec executable="chmod" failonerror="true">
            <arg value="444" />
            <arg value="i2pinstall_${release.number}.exe" />
            <arg value="i2psource_${release.number}.tar.bz2" />
            <arg value="i2pupdate_${release.number}.zip" />
            <arg value="i2pupdate.su2" />
            <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>
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" />
            <arg value="i2pinstall_${release.number}.exe" />
            <arg value="i2psource_${release.number}.tar.bz2" />
            <arg value="i2pupdate_${release.number}.zip" />
            <arg value="i2pupdate.su2" />
zzz's avatar
zzz committed
            <arg value="i2pupdate.sud" />
            <arg value="i2pinstall_${release.number}.exe.sig" />
            <arg value="i2psource_${release.number}.tar.bz2.sig" />
            <arg value="i2pupdate_${release.number}.zip.sig" />
        </exec>
        <echo message="SHA256 sums:" />
zzz's avatar
zzz committed
        <exec executable="sha256sum" failonerror="true">
zzz's avatar
zzz committed
            <arg value="i2pinstall_${release.number}.exe" />
            <arg value="i2psource_${release.number}.tar.bz2" />
            <arg value="i2pupdate_${release.number}.zip" />
            <arg value="i2pupdate.su2" />
zzz's avatar
zzz committed
            <arg value="i2pupdate.sud" />
        </exec>
zzz's avatar
zzz committed
        <echo message="Don't forget to mtn tag w: i2p-${release.number}" />
zzz's avatar
zzz committed
        <echo message="... and mtn cert t:i2p-${release.number} branch i2p.i2p.release" />
zzz's avatar
zzz committed
    </target>
kytv's avatar
kytv committed
    <target name="debian" depends="debian-clean, debian-binary" />
kytv's avatar
kytv committed
    <target name="debian-binary" >
        <echo message="Did you update the version using dch -i?" />
        <echo message=" " />
        <echo message="If the changelog was not updated with dch -i, press" />
        <echo message="press CTRL+C to abort building this Debian package." />
        <echo message="" />
        <echo message="Pausing build for ten seconds to give enough time to read this notice." />
        <exec executable="sleep" failonerror="true">
                <arg value="10" />
        </exec>
HungryHobo's avatar
HungryHobo committed
        <echo message="====================" />

        <exec executable="fakeroot" failonerror="true">
            <arg value="debian/rules" />
            <arg value="patch" />
            <arg value="binary" />
            <arg value="clean" />
kytv's avatar
kytv committed
    </target>
kytv's avatar
kytv committed
    <target name="debian-clean" depends="buildProperties" >
        <exec executable="fakeroot" failonerror="true">
            <arg value="debian/rules" />
            <arg value="clean" />
kytv's avatar
kytv committed
    <target name="debian-patch" depends="buildProperties" >
        <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>