harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r616778 - in /harmony/enhanced/jdktools/trunk/modules: samsa/build.xml tools/META-INF/MANIFEST.MF tools/src/main/java/org/apache/harmony/tools/unpack200/ tools/src/main/java/org/apache/harmony/tools/unpack200/Main.java
Date Wed, 30 Jan 2008 14:42:35 GMT
Author: sjanuary
Date: Wed Jan 30 06:42:34 2008
New Revision: 616778

URL: http://svn.apache.org/viewvc?rev=616778&view=rev
Log:
Initial commit of unpack200 command line tool

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

Modified: harmony/enhanced/jdktools/trunk/modules/samsa/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/build.xml?rev=616778&r1=616777&r2=616778&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/samsa/build.xml (original)
+++ harmony/enhanced/jdktools/trunk/modules/samsa/build.xml Wed Jan 30 06:42:34 2008
@@ -81,6 +81,9 @@
         <copy file="${hy.samsa.exe}" tofile="${hy.jdk}/bin/appletviewer${exe.suffix}"
/>
         <chmod file="${hy.jdk}/bin/appletviewer${exe.suffix}" perm="ugo+x" />
 
+        <copy file="${hy.samsa.exe}" tofile="${hy.jdk}/bin/unpack200${exe.suffix}" />
+        <chmod file="${hy.jdk}/bin/unpack200${exe.suffix}" perm="ugo+x" />
+
     </target>
 
     <!-- copy windows javaw executable -->
@@ -107,6 +110,7 @@
         <copy file="${hy.samsa.progdb}" tofile="${hy.jdk}/bin/javadoc${progdb.suffix}"
/>
         <copy file="${hy.samsa.progdb}" tofile="${hy.jdk}/bin/keytool${progdb.suffix}"
/>
         <copy file="${hy.samsa.progdb}" tofile="${hy.jdk}/bin/jarsigner${progdb.suffix}"
/>
+    	<copy file="${hy.samsa.progdb}" tofile="${hy.jdk}/bin/unpack200${progdb.suffix}"
/>
 
     </target>
 
@@ -174,6 +178,13 @@
 	        executable="${test.jre.home}/../bin/keytool${exe.suffix}"
 	        dir="${hy.tests.reports}">
 	    <arg line="-help" />
+        </exec>
+
+        <echo message="Run jdk/bin/unpack200 in ${hy.tests.reports}"/>
+        <exec failonerror="true"
+	        executable="${test.jre.home}/../bin/unpack200${exe.suffix}"
+	        dir="${hy.tests.reports}">
+	    <arg line="" />
         </exec>
 
     </target>

Modified: harmony/enhanced/jdktools/trunk/modules/tools/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/META-INF/MANIFEST.MF?rev=616778&r1=616777&r2=616778&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/META-INF/MANIFEST.MF Wed Jan 30 06:42:34
2008
@@ -27,6 +27,7 @@
  javax.security.auth.x500,
  org.apache.harmony.kernel.vm,
  org.apache.harmony.luni.util,
+ org.apache.harmony.pack200,
  org.apache.harmony.security.asn1;version="1.0.0",
  org.apache.harmony.security.pkcs10;version="1.0.0",
  org.apache.harmony.security.provider.cert;version="1.0.0",
@@ -38,6 +39,7 @@
  org.apache.harmony.tools.javadoc,
  org.apache.harmony.tools.jarsigner,
  org.apache.harmony.tools.keytool,
+ org.apache.harmony.tools.unpack200,
  com.sun.tools.javac,
  com.sun.tools.jdi,
  com.sun.tools.jdi.connect,

Added: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/unpack200/Main.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/unpack200/Main.java?rev=616778&view=auto
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/unpack200/Main.java
(added)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/unpack200/Main.java
Wed Jan 30 06:42:34 2008
@@ -0,0 +1,107 @@
+/*
+ *  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.tools.unpack200;
+
+import org.apache.harmony.pack200.Archive;
+
+public class Main {
+
+    public static void main(String args[]) throws Exception {
+
+        String inputFileName = null;
+        String outputFileName = null;
+        boolean removePackFile = false;
+        boolean verbose = false;
+        boolean quiet = false;
+        boolean overrideDeflateHint = false;
+        boolean deflateHint = false;
+        String logFileName = null;
+
+        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("-Htrue") || args[i].equals("--deflate-hint=true"))
{
+                overrideDeflateHint = true;
+                deflateHint = true;
+            } else if(args[i].equals("-Hfalse") || args[i].equals("--deflate-hint=false"))
{
+                overrideDeflateHint = true;
+                deflateHint = false;
+            } else if(args[i].equals("-Hkeep") || args[i].equals("--deflate-hint=keep"))
{
+                overrideDeflateHint = false;
+            } else if(args[i].equals("-r") || args[i].equals("--remove-pack-file")) {
+                removePackFile = 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 {
+                inputFileName = args[i];
+                if(args.length > i + 1) {
+                    outputFileName = args[i+1];
+                }
+                break;
+            }
+        }
+        if(inputFileName == null || outputFileName == null) {
+            printUsage();
+            return;
+        }
+        Archive archive = new Archive(inputFileName, outputFileName);
+        archive.setRemovePackFile(removePackFile);
+        archive.setVerbose(verbose);
+        archive.setQuiet(quiet);
+        if(overrideDeflateHint) {
+            archive.setDeflateHint(deflateHint);
+        }
+        if(logFileName != null) {
+            archive.setLogFile(logFileName);
+        }
+        archive.unpack();
+    }
+
+    private static void printUsage() {
+        System.out.println("Usage:  unpack200 [-opt... | --option=value]... x.pack[.gz] y.jar");
+        System.out.println("(For more information, run unpack200 --help)");
+    }
+
+    private static void printHelp() {
+        System.out.println("Usage:  unpack200 [-opt... | --option=value]... x.pack[.gz] y.jar");
+        System.out.println();
+        System.out.println("Options:");
+        System.out.println("-H{h}, --deflate-hint={h}  Set the deflate hint for the output
file to {h}, either true, false or keep");
+        System.out.println("-r, --remove-pack-file     Delete the input file after unpacking");
+        System.out.println("-v, --verbose              Print verbose output");
+        System.out.println("-q, --quiet                Print no output");
+        System.out.println("-l{F}, --log-file={F}      Print output to the log file {F}");
+        System.out.println("-?, -h, --help             Show the help message");
+        System.out.println("-V, --version              Show the program version number");
+    }
+
+    private static void printVersion() {
+        System.out.println("Apache Harmony unpack200 version 0.0");  // TODO - version number
+    }
+
+}

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

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



Mime
View raw message