changeset 2103:cd86da3affff

Support including IcedTea, distribution name and hg revisions in version output.
author andrew
date Fri, 08 Jan 2010 21:55:50 +0000
parents 35224dd04ddb
children 380b85eb2bcd
files make/common/shared/Defs.gmk make/java/version/Makefile src/share/classes/sun/misc/Version.java.template
diffstat 3 files changed, 46 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/shared/Defs.gmk	Mon Dec 21 12:22:24 2009 +0000
+++ b/make/common/shared/Defs.gmk	Fri Jan 08 21:55:50 2010 +0000
@@ -204,7 +204,7 @@
 
 # Default names
 ifdef OPENJDK
-  LAUNCHER_NAME = openjdk
+  LAUNCHER_NAME = java
   PRODUCT_NAME = OpenJDK
   PRODUCT_SUFFIX = Runtime Environment
   JDK_RC_PLATFORM_NAME = Platform
--- a/make/java/version/Makefile	Mon Dec 21 12:22:24 2009 +0000
+++ b/make/java/version/Makefile	Fri Jan 08 21:55:50 2010 +0000
@@ -39,7 +39,12 @@
 	$(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \
 	    -e 's/@@java_version@@/$(RELEASE)/g' \
 	    -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
+	    -e 's/@@jdk_derivative_name@@/$(JDK_DERIVATIVE_NAME)/g' \
+	    -e 's/@@distro_name@@/$(DISTRO_NAME)/g' \
+	    -e 's/@@distro_package_version@@/$(DISTRO_PACKAGE_VERSION)/g' \
 	    -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
+	    -e 's/@@jdk_revid@@/$(JDK_REVID)/g' \
+	    -e 's/@@hotspot_revid@@/$(HOTSPOT_REVID)/g' \
 	$< > $@.temp
 	@$(MV) $@.temp $@
 
--- a/src/share/classes/sun/misc/Version.java.template	Mon Dec 21 12:22:24 2009 +0000
+++ b/src/share/classes/sun/misc/Version.java.template	Fri Jan 08 21:55:50 2010 +0000
@@ -41,6 +41,21 @@
     private static final String java_runtime_version =
         "@@java_runtime_version@@";
 
+    private static final String jdk_derivative_name =
+        "@@jdk_derivative_name@@";
+
+    private static final String distro_name =
+        "@@distro_name@@";
+
+    private static final String distro_package_version =
+        "@@distro_package_version@@";
+
+    private static final String jdk_revid =
+        "@@jdk_revid@@";
+
+    private static final String hotspot_revid =
+        "@@hotspot_revid@@";
+
     static {
         init();
     }
@@ -90,14 +105,36 @@
         /* First line: platform version. */
         ps.println(launcher_name + " version \"" + java_version + "\"");
 
+        String java_vm_name    = System.getProperty("java.vm.name");
+
         /* Second line: runtime version (ie, libraries). */
-        ps.println(java_runtime_name + " (build " +
-                           java_runtime_version + ")");
+        StringBuilder sb = new StringBuilder();
+        if (java_vm_name.toLowerCase().startsWith("cacao")) {
+            sb.append("IcedTea Runtime Environment");
+        } else {
+            sb.append(java_runtime_name);
+        }
+        if (jdk_derivative_name.length() > 0) {
+            sb.append(" (").append(jdk_derivative_name).append(")");
+        }
+        if (distro_package_version.length() > 0) {
+            sb.append(" (").append(distro_package_version).append(")");
+        } else {
+            sb.append(" (");
+            if (distro_name.length() > 0)
+                sb.append(distro_name).append(" ");
+            sb.append("build ").append(java_runtime_version);
+            if (jdk_revid.length() > 0)
+                sb.append("+").append(jdk_revid);
+            sb.append(")");
+        }
+        ps.println(sb.toString());
 
         /* Third line: JVM information. */
-        String java_vm_name    = System.getProperty("java.vm.name");
         String java_vm_version = System.getProperty("java.vm.version");
         String java_vm_info    = System.getProperty("java.vm.info");
+        if (hotspot_revid.length() > 0)
+            java_vm_version += "+" + hotspot_revid;
         ps.println(java_vm_name + " (build " + java_vm_version + ", " +
                    java_vm_info + ")");
     }