* Unzip: Any files in the zip with a .jar.pack or .war.pack extension

will be transparently unpacked with unpack200. Savings is about 60%.
      Someday we will do this for suds, but we can do it for xpi2ps now.
    * build: Add updater200 target
This commit is contained in:
zzz
2010-02-23 02:44:47 +00:00
parent f6b9cf6f21
commit 87fcaf2651
4 changed files with 42 additions and 8 deletions

View File

@@ -451,6 +451,8 @@
<target name="consoleDocs" depends="deletepkg-temp, prepconsoleDocs">
<zip destfile="docs.zip" basedir="pkg-temp" whenempty="fail" />
</target>
<target name="updater200" depends="prepupdate, preplicenses, pack200, zipit" />
<target name="updater" depends="prepupdate, preplicenses, zipit" />
<target name="updaterWithGeoIP" depends="prepupdate, prepgeoupdate, preplicenses, zipit" />
<target name="updaterWithJetty" depends="prepjupdate, preplicenses, zipit" />
@@ -460,7 +462,19 @@
<target name="updaterRouter" depends="prepupdateRouter, zipit" />
<target name="zipit">
<zip destfile="i2pupdate.zip" basedir="pkg-temp" whenempty="fail" />
<!-- just a test, makes almost no difference
<tar destfile="i2pupdate.tgz" basedir="pkg-temp" compression="gzip" />
<tar destfile="i2pupdate.tbz" basedir="pkg-temp" compression="bzip2" />
-->
</target>
<target name="pack200">
<exec executable="sh" failifexecutionfails="true">
<arg value="-c" />
<!-- pack200 will only pack to a .pack file, and only from a .jar file, so we put another .jar on the end -->
<arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
</exec>
</target>
<target name="updateTest" depends="prepupdate">
<ant dir="core/java/" target="jarTest" />
<copy file="core/java/build/i2ptest.jar" todir="pkg-temp/lib" />

View File

@@ -12,9 +12,12 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarOutputStream;
import java.util.jar.Pack200;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/**
* General helper methods for messing with files
*
@@ -75,6 +78,10 @@ public class FileUtil {
}
}
/**
* As of release 0.7.12, any files inside the zip that have a .jar.pack or .war.pack suffix
* are transparently unpacked to a .jar or .war file using unpack200.
*/
public static boolean extractZip(File zipfile, File targetDir) {
ZipFile zip = null;
try {
@@ -109,15 +116,22 @@ public class FileUtil {
} else {
try {
InputStream in = zip.getInputStream(entry);
FileOutputStream fos = new FileOutputStream(target);
int read = 0;
while ( (read = in.read(buf)) != -1) {
fos.write(buf, 0, read);
if (entry.getName().endsWith(".jar.pack") || entry.getName().endsWith(".war.pack")) {
target = new File(targetDir, entry.getName().substring(0, entry.getName().length() - ".pack".length()));
JarOutputStream fos = new JarOutputStream(new FileOutputStream(target));
Pack200.newUnpacker().unpack(in, fos);
fos.close();
System.err.println("INFO: File [" + entry.getName() + "] extracted and unpacked");
} else {
FileOutputStream fos = new FileOutputStream(target);
int read = 0;
while ( (read = in.read(buf)) != -1) {
fos.write(buf, 0, read);
}
fos.close();
System.err.println("INFO: File [" + entry.getName() + "] extracted");
}
fos.close();
in.close();
System.err.println("INFO: File [" + entry.getName() + "] extracted");
} catch (IOException ioe) {
System.err.println("ERROR: Error extracting the zip entry (" + entry.getName() + "]");
ioe.printStackTrace();

View File

@@ -1,3 +1,9 @@
2010-02-23 zzz
* Unzip: Any files in the zip with a .jar.pack or .war.pack extension
will be transparently unpacked with unpack200. Savings is about 60%.
Someday we will do this for suds, but we can do it for xpi2ps now.
* build: Add updater200 target
2010-02-22 zzz
* configclients.jsp:
- Add js delete confirm

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 4;
public final static long BUILD = 5;
/** for example "-test" */
public final static String EXTRA = "";