JavaRelease.st
changeset 3393 4d2f7467c3ff
parent 3389 5e24f9add064
child 3394 2077efcfb458
--- a/JavaRelease.st	Fri Feb 20 14:50:18 2015 +0000
+++ b/JavaRelease.st	Wed Mar 11 11:41:31 2015 +0000
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1996-2015 by Claus Gittinger
 
@@ -92,6 +94,20 @@
 	privateIn:JavaRelease
 !
 
+JavaRelease::OpenJDK7 subclass:#Zulu7
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:JavaRelease
+!
+
+JavaRelease::OpenJDK8 subclass:#Zulu8
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:JavaRelease
+!
+
 !JavaRelease class methodsFor:'documentation'!
 
 copyright
@@ -281,6 +297,18 @@
     "Created: / 27-10-2010 / 21:41:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 05-11-2011 / 18:45:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Modified: / 27-07-2012 / 00:22:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+zulu7
+    ^ Zulu7 instance.
+
+    "Created: / 26-02-2015 / 16:08:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+zulu8
+    ^ Zulu8 instance.
+
+    "Created: / 11-03-2015 / 11:00:47 / jv"
 ! !
 
 !JavaRelease class methodsFor:'accessing'!
@@ -1183,28 +1211,6 @@
     "
 
     "Created: / 11-11-2013 / 15:32:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-runtimeBundle
-    | rt src b |
-
-    src := self sourcePath detect:[:e|e endsWith: 'src.zip'] ifNone:[nil].
-    rt := self bootClassPath first.
-    self assert: (rt  endsWith: self nameOf_rt_dot_jar).
-
-    b := JavaCodeBundle new name: self name , ' Runtime Library'.
-    b add: (JavaCodeLibrary new
-                name: self nameOf_rt_dot_jar;
-                classes: rt;
-                sources: src;
-                yourself).
-    ^ b
-
-    "
-    Java release runtimeBundle
-    "
-
-    "Created: / 23-06-2014 / 11:41:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaRelease methodsFor:'queries'!
@@ -2167,9 +2173,11 @@
     "Return true if aVersionString (which is what 'java -version' returns)
      matches what I expect."
 
-    ^ aVersionString matches: '*java version "1.7.*OpenJDK Runtime Environment*'
+    ^ (aVersionString matches: '*java version "1.7.*OpenJDK Runtime Environment*')
+        and:[ (aVersionString includesString: 'Zulu') not ]
 
     "Modified: / 03-04-2014 / 12:52:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 09:29:59 / jv"
 ! !
 
 !JavaRelease::OpenJDK8 class methodsFor:'queries'!
@@ -2244,9 +2252,11 @@
     "Return true if aVersionString (which is what 'java -version' returns)
      matches what I expect."
 
-    ^ aVersionString matches: '*java version "1.8.*OpenJDK Runtime Environment*'
+    ^ (aVersionString matches: '*java version "1.8.*OpenJDK Runtime Environment*')
+        and:[ (aVersionString includesString: 'Zulu') not ]
 
     "Created: / 03-04-2014 / 12:32:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 10:15:22 / jv"
 ! !
 
 !JavaRelease::OracleJDK6 class methodsFor:'documentation'!
@@ -2952,6 +2962,187 @@
     ^ aVersionString matches: 'java version "1.2.*'
 ! !
 
+!JavaRelease::Zulu7 methodsFor:'accessing'!
+
+javaHomeOnWindowsFromRegistryForRelease: vsn
+    "Return path to java home (either JDK or JRE) based on values in registry.
+     If not on windows or registry key not found, return nil"
+
+    |entry home |
+
+    OperatingSystem isMSWINDOWSlike ifFalse:[ ^ nil ].
+    entry := (OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\Azul Systems\Zulu\', vsn).
+    entry notNil ifTrue:[
+        home := entry valueNamed:'InstallationPath'.
+        (home notNil and:[home asFilename exists]) ifTrue:[ ^ home ].
+    ].
+    ^nil
+
+    "Created: / 16-02-2013 / 02:52:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 21-02-2013 / 03:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 09:41:57 / jv"
+!
+
+javaHomesOnUNIX
+    ^ {
+        '/usr/lib/jvm/zulu-7-amd64'
+    }
+
+    "
+    JavaRelease::Zulu7 new javaHomesOnUNIX
+    "
+
+    "Created: / 26-02-2015 / 16:08:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaHomesOnWindows
+    ^ #(
+        'C:\Program Files\Zulu\zulu-7'                 
+    )
+
+    "Created: / 11-03-2015 / 09:24:07 / jv"
+!
+
+name
+    ^ 'Zulu 7'
+
+    "Created: / 11-03-2015 / 09:31:17 / jv"
+! !
+
+!JavaRelease::Zulu7 methodsFor:'queries'!
+
+isAvailableOnCurrentOperatingSystem
+    "Return if at all available for current operating system.
+     For example, there's no AppleJDK for Linux or OpenJDK for Windows."
+
+    ^ true "/ Zulu iz available for all supported operating systems
+
+    "Created: / 11-03-2015 / 09:31:55 / jv"
+! !
+
+!JavaRelease::Zulu7 methodsFor:'searching'!
+
+searchForJavaHome
+    | h |
+
+    "Try registry first..."
+    self class == JavaRelease::Zulu7 ifTrue:[ 
+        h := self javaHomeOnWindowsFromRegistryForRelease: 'zulu-7'.
+        (h notNil and:[self validateJavaHome: h]) ifTrue:[ javaHome := h. ^ javaHome ].
+    ].
+    ^super searchForJavaHome
+
+
+
+    "
+        JavaRelease openJDK7 searchForSourcePath; sourcePath
+        JavaRelease sunJDK6 searchForSourcePath; sourcePath
+    "
+
+    "Created: / 20-02-2013 / 02:55:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 09:40:49 / jv"
+! !
+
+!JavaRelease::Zulu7 methodsFor:'validating'!
+
+validateJavaVersionString:aVersionString
+    "Return true if aVersionString (which is what 'java -version' returns)
+     matches what I expect."
+
+    ^ aVersionString matches: '*openjdk version "1.7.*OpenJDK Runtime Environment (Zulu*'
+
+    "Created: / 26-02-2015 / 16:12:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 09:27:16 / jv"
+! !
+
+!JavaRelease::Zulu8 methodsFor:'accessing'!
+
+javaHomeOnWindowsFromRegistryForRelease: vsn
+    "Return path to java home (either JDK or JRE) based on values in registry.
+     If not on windows or registry key not found, return nil"
+
+    |entry home |
+
+    OperatingSystem isMSWINDOWSlike ifFalse:[ ^ nil ].
+    entry := (OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\Azul Systems\Zulu\', vsn).
+    entry notNil ifTrue:[
+        home := entry valueNamed:'InstallationPath'.
+        (home notNil and:[home asFilename exists]) ifTrue:[ ^ home ].
+    ].
+    ^nil
+
+    "Created: / 16-02-2013 / 02:52:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 21-02-2013 / 03:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 09:41:57 / jv"
+!
+
+javaHomesOnUNIX
+    ^ {
+        '/usr/lib/jvm/zulu-8-amd64'
+    }
+
+    "
+    JavaRelease::Zulu7 new javaHomesOnUNIX
+    "
+
+    "Created: / 26-02-2015 / 16:08:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 10:16:25 / jv"
+!
+
+javaHomesOnWindows
+    ^ #(
+        'C:\Program Files\Zulu\zulu-8'                 
+    )
+
+    "Created: / 11-03-2015 / 09:24:07 / jv"
+! !
+
+!JavaRelease::Zulu8 methodsFor:'queries'!
+
+isAvailableOnCurrentOperatingSystem
+    "Return if at all available for current operating system.
+     For example, there's no AppleJDK for Linux or OpenJDK for Windows."
+
+    ^ true "/ Zulu iz available for all supported operating systems
+
+    "Created: / 11-03-2015 / 09:31:55 / jv"
+! !
+
+!JavaRelease::Zulu8 methodsFor:'searching'!
+
+searchForJavaHome
+    | h |
+
+    "Try registry first..."
+    self class == JavaRelease::Zulu8 ifTrue:[ 
+        h := self javaHomeOnWindowsFromRegistryForRelease: 'zulu-8'.
+        (h notNil and:[self validateJavaHome: h]) ifTrue:[ javaHome := h. ^ javaHome ].
+    ].
+    ^super searchForJavaHome
+
+
+
+    "
+        JavaRelease openJDK7 searchForSourcePath; sourcePath
+        JavaRelease sunJDK6 searchForSourcePath; sourcePath
+    "
+
+    "Created: / 20-02-2013 / 02:55:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 10:16:18 / jv"
+! !
+
+!JavaRelease::Zulu8 methodsFor:'validating'!
+
+validateJavaVersionString:aVersionString
+    "Return true if aVersionString (which is what 'java -version' returns)
+     matches what I expect."
+
+    ^ aVersionString matches: '*openjdk version "1.8.*OpenJDK Runtime Environment (Zulu*'
+
+    "Created: / 26-02-2015 / 16:12:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 10:16:06 / jv"
+! !
+
 !JavaRelease class methodsFor:'documentation'!
 
 version