JavaRelease.st
changeset 3399 673ed393d7b3
parent 3398 579f0f85063a
parent 3394 2077efcfb458
child 3400 04b5daf050d9
--- a/JavaRelease.st	Fri Mar 13 16:09:02 2015 +0000
+++ b/JavaRelease.st	Mon Mar 16 09:40:45 2015 +0000
@@ -94,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
@@ -140,7 +154,7 @@
                                 * exists bin/java (bin\java.exe) - then javaHome is considered
                                   a path to JRE
                                 __or__
-                                * exists bin/javac (bin\javac.exe) - then javaHome is considered 
+                                * exists bin/javac (bin\javac.exe) - then javaHome is considered
                                   a path JDK
 
     [class variables:]
@@ -283,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'!
@@ -308,7 +334,7 @@
      For example, there's no AppleJDK for Linux or OpenJDK for Windows.
     "
 
-    ^ self all select:[:each | each isAvailableOnCurrentOperatingSystem ]        
+    ^ self all select:[:each | each isAvailableOnCurrentOperatingSystem ]
 
     "
         JavaRelease allForCurrentOperatingSystem
@@ -484,8 +510,8 @@
             javaExecutable := javaExecutable asFilename asAbsoluteFilename.
             javaExecutable isSymbolicLink ifTrue:[
                 javaExecutable := javaExecutable physicalFilename.
-                javaExecutable isNil ifTrue:[ 
-                    "/ Broken link, ignore...    
+                javaExecutable isNil ifTrue:[
+                    "/ Broken link, ignore...
                     ^ nil
                 ].
                 javaExecutable := javaExecutable asAbsoluteFilename.
@@ -494,7 +520,7 @@
         ].
         "/ Use the autodetected release if that's the system one...
         System notNil ifTrue:[
-            System javaHome = System class instance javaHome ifTrue:[ 
+            System javaHome = System class instance javaHome ifTrue:[
                 System := System class instance
             ].
         ].
@@ -775,7 +801,7 @@
 
 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. 
+     If not on windows or registry key not found, return nil.
 
      CAVEAT: This method only finds Oracle JDKs"
 
@@ -784,14 +810,14 @@
     OperatingSystem isMSWINDOWSlike ifFalse:[ ^ nil ].
     "Search for JDK first, prefer 46 bit over 32 bit (even though it does not matter for STX:LIBJAVA)"
     entry := OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\', vsn flags: #KEY_WOW64_64KEY.
-    entry isNil ifTrue:[ 
+    entry isNil ifTrue:[
         entry := OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\', vsn flags: #KEY_WOW64_32KEY.
     ].
     "Search for JRE...."
-    entry isNil ifTrue:[ 
+    entry isNil ifTrue:[
         entry := OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\', vsn flags: #KEY_WOW64_64KEY.
     ].
-    entry isNil ifTrue:[ 
+    entry isNil ifTrue:[
         entry := OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\', vsn flags: #KEY_WOW64_32KEY.
     ].
     entry notNil ifTrue:[
@@ -812,7 +838,7 @@
 
 javaHomeOrNil
     "Answer a Java home"
-    
+
     | home |
 
     home := javaHome isNil ifTrue:[ self searchForJavaHome ] ifFalse:[ javaHome ].
@@ -980,7 +1006,7 @@
 
 sourcePath
     "Returns a paths where sources are located"
-    
+
     sourcePath isNil ifTrue:[
         self searchForSourcePath
     ].
@@ -1061,19 +1087,19 @@
 
     available := self isAvailable.
 
-    available ifTrue:[ 
+    available ifTrue:[
         displayString := '%1 (%2%3)' bindWith: self name
                                          with: (self jdkHome notNil ifTrue:[ 'JDK' ] ifFalse:[ 'JRE' ])
                                          with: (self isSystem ifTrue:[ ', system' ] ifFalse:[ '' ]).
-        self isSystem ifTrue:[ 
+        self isSystem ifTrue:[
             displayString := displayString asText allUnderlined.
         ].
-    ] ifFalse:[ 
+    ] ifFalse:[
         displayString := self name.
     ].
     available ifTrue: [
         displayString := displayString , ((' - ', self javaHome asFilename pathName) asText colorizeAllWith: Color gray).
-    ] ifFalse: [ 
+    ] ifFalse: [
         displayString := displayString , ((self class classResources string: ' - not found') asText colorizeAllWith: Color gray).
     ].
 
@@ -1113,9 +1139,9 @@
 printOn: aStream
     super printOn: aStream.
     aStream nextPut:$(.
-    self jdkHome notNil ifTrue:[ 
+    self jdkHome notNil ifTrue:[
         aStream nextPutAll: 'JDK'
-    ] ifFalse:[ 
+    ] ifFalse:[
         aStream nextPutAll: 'JRE'
     ].
     aStream space.
@@ -1195,28 +1221,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'!
@@ -2179,9 +2183,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'!
@@ -2256,9 +2262,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'!
@@ -2303,7 +2311,7 @@
 javaHomesOnWindows
     |home paths |
 
-    home := self javaHomeOnWindowsFromRegistryForRelease: '1.6'.       
+    home := self javaHomeOnWindowsFromRegistryForRelease: '1.6'.
     home notNil ifTrue:[ ^ Array with: home ].
 
     paths := OrderedCollection new.
@@ -2419,7 +2427,7 @@
 
     "Try registry first..."
      "Try registry first..."
-    self class == JavaRelease::OracleJDK6 ifTrue:[ 
+    self class == JavaRelease::OracleJDK6 ifTrue:[
         h := self javaHomeOnWindowsFromRegistryForRelease: '1.6'.
         (h notNil and:[self validateJavaHome: h]) ifTrue:[ javaHome := h. ^ javaHome ].
     ].
@@ -2587,16 +2595,11 @@
 !
 
 priority
-
-    "/There is no OpenJDK 6 for Windows yet...
-    OperatingSystem isMSWINDOWSlike ifTrue:[
-        super priority
-    ].
     ^65
 
     "Created: / 22-11-2010 / 13:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 19-07-2012 / 10:57:55 / jv"
-    "Modified: / 11-11-2013 / 14:11:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-03-2015 / 12:31:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 selector
@@ -2642,7 +2645,7 @@
     | h |
 
     "Try registry first..."
-    self class == JavaRelease::OracleJDK7 ifTrue:[ 
+    self class == JavaRelease::OracleJDK7 ifTrue:[
         h := self javaHomeOnWindowsFromRegistryForRelease: '1.7'.
         (h notNil and:[self validateJavaHome: h]) ifTrue:[ javaHome := h. ^ javaHome ].
     ].
@@ -2766,7 +2769,7 @@
     | h |
 
     "Try registry first..."
-    self class == JavaRelease::OracleJDK8 ifTrue:[ 
+    self class == JavaRelease::OracleJDK8 ifTrue:[
         h := self javaHomeOnWindowsFromRegistryForRelease: '1.8'.
         (h notNil and:[self validateJavaHome: h]) ifTrue:[ javaHome := h. ^ javaHome ].
     ].
@@ -2964,6 +2967,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 flags: #KEY_WOW64_64KEY.
+    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