Changeset fda6730


Ignore:
Timestamp:
Mar 18, 2017 2:34:59 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
05aef9b
Parents:
2480155
Message:

Addressbook build changes (ticket #1966):

  • Build as jar, not war
  • Put empty war in updater
  • Move Servlet starter to SusiDNS
  • Skip war in RouterConsoleRunner?
Files:
1 added
1 deleted
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • apps/addressbook/build.xml

    r2480155 rfda6730  
    99        <property name="javac.compilerargs" value="" />
    1010        <property name="javac.version" value="1.7" />
     11
     12        <target name="all" depends="jar, emptyWar"/>
    1113       
    1214        <target name="init">
     
    3739        </target>
    3840
    39         <target name="dependServlet" if="depend.available">
    40             <depend
    41                 cache="../../build"
    42                 srcdir="${src}"
    43                 destdir="${build}" >
    44                 <!-- Depend on classes instead of jars where available -->
    45                 <classpath>
    46                     <pathelement location="../../core/java/build/obj" />
    47                     <pathelement location="../jetty/jettylib/javax.servlet.jar" />
    48                 </classpath>
    49             </depend>
    50         </target>
    51 
    52         <target name="compile" depends="init, depend">
     41        <target name="compile" depends="init, depend, warUpToDate">
    5342            <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
    5443                       includeAntRuntime="false"
    55                        srcdir="${src}" destdir="${build}"
    56                        excludes="net/i2p/addressbook/Servlet.java">
     44                       srcdir="${src}" destdir="${build}">
    5745            <compilerarg line="${javac.compilerargs}" />
    5846            <classpath>
     
    6250        </target>
    6351
    64         <target name="compileServlet" depends="init, dependServlet, compile">
    65             <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
    66                        includeAntRuntime="false"
    67                        srcdir="${src}" destdir="${build}"
    68                        includes="net/i2p/addressbook/Servlet.java">
    69             <compilerarg line="${javac.compilerargs}" />
    70             <classpath>
    71                 <pathelement location="../../core/java/build/i2p.jar" />
    72                 <pathelement location="../jetty/jettylib/javax.servlet.jar" />
    73             </classpath>
    74                 </javac>
    75         </target>
    76 
    77         <!-- unused for now (except for Android), as we oddly ship addressbook as a .war -->
    7852        <target name="jar" depends="compile, changes">
    7953                <!-- set if unset -->
     
    9266                </jar>
    9367        </target>
    94        
    95         <target name="war" depends="compileServlet, changes, warUpToDate" unless="war.uptodate">
    96                 <mkdir dir="${dist}/tmp"/>
    97                 <mkdir dir="${dist}/tmp/WEB-INF"/>
    98                 <mkdir dir="${dist}/tmp/WEB-INF/classes"/>
    99                 <copy todir="${dist}/tmp/WEB-INF/classes">
    100                         <fileset dir="${build}"/>
    101                 </copy>
    102                 <!-- set if unset -->
    103                 <property name="workspace.changes.tr" value="" />
    104                 <war basedir="${dist}/tmp" webxml="web.xml" destfile="${dist}/${war}">
    105                         <manifest>
    106                                 <attribute name="Implementation-Version" value="${full.version}" />
    107                                 <attribute name="Built-By" value="${build.built-by}" />
    108                                 <attribute name="Build-Date" value="${build.timestamp}" />
    109                                 <attribute name="Base-Revision" value="${workspace.version}" />
    110                                 <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
    111                                 <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
    112                                 <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
    113                         </manifest>
    114                 </war>
    115                 <delete dir="${dist}/tmp"/>
    116         </target>
     68
     69        <target name="emptyWar" depends="init">
     70            <jar destfile="${dist}/${war}" >
     71                <manifest>
     72                    <attribute name="Note" value="Intentionally empty" />
     73                </manifest>
     74            </jar>
     75        </target>
    11776       
    11877        <target name="warUpToDate">
  • apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java

    r2480155 rfda6730  
    721721                    String appName = fileNames[i].substring(0, fileNames[i].lastIndexOf(".war"));
    722722                    String enabled = props.getProperty(PREFIX + appName + ENABLED);
    723                     if (! "false".equals(enabled)) {
     723                    if (appName.equals("addressbook")) {
     724                        // addressbook.war is now empty, thread is started by SusiDNS
     725                        if (enabled != null) {
     726                            props.remove(PREFIX + "addressbook" + ENABLED);
     727                            rewrite = true;
     728                        }
     729                    } else if (! "false".equals(enabled)) {
    724730                        try {
    725731                            String path = new File(dir, fileNames[i]).getCanonicalPath();
  • apps/susidns/src/WEB-INF/web-template.xml

    r2480155 rfda6730  
    1414
    1515  <display-name>susidns</display-name>
     16
     17    <servlet>
     18        <servlet-name>addressbook-runner</servlet-name>
     19        <servlet-class>net.i2p.addressbook.servlet.Servlet</servlet-class>
     20        <init-param>
     21            <param-name>home</param-name>
     22            <param-value>./addressbook</param-value>
     23        </init-param>
     24        <load-on-startup>1</load-on-startup>
     25    </servlet>
     26
     27    <servlet-mapping>
     28      <servlet-name>addressbook-runner</servlet-name>
     29      <url-pattern>/addressbook-runner</url-pattern>
     30    </servlet-mapping>
     31
    1632    <!-- precompiled servlets -->
    1733
  • apps/susidns/src/build.xml

    r2480155 rfda6730  
    3232                <pathelement location="${ant.home}/lib/ant.jar" />
    3333                <pathelement location="../../../core/java/build/i2p.jar" />
     34                <pathelement location="../../addressbook/dist/addressbook.jar" />
    3435        </path>
    3536
  • apps/susidns/src/java/src/net/i2p/addressbook/servlet/Servlet.java

    r2480155 rfda6730  
    2020 */
    2121
    22 package net.i2p.addressbook;
     22package net.i2p.addressbook.servlet;
    2323
    2424import java.io.IOException;
    2525import java.io.PrintWriter;
    26 import java.util.Random;
    2726
    2827import javax.servlet.ServletConfig;
     
    3231import javax.servlet.http.HttpServletResponse;
    3332
     33import net.i2p.addressbook.DaemonThread;
     34
    3435/**
    3536 * A wrapper for addressbook to allow it to be started as a web application.
    3637 *
    37  * This was a GenericServlet, we make it an HttpServlet solely to provide a hook
    38  * for SusiDNS to wake us up when the subscription list changes.
     38 * This was a GenericServlet, we make it an HttpServlet solely to provide a
     39 * simple page to display status.
    3940 *
     41 * @since 0.9.30 moved from addressbook to SusiDNS
    4042 * @author Ragnarok
    4143 *
     
    4951
    5052    /**
    51      * Hack to allow susidns to kick the daemon when the subscription list changes.
    52      * URL must be /addressbook/ with wakeup param set, and nonce param set from system property.
     53     * Simple output to verify that the addressbook servlet is running.
    5354     *
    5455     * (non-Javadoc)
  • build.xml

    r2480155 rfda6730  
    311311    </target>
    312312
    313     <target name="buildSusiDNS" depends="buildCore, buildJetty, buildImagegen" >
     313    <target name="buildSusiDNS" depends="buildCore, buildJetty, buildImagegen, buildAddressbook" >
    314314        <ant dir="apps/susidns/src" target="all" />
    315315        <copy file="apps/susidns/src/susidns.war" todir="build/" />
     
    333333    </target>
    334334
    335     <target name="buildAddressbook" depends="buildCore, buildJetty" >
    336         <ant dir="apps/addressbook/" target="war" />
     335    <target name="buildAddressbook" depends="buildCore" >
     336        <ant dir="apps/addressbook/" target="all" />
     337        <copy file="apps/addressbook/dist/addressbook.jar" todir="build/" />
     338        <!-- war is empty, only for updates -->
    337339        <copy file="apps/addressbook/dist/addressbook.war" todir="build/" />
    338340    </target>
     
    735737            <group title="SAM Bridge" packages="net.i2p.sam" />
    736738            <group title="SAM Demos" packages="net.i2p.sam.client" />
    737             <group title="SusiDNS Application" packages="i2p.susi.dns" />
     739            <group title="SusiDNS Application" packages="i2p.susi.dns:net.i2p.addressbook.servlet" />
    738740            <group title="SusiMail Application" packages="i2p.susi.webmail:i2p.susi.webmail.*:i2p.susi.debug:i2p.susi.util" />
    739741            <group title="Systray Application" packages="net.i2p.apps.systray" />
     
    12061208        <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
    12071209        <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
    1208         <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
     1210        <copy file="build/addressbook.jar" todir="pkg-temp/lib/" />
    12091211        <copy file="build/susimail.war" todir="pkg-temp/webapps/" />
    12101212        <copy file="build/susidns.war" todir="pkg-temp/webapps/" />
     
    14661468        <exec executable="sh" osfamily="unix" failonerror="true">
    14671469            <arg value="-c" />
    1468             <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/commons-logging.jar -o $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" />
     1470            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/commons-logging.jar -o $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 -o $i = pkg-temp/webapps/addressbook.war ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
    14691471        </exec>
    14701472        <exec executable="sh" osfamily="mac" failonerror="true">
    14711473            <arg value="-c" />
    1472             <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/commons-logging.jar -o $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" />
     1474            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/commons-logging.jar -o $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 -o $i = pkg-temp/webapps/addressbook.war ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
    14731475        </exec>
    14741476        <!-- windoz here : i admit, i hate escaped symbols in xml, indeed = =! -->
     
    15521554        <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
    15531555        <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
     1556        <copy file="build/addressbook.jar" todir="pkg-temp/lib/" />
    15541557        <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
    15551558        <!-- decapitalized the file in 0.7.8 -->
     
    18991902            <arg value="build/BOB.jar"/>
    19001903            <arg value="build/addressbook.jar"/>
    1901             <arg value="build/addressbook.war"/>
    19021904            <arg value="build/i2p.jar"/>
    19031905            <arg value="build/i2psnark.jar"/>
Note: See TracChangeset for help on using the changeset viewer.