harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r707024 - in /harmony/enhanced/jdktools/trunk/modules: jdktools/META-INF/ jretools/META-INF/ jretools/src/main/java/org/apache/harmony/jretools/pack200/ samsa/
Date Wed, 22 Oct 2008 10:28:30 GMT
Author: sjanuary
Date: Wed Oct 22 03:28:30 2008
New Revision: 707024

URL: http://svn.apache.org/viewvc?rev=707024&view=rev
Log:
Pack200 - add "pack200" executable

Added:
    harmony/enhanced/jdktools/trunk/modules/jretools/src/main/java/org/apache/harmony/jretools/pack200/
    harmony/enhanced/jdktools/trunk/modules/jretools/src/main/java/org/apache/harmony/jretools/pack200/Main.java
  (with props)
Modified:
    harmony/enhanced/jdktools/trunk/modules/jdktools/META-INF/MANIFEST.MF
    harmony/enhanced/jdktools/trunk/modules/jretools/META-INF/MANIFEST.MF
    harmony/enhanced/jdktools/trunk/modules/samsa/build.xml

Modified: harmony/enhanced/jdktools/trunk/modules/jdktools/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jdktools/META-INF/MANIFEST.MF?rev=707024&r1=707023&r2=707024&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jdktools/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/jdktools/trunk/modules/jdktools/META-INF/MANIFEST.MF Wed Oct 22 03:28:30
2008
@@ -40,6 +40,7 @@
  org.apache.harmony.tools.jarsigner,
  org.apache.harmony.tools.keytool,
  org.apache.harmony.tools.unpack200,
+ org.apache.harmony.tools.pack200,
  com.sun.tools.javac,
  com.sun.tools.jdi,
  com.sun.tools.jdi.connect,

Modified: harmony/enhanced/jdktools/trunk/modules/jretools/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jretools/META-INF/MANIFEST.MF?rev=707024&r1=707023&r2=707024&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jretools/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/jdktools/trunk/modules/jretools/META-INF/MANIFEST.MF Wed Oct 22 03:28:30
2008
@@ -36,4 +36,5 @@
  org.apache.harmony.security.x509;version="1.0.0"
 Export-Package: org.apache.harmony.jretools.keytool,
  org.apache.harmony.jretools.unpack200,
+ org.apache.harmony.jretools.pack200,
  org.apache.harmony.jretools.policytool

Added: harmony/enhanced/jdktools/trunk/modules/jretools/src/main/java/org/apache/harmony/jretools/pack200/Main.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jretools/src/main/java/org/apache/harmony/jretools/pack200/Main.java?rev=707024&view=auto
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jretools/src/main/java/org/apache/harmony/jretools/pack200/Main.java
(added)
+++ harmony/enhanced/jdktools/trunk/modules/jretools/src/main/java/org/apache/harmony/jretools/pack200/Main.java
Wed Oct 22 03:28:30 2008
@@ -0,0 +1,124 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.harmony.jretools.pack200;
+
+import java.io.BufferedOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.jar.JarInputStream;
+
+import org.apache.harmony.pack200.Archive;
+
+public class Main {
+
+    public static void main(String args[]) throws Exception {
+
+        String inputFileName = null;
+        String outputFileName = null;
+        boolean verbose = false;
+        boolean quiet = false;
+        String logFileName = null;
+        boolean gzip = true;
+
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("--help") || args[i].equals("-help")
+                    || args[i].equals("-h") || args[i].equals("-?")) {
+                printHelp();
+                return;
+            } else if(args[i].equals("-g") || args[i].equals("--no-gzip")) {
+                gzip = false;
+            } else if(args[i].equals("--gzip")) {
+                gzip = true;
+            }  else if(args[i].equals("-v") || args[i].equals("--verbose")) {
+                verbose = true;
+                quiet = false;
+            } else if(args[i].equals("-q") || args[i].equals("--quiet")) {
+                quiet = true;
+                verbose = false;
+            } else if(args[i].startsWith("-l")) {
+                logFileName = args[i].substring(2);
+            } else if(args[i].equals("-V") || args[i].equals("--version")) {
+                printVersion();
+                return;
+            } else {
+                outputFileName = args[i];
+                if(args.length > i + 1) {
+                    inputFileName = args[i+1];
+                }
+                break;
+            }
+        }
+        if(inputFileName == null || outputFileName == null) {
+            printUsage();
+            return;
+        }
+        JarInputStream inputStream = new JarInputStream(new FileInputStream(inputFileName));
+        OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFileName));
+        Archive archive = new Archive(inputStream, outputStream, gzip);
+        archive.pack();
+    }
+
+    private static void printUsage() {
+        System.out.println("Usage:  pack200 [-opt... | --option=value]... x.pack[.gz] y.jar");
+        System.out.println("(For more information, run pack200 --help)");
+    }
+
+    private static void printHelp() {
+        // TODO: Support all the options
+        System.out.println("Usage:  pack200 [-opt... | --option=value]... x.pack[.gz] y.jar");
+        System.out.println();
+        System.out.println("Packing Options");
+        System.out.println("  -g, --no-gzip                   output a plain *.pack file
with no zipping");
+        System.out.println("  --gzip                          (default) post-process the
pack output with gzip");
+//        System.out.println("  -G, --strip-debug               remove debugging attributes
while packing");
+//        System.out.println("  -O, --no-keep-file-order        do not transmit file ordering
information");
+//        System.out.println("  --keep-file-order               (default) preserve input
file ordering");
+//        System.out.println("  -S{N}, --segment-limit={N}      output segment limit (default
N=1Mb)");
+//        System.out.println("  -E{N}, --effort={N}             packing effort (default N=5)");
+//        System.out.println("  -H{h}, --deflate-hint={h}       transmit deflate hint: true,
false, or keep (default)");
+//        System.out.println("  -m{V}, --modification-time={V}  transmit modtimes: latest
or keep (default)");
+//        System.out.println("  -P{F}, --pass-file={F}          transmit the given input
element(s) uncompressed");
+//        System.out.println("  -U{a}, --unknown-attribute={a}  unknown attribute action:
error, strip, or pass (default)");
+//        System.out.println("  -C{N}={L}, --class-attribute={N}={L}  (user-defined attribute)");
+//        System.out.println("  -F{N}={L}, --field-attribute={N}={L}  (user-defined attribute)");
+//        System.out.println("  -M{N}={L}, --method-attribute={N}={L} (user-defined attribute)");
+//        System.out.println("  -D{N}={L}, --code-attribute={N}={L}   (user-defined attribute)");
+//        System.out.println("  -f{F}, --config-file={F}        read file F for Pack200.Packer
properties");
+//        System.out.println("  -v, --verbose                   increase program verbosity");
+//        System.out.println("  -q, --quiet                     set verbosity to lowest level");
+//        System.out.println("  -l{F}, --log-file={F}           output to the given log file,
or '-' for System.out");
+        System.out.println("  -?, -h, --help                  print this message");
+        System.out.println("  -V, --version                   print program version");
+//        System.out.println("  -J{X}                           pass option X to underlying
Java VM");
+//        System.out.println("");
+//        System.out.println("Notes:");
+//        System.out.println("  The -P, -C, -F, -M, and -D options accumulate.");
+//        System.out.println("  Example attribute definition:  -C SourceFile=RUH .");
+//        System.out.println("  Config. file properties are defined by the Pack200 API.");
+//        System.out.println("  For meaning of -S, -E, -H-, -m, -U values, see Pack200 API.");
+//        System.out.println("  Layout definitions (like RUH) are defined by JSR 200.");
+//        System.out.println("");
+//        System.out.println("Repacking mode updates the JAR file with a pack/unpack cycle:");
+//        System.out.println("    pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar]
y.jar");
+    }
+
+    private static void printVersion() {
+        System.out.println("Apache Harmony pack200 version 0.0");  // TODO - version number
+    }
+
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jretools/src/main/java/org/apache/harmony/jretools/pack200/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: harmony/enhanced/jdktools/trunk/modules/jretools/src/main/java/org/apache/harmony/jretools/pack200/Main.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: harmony/enhanced/jdktools/trunk/modules/samsa/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/build.xml?rev=707024&r1=707023&r2=707024&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/samsa/build.xml (original)
+++ harmony/enhanced/jdktools/trunk/modules/samsa/build.xml Wed Oct 22 03:28:30 2008
@@ -84,7 +84,10 @@
         <copy file="${hy.samsa.exe}" tofile="${jretools.deploy.dir}/bin/unpack200${exe.suffix}"
/>
         <chmod file="${jretools.deploy.dir}/bin/unpack200${exe.suffix}" perm="ugo+x" />
 
-        <copy file="${hy.samsa.exe}" tofile="${jretools.deploy.dir}/bin/policytool${exe.suffix}"
/>
+    	<copy file="${hy.samsa.exe}" tofile="${jretools.deploy.dir}/bin/pack200${exe.suffix}"
/>
+    	<chmod file="${jretools.deploy.dir}/bin/pack200${exe.suffix}" perm="ugo+x" />
+
+    	<copy file="${hy.samsa.exe}" tofile="${jretools.deploy.dir}/bin/policytool${exe.suffix}"
/>
         <chmod file="${jretools.deploy.dir}/bin/policytool${exe.suffix}" perm="ugo+x"
/>
 
     </target>
@@ -114,7 +117,8 @@
         <copy file="${hy.samsa.progdb}" tofile="${jdktools.deploy.dir}/bin/javap${progdb.suffix}"
/>
         <copy file="${hy.samsa.progdb}" tofile="${jdktools.deploy.dir}/bin/jarsigner${progdb.suffix}"
/>
     	<copy file="${hy.samsa.progdb}" tofile="${jretools.deploy.dir}/bin/unpack200${progdb.suffix}"
/>
-        <copy file="${hy.samsa.progdb}" tofile="${jretools.deploy.dir}/bin/keytool${progdb.suffix}"
/>
+    	<copy file="${hy.samsa.progdb}" tofile="${jretools.deploy.dir}/bin/pack200${progdb.suffix}"
/>
+    	<copy file="${hy.samsa.progdb}" tofile="${jretools.deploy.dir}/bin/keytool${progdb.suffix}"
/>
         <copy file="${hy.samsa.progdb}" tofile="${jretools.deploy.dir}/bin/policytool${progdb.suffix}"
/>
 
     </target>
@@ -192,6 +196,14 @@
 	    <arg line="" />
         </exec>
 
+        <echo message="Run jdk/jre/bin/pack200 in ${hy.tests.reports}"/>
+        <exec failonerror="true"
+	        executable="${test.jre.home}/bin/pack200${exe.suffix}"
+	        dir="${hy.tests.reports}">
+	    <arg line="" />
+        </exec>
+
+
     </target>
 
     <!-- Clean natives -->



Mime
View raw message