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

Skip to content
Snippets Groups Projects
build.xml 10.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • <?xml version="1.0" encoding="UTF-8"?>
    <project basedir="." default="all" name="routerconsole">
        <target name="all" depends="clean, build" />
        <target name="build" depends="builddep, jar" />
    
            <ant dir="../../../router/java/" target="build" />
    
            <ant dir="../../systray/java/" target="build" />
    
    	<!-- router will build core -->
        </target>
    
        <target name="prepare">
            <ant dir="../../jetty/" target="build" />
    
    zzz's avatar
    zzz committed
        <condition property="depend.available">
            <typefound name="depend" />
        </condition>
        <target name="depend" if="depend.available">
    
    zzz's avatar
    zzz committed
            <depend
                cache="../../../build"
                srcdir="./src" 
                destdir="./build/obj" >
                <!-- Depend on classes instead of jars where available -->
                <classpath>
                    <pathelement location="../../../core/java/build/obj" />
                    <pathelement location="../../../router/java/build/obj" />
                    <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
                    <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
                    <pathelement location="../../systray/java/build/obj" />
                    <pathelement location="../../systray/java/lib/systray4j.jar" />
                    <pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" /> <!-- we dont care if we're not on win32 -->
                    <pathelement location="../../jrobin/jrobin-1.4.0.jar" />
                </classpath>
            </depend>
    
    zzz's avatar
    zzz committed
        </target>
        <target name="dependVersion">
    
    zzz's avatar
    zzz committed
            <!-- Force the dependency on the RouterVersion as depend doesn't recognize constant changes  -->
            <dependset>
                 <srcfilelist dir="." files="../../../router/java/build/obj/net/i2p/router/RouterVersion.class" />
                 <targetfilelist dir="." files="build/obj/net/i2p/router/web/NewsFetcher.class" />
                 <targetfilelist dir="." files="build/obj/net/i2p/router/web/SummaryHelper.class" />
                 <targetfilelist dir="." files="build/obj/net/i2p/router/web/UpdateHandler.class" />
            </dependset>
        </target>
    
        <property name="javac.compilerargs" value="" />
    
    zzz's avatar
    zzz committed
        <target name="compile" depends="prepare, depend, dependVersion">
    
            <mkdir dir="./build" />
            <mkdir dir="./build/obj" />
            <javac 
                srcdir="./src" 
    
                debug="true" deprecation="on" source="1.5" target="1.5" 
    
    jrandom's avatar
    jrandom committed
                destdir="./build/obj">
    
                <compilerarg line="${javac.compilerargs}" />
    
    jrandom's avatar
    jrandom committed
                <classpath>
                    <pathelement location="../../../core/java/build/i2p.jar" />
                    <pathelement location="../../../router/java/build/router.jar" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
    
                    <pathelement location="../../systray/java/build/systray.jar" />
                    <pathelement location="../../systray/java/lib/systray4j.jar" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" /> <!-- we dont care if we're not on win32 -->
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../jrobin/jrobin-1.4.0.jar" />
    
    jrandom's avatar
    jrandom committed
                </classpath>
            </javac>
    
        </target>
        <target name="jar" depends="compile">
            <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class">
                <manifest>
                    <attribute name="Class-Path" value="i2p.jar router.jar" />
                </manifest>
            </jar>
    
    jrandom's avatar
    jrandom committed
            <delete dir="./tmpextract" />
            <unjar src="../../jrobin/jrobin-1.4.0.jar" dest="./tmpextract" />
            <jar destfile="./build/routerconsole.jar" basedir="./tmpextract" update="true" />
            <delete dir="./tmpextract" />
            
    
    
            <!-- Update the messages_*.po files.
    
    zzz's avatar
    zzz committed
                 We need to supply the bat file for windows, and then change the fail property to true -->
            <exec executable="sh" osfamily="unix" failifexecutionfails="false" >
    
                <arg value="./bundle-messages.sh" />
            </exec>
    
    zzz's avatar
    zzz committed
            <exec executable="sh" osfamily="mac" failifexecutionfails="false" >
                <arg value="./bundle-messages.sh" />
            </exec>
            <exec executable="cmd" osfamily="windows" failifexecutionfails="false" >
                <arg value="/c" />
                <arg value="bundle-messages.bat" />
            </exec>
    
            <!-- jar again to get the latest messages_*.class files -->
            <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
    
        <target name="war" depends="precompilejsp">
    
    zzz's avatar
    zzz committed
            <!-- Don't include the css in the war, the main build.xml will copy it to docs/themes/console/ -->
    
            <war destfile="build/routerconsole.war" webxml="../jsp/web-out.xml"
    
                 basedir="../jsp/" excludes="web.xml, *.css, **/*.java, *.jsp, web-fragment.xml">
    
    zzz's avatar
    zzz committed
        <target name="precompilejsp" unless="precompilejsp.uptodate">
    
            <delete file="../jsp/web-fragment.xml" />
            <delete file="../jsp/web-out.xml" />
    
            <mkdir dir="../jsp/WEB-INF/" />
            <mkdir dir="../jsp/WEB-INF/classes" />
    
    zzz's avatar
    zzz committed
    
            <!-- TODO: Don't compile the following jsps, which should be used only as includes:
               -  summary.jsp, summarynoframe.jsp, css.jsp, confignav.jsp
               -  Is here a JspC command line switch for that?
               -  Or should we move them to a separate directory?
              -->
    
    
            <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
    
    zzz's avatar
    zzz committed
            <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
    
                <classpath>
                    <pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
                    <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
                    <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../jetty/jettylib/commons-logging.jar" />
                    <pathelement location="../../jetty/jettylib/commons-el.jar" />
    
                    <pathelement location="../../jetty/jettylib/ant.jar" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../systray/java/build/obj" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../systray/java/lib/systray4j.jar" />
                    <pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" />
    
                    <pathelement location="build/routerconsole.jar" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="build/" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../../router/java/build/router.jar" />
                    <pathelement location="../../../core/java/build/i2p.jar" />
    
                </classpath>
                <arg value="-d" />
                <arg value="../jsp/WEB-INF/classes" />
    
    jrandom's avatar
    jrandom committed
                <arg value="-v" />
    
                <arg value="-p" />
                <arg value="net.i2p.router.web.jsp" />
                <arg value="-webinc" />
                <arg value="../jsp/web-fragment.xml" />
                <arg value="-webapp" />
                <arg value="../jsp/" />
            </java>
    
    jrandom's avatar
    jrandom committed
            
    
            <javac debug="true" deprecation="on" source="1.5" target="1.5" 
    
                   encoding="UTF-8"
    
    jrandom's avatar
    jrandom committed
                   destdir="../jsp/WEB-INF/classes/" 
                   srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
    
                <compilerarg line="${javac.compilerargs}" />
    
                <classpath>
                    <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
                    <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../jetty/jettylib/commons-logging.jar" />
                    <pathelement location="../../jetty/jettylib/commons-el.jar" />
    
    zzz's avatar
    zzz committed
                    <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../systray/java/build/obj" />
                    <pathelement location="../../systray/java/lib/systray4j.jar" />
                    <pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" />
    
                    <pathelement location="build/routerconsole.jar" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="build" />
    
    jrandom's avatar
    jrandom committed
                    <pathelement location="../../../router/java/build/router.jar" />
                    <pathelement location="../../../core/java/build/i2p.jar" />
    
    
            <!-- save these so we can run gettext on the generated java files later
    
    jrandom's avatar
    jrandom committed
            <delete>
                <fileset dir="../jsp/WEB-INF/" includes="**/*.java" />
                <fileset dir="../jsp/WEB-INF/" includes="**/*.jsp" />
            </delete>
    
            <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
            <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
            <replace file="../jsp/web-out.xml">
                <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
            </replace>
        </target>
    
    zzz's avatar
    zzz committed
    
        <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
    
    zzz's avatar
    zzz committed
            <srcfiles dir= "../jsp" includes="**/*.jsp, **/*.html, *.css, susimail/susimail, web.xml"/>
    
    zzz's avatar
    zzz committed
        </uptodate>
    
    
        <target name="javadoc">
            <mkdir dir="./build" />
            <mkdir dir="./build/javadoc" />
            <javadoc 
    
                sourcepath="./src:../../../core/java/src:../../../router/java/src:../../systray/java/src" destdir="./build/javadoc" 
    
                packagenames="*" 
                use="true" 
                splitindex="true" 
                windowtitle="Router Console" />
        </target>
        <target name="clean">
            <delete dir="./build" />
    
    zzz's avatar
    zzz committed
            <delete dir="../jsp/WEB-INF/" />
            <delete file="../jsp/web-fragment.xml" />
            <delete file="../jsp/web-out.xml" />
    
        </target>
        <target name="cleandep" depends="clean">
    	<!-- router will clean core -->
    
    jrandom's avatar
    jrandom committed
            <ant dir="../../../router/java/" target="cleandep" />
    
            <ant dir="../../systray/java/" target="cleandep" />
    
        </target>
        <target name="distclean" depends="clean">
    	<!-- router will clean core -->
            <ant dir="../../../router/java/" target="distclean" />
    
            <ant dir="../../systray/java/" target="distclean" />