You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by od...@apache.org on 2009/06/15 17:29:54 UTC

svn commit: r784811 - in /harmony/enhanced: classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ classlib/trunk/modules/luni/src/main/native/launcher/shared/ drlvm/trunk/vm/vmcore/include/ drlvm/trunk/vm/vmcore/src/init/

Author: odeakin
Date: Mon Jun 15 15:29:53 2009
New Revision: 784811

URL: http://svn.apache.org/viewvc?rev=784811&view=rev
Log:
Alter -version output to include copyright and revision info. 
Also add handling for -showversion and -showversion:extended option.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/Version.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/version.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/Version.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/Version.java?rev=784811&r1=784810&r2=784811&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/Version.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/Version.java Mon Jun 15 15:29:53 2009
@@ -91,13 +91,13 @@
     }
 
     public static void version(String versionOpt) {
-        if (versionOpt.equals("-version")) {
+        if (versionOpt.equals("-version") || versionOpt.equals("-showversion")) {
             displayVMVersion();
-        } else if (versionOpt.equals("-version:extended")) {
+        } else if (versionOpt.equals("-version:extended") || versionOpt.equals("-showversion:extended")) {
             displayVMVersion();
             displayClasslibVersion();
         } else {
-            System.out.println("Option " + versionOpt + " unrecognised - please use -version or -version:extended");
+            System.out.println("Option " + versionOpt + " unrecognised - please use -version, -showversion, -version:extended or -showversion:extended");
         }
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c?rev=784811&r1=784810&r2=784811&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c Mon Jun 15 15:29:53 2009
@@ -139,7 +139,6 @@
   char defaultDllName[] = "harmonyvm";
   char defaultDirName[] = "default";
   int rc = -1;
-  int showVersion = 0;
   int versionFlag = 0;
   int vmHelp = 0;
   int genericLauncher = 0;
@@ -231,9 +230,9 @@
             /* Display version information */
             versionFlag = i;
 		}
-		if (0 == strcmp ("-showversion", argv[i])) {
+		if (0 == strncmp ("-showversion", argv[i], 12)) {
 			/* We are being asked to print our version and continue */
-			showVersion = 1;
+            if (!versionFlag) versionFlag = i;
 		}
 		if ('-' != argv[i][0]) {
 			/* This is the main class */
@@ -354,15 +353,6 @@
     }
 
 #endif /* ! HY_NO_THR */
-  if (showVersion == 1)
-    {
-      if (!versionWritten)
-        {
-          hyfile_printf (PORTLIB, HYPORT_TTY_OUT, HY_COPYRIGHT_STRING "\n");
-          copyrightWritten = 1;
-          versionWritten = 1;
-        }
-    }
     
   /* set up the properties file */
   propertiesFileName = hymem_allocate_memory (strlen (vmiPath) + 12);
@@ -678,6 +668,9 @@
       jclass clazz;
       jmethodID mID;
       jstring jStrObject;
+
+      /* First, print the copyright string to stdout */
+      hyfile_printf (PORTLIB, HYPORT_TTY_OUT, HY_COPYRIGHT_STRING "\n");
         
       jStrObject = (*env)->NewStringUTF (env, argv[versionFlag]);
       if (!jStrObject) return 3;
@@ -690,8 +683,10 @@
       if (!mID) return 3;
         
       (*env)->CallStaticVoidMethod(env, clazz, mID, jStrObject);
-        
-      return 0;
+
+      /* if -version is specified, exit, otherwise continue */
+      if (0 == strncmp ("-version", argv[versionFlag], 8))
+          return 0;
   }
 
   if (mainClass)
@@ -969,7 +964,8 @@
        if ( (strcmp (argv[i], "-jar") != 0) 
            && (strncmp (argv[i], "-vmdir:", 7) != 0)
            && (strncmp (argv[i], "-vm:", 4) != 0) 
-           && (strncmp (argv[i], "-version", 8) != 0))
+           && (strncmp (argv[i], "-version", 8) != 0)
+            && (strncmp (argv[i], "-showversion", 12) != 0))
        {
           /* special coding for -classpath and -cp */
           /* they get passed to the vm as -Djava.class.path */

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/version.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version.h?rev=784811&r1=784810&r2=784811&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/version.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/version.h Mon Jun 15 15:29:53 2009
@@ -57,7 +57,7 @@
 
 #define VM_VERSION "Apache Harmony HEAD"
 
-#define VERSION "java version \"1.5.0\" \n" "pre-alpha : not complete or compatible\n" \
+#define VERSION "pre-alpha : not complete or compatible\n" \
     "svn = r" VERSION_SVN_TAG ", (" __DATE__ "), " \
     VERSION_OS "/" VERSION_ARCH "/" VERSION_COMPILER ", " VERSION_DEBUG_STRING " build\n" \
     "http://harmony.apache.org"

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp?rev=784811&r1=784810&r2=784811&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp Mon Jun 15 15:29:53 2009
@@ -28,6 +28,7 @@
 #include "vm_properties.h"
 #include "init.h"
 #include "port_modules.h"
+#include "version.h"
 #if defined(FREEBSD)
 #include <dlfcn.h>
 #endif
@@ -149,6 +150,7 @@
     properties.set_new("java.version", "1.5.0");
     properties.set_new("java.vendor", "Apache Software Foundation");
     properties.set_new("java.vendor.url", "http://harmony.apache.org");
+    properties.set_new("java.fullversion", VERSION);
 
     // java.home initialization, try to find absolute location of the executable and set
     // java.home to the parent directory.