* i2psnark build:

- Move FetchAndAdd to static inner class
      - Remove duplicate classes from i2psnark.war (120KB);
        fixes sporadic FetchAndAdd IllegalAccessError
      - Fix standalone build to include i2psnark.jar since classes
        aren't in the .war anymore
      - Have standalone jetty use I2PAppContext temp directory
      - Replace launch-i2psnark.jar with launch-i2psnark script,
        since RunStandalone is in i2p.jar
      - Clean up jetty-i2psnark.xml, turn off jetty logging
      - Remove standalone build from the pkg target in the main build.xml
This commit is contained in:
zzz
2009-06-15 15:22:51 +00:00
parent 3ee09df6ce
commit 2ca0ae7529
7 changed files with 36 additions and 86 deletions

View File

@ -37,16 +37,17 @@
</javac>
</target>
<target name="jar" depends="builddep, compile">
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/*Servlet.class">
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/I2PSnarkServlet*.class">
<manifest>
<attribute name="Main-Class" value="org.klomp.snark.Snark" />
<attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
</manifest>
</jar>
</target>
<!-- only include the servlet, everything else is in the jar -->
<target name="war" depends="jar">
<war destfile="../i2psnark.war" webxml="../web.xml">
<classes dir="./build/obj" includes="**/*" />
<classes dir="./build/obj" includes="**/I2PSnarkServlet*.class" />
</war>
</target>
@ -56,31 +57,13 @@
</zip>
</target>
<target name="standalone_prep" depends="war">
<javac debug="true" deprecation="on" source="1.5" target="1.5"
destdir="./build" srcdir="src/" includes="org/klomp/snark/web/RunStandalone.java" >
<compilerarg line="${javac.compilerargs}" />
<classpath>
<pathelement location="../../jetty/jettylib/commons-logging.jar" />
<pathelement location="../../jetty/jettylib/commons-el.jar" />
<pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
<pathelement location="../../jetty/jettylib/javax.servlet.jar" />
<pathelement location="../../../core/java/build/i2p.jar" />
</classpath>
</javac>
<jar destfile="./build/launch-i2psnark.jar" basedir="./build/" includes="org/klomp/snark/web/RunStandalone.class">
<manifest>
<attribute name="Main-Class" value="org.klomp.snark.web.RunStandalone" />
<attribute name="Class-Path" value="lib/i2p.jar lib/mstreaming.jar lib/streaming.jar lib/commons-el.jar lib/commons-logging.jar lib/jasper-compiler.jar lib/jasper-runtime.jar lib/javax.servlet.jar lib/org.mortbay.jetty.jar" />
</manifest>
</jar>
<delete dir="./dist" />
<mkdir dir="./dist" />
<copy file="./build/launch-i2psnark.jar" tofile="./dist/launch-i2psnark.jar" />
<copy file="../launch-i2psnark" todir="./dist/" />
<mkdir dir="./dist/webapps" />
<copy file="../i2psnark.war" tofile="./dist/webapps/i2psnark.war" />
<mkdir dir="./dist/lib" />
<copy file="./build/i2psnark.jar" tofile="./dist/lib/i2psnark.jar" />
<copy file="../../../core/java/build/i2p.jar" tofile="./dist/lib/i2p.jar" />
<copy file="../../jetty/jettylib/commons-el.jar" tofile="./dist/lib/commons-el.jar" />
<copy file="../../jetty/jettylib/commons-logging.jar" tofile="./dist/lib/commons-logging.jar" />
@ -92,7 +75,6 @@
<copy file="../../streaming/java/build/streaming.jar" tofile="./dist/lib/streaming.jar" />
<copy file="../jetty-i2psnark.xml" tofile="./dist/jetty-i2psnark.xml" />
<copy file="../readme-standalone.txt" tofile="./dist/readme.txt" />
<mkdir dir="./dist/work" />
<mkdir dir="./dist/logs" />
<zip destfile="i2psnark-standalone.zip">

View File

@ -876,10 +876,9 @@ public class I2PSnarkServlet extends HttpServlet {
private static final String TABLE_FOOTER = "</table>\n";
private static final String FOOTER = "</body></html>";
}
class FetchAndAdd implements Runnable {
/** inner class, don't bother reindenting */
private static class FetchAndAdd implements Runnable {
private SnarkManager _manager;
private String _url;
public FetchAndAdd(SnarkManager mgr, String url) {
@ -931,3 +930,5 @@ class FetchAndAdd implements Runnable {
}
}
}
}

View File

@ -2,6 +2,7 @@ package org.klomp.snark.web;
import java.io.File;
import net.i2p.I2PAppContext;
import net.i2p.util.FileUtil;
import org.mortbay.jetty.Server;
@ -22,7 +23,7 @@ public class RunStandalone {
}
public void start() {
File workDir = new File("work");
File workDir = new File(I2PAppContext.getGlobalContext().getTempDir(), "jetty-work");
boolean workDirRemoved = FileUtil.rmdir(workDir, false);
if (!workDirRemoved)
System.err.println("ERROR: Unable to remove Jetty temporary work directory");
@ -32,6 +33,8 @@ public class RunStandalone {
try {
_server = new Server("jetty-i2psnark.xml");
// just blow up NPE if we don't have a context
(_server.getContexts()[0]).setTempDirectory(workDir);
_server.start();
} catch (Exception e) {
e.printStackTrace();