Commit 64baea17 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Initial work on pack200.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3254 b35dd754-fafc-0310-a699-88a17e54d16e
parent 01eafc87
......@@ -42,6 +42,16 @@
<pathelement location="${basedir}/build/lib/xmltask.jar"/>
</classpath>
</taskdef>
<taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task">
<classpath>
<pathelement location="${basedir}/build/lib/pack200task.jar"/>
</classpath>
</taskdef>
<taskdef name="unpack200" classname="com.sun.tools.apache.ant.pack200.Unpack200Task">
<classpath>
<pathelement location="${basedir}/build/lib/pack200task.jar"/>
</classpath>
</taskdef>
<!--
<taskdef resource="clovertasks" />
......@@ -296,8 +306,8 @@
<target name="jar" depends="compile, jspc, -i18n" description="Produces Wildfires jars and sets up dependencies">
<mkdir dir="${jar.dest.dir}"/>
<!-- Make main Wildfire jar -->
<jar jarfile="${jar.dest.dir}/${jar.name}" index="true">
<fileset dir="${compile.dir}" includes="**/*.class" excludes="org/jivesoftware/wildfire/starter/ServerStarter.class"/>
<jar jarfile="${jar.dest.dir}/${jar.name}" index="true" duplicate="preserve">
<fileset dir="${compile.dir}" includes="**/*.class" excludes="org/jivesoftware/wildfire/starter/ServerStarter*.class"/>
<fileset dir="${jspc.classes.dest.dir}" includes="**/*.class"/>
<fileset dir="${src.i18n.dir}" includes="*.properties"/>
<fileset dir="${target.i18n.dir}" includes="*.properties"/>
......@@ -315,7 +325,7 @@
<!-- Make startup jar -->
<jar jarfile="${jar.dest.dir}/${jar.starter.name}">
<fileset dir="${compile.dir}">
<include name="org/jivesoftware/wildfire/starter/ServerStarter.class"/>
<include name="org/jivesoftware/wildfire/starter/ServerStarter*.class"/>
<include name="org/jivesoftware/wildfire/starter/JiveClassLoader*.class"/>
</fileset>
<manifest>
......@@ -405,7 +415,7 @@
</sourcepath>
<doctitle><![CDATA[<font face="arial,helvetica,sans-serif">Wildfire ${version} Javadoc</font>]]></doctitle>
<header><![CDATA[<b>Wildfire ${version} Javadoc</b>]]></header>
<bottom><![CDATA[<i>Copyright &copy; 1999-2004 Jive Software.</i>]]></bottom>
<bottom><![CDATA[<i>Copyright &copy; 2003-2006 Jive Software.</i>]]></bottom>
<classpath>
<path refid="javadoc.dependencies"/>
</classpath>
......@@ -664,6 +674,13 @@
<property name="prepare.out.dir" value="${release.out.dir}"/>
</ant>
<!-- Pack200 processing on JAR files in lib dir -->
<pack200 src="${release.out.dir}/lib/wildfire.jar"
destfile="${release.out.dir}/lib/wildfire.jar.pack"
gzipoutput="false"
modificationtime="latest"
/>
<!-- Copy dist docs, use filtering -->
<copy todir="${release.out.dir}">
<fileset dir="${docs.dir}/dist" includes="*.*" excludes="LICENSE.html"/>
......
......@@ -19,6 +19,7 @@ jstl.jar | Jakarta standard taglib 1.1.2
jmdns.jar | 1.0 RC1
jtds.jar | 1.2
mysql.jar | 3.1.12
pack200task.jar | August 5, 2004
postgres.jar | 8.1-404 JDBC 3
servlet.jar | Jetty 5.1.2pre0
shaj.jar | 0.5
......
......@@ -13,7 +13,10 @@ package org.jivesoftware.wildfire.starter;
import org.jivesoftware.util.Log;
import java.io.File;
import java.io.*;
import java.util.jar.Pack200;
import java.util.jar.JarOutputStream;
import java.util.zip.GZIPInputStream;
/**
* Starts the core XMPP server. A bootstrap class that configures classloaders
......@@ -74,6 +77,9 @@ public class ServerStarter {
libDir = new File(DEFAULT_LIB_DIR);
}
// Unpack any pack files.
unpackArchives(libDir);
ClassLoader loader = new JiveClassLoader(parent, libDir);
Thread.currentThread().setContextClassLoader(loader);
......@@ -101,4 +107,38 @@ public class ServerStarter {
}
return parent;
}
private void unpackArchives(File libDir) {
// Get a list of all packed files in the lib directory.
File [] packedFiles = libDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".pack");
}
});
// Unpack each.
boolean unpacked = false;
for (File packedFile : packedFiles) {
try {
String jarName = packedFile.getName().substring(0,
packedFile.getName().length() - ".pack".length());
InputStream in = new BufferedInputStream(new FileInputStream(packedFile));
JarOutputStream out = new JarOutputStream(new BufferedOutputStream(
new FileOutputStream(new File(libDir, jarName))));
Pack200.Unpacker unpacker = Pack200.newUnpacker();
System.out.print(".");
// Call the unpacker
unpacker.unpack(in, out);
in.close();
out.close();
unpacked = true;
}
catch (Exception e) {
e.printStackTrace();
}
}
if (unpacked) {
System.out.println("\n");
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment