JavaRelease.st
branchdevelopment
changeset 1949 a83c0afe06a4
parent 1927 007031278841
child 1951 4759acf61df0
child 1952 eec8d42f53c9
equal deleted inserted replaced
1948:91735e531d52 1949:a83c0afe06a4
    20 "
    20 "
    21 "{ Package: 'stx:libjava' }"
    21 "{ Package: 'stx:libjava' }"
    22 
    22 
    23 Object subclass:#JavaRelease
    23 Object subclass:#JavaRelease
    24 	instanceVariableNames:'javaHome classPath sourcePath classes bootClassPathClasses
    24 	instanceVariableNames:'javaHome classPath sourcePath classes bootClassPathClasses
    25 		extDirsClasses'
    25 		extDirsClasses bundle'
    26 	classVariableNames:''
    26 	classVariableNames:''
    27 	poolDictionaries:''
    27 	poolDictionaries:''
    28 	category:'Languages-Java-Support'
    28 	category:'Languages-Java-Support'
    29 !
    29 !
    30 
    30 
   250         JavaRelease openJDK6 classPath
   250         JavaRelease openJDK6 classPath
   251     "
   251     "
   252 
   252 
   253     "Created: / 27-10-2010 / 19:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   253     "Created: / 27-10-2010 / 19:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   254     "Modified: / 08-01-2013 / 12:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   254     "Modified: / 08-01-2013 / 12:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   255 !
       
   256 
       
   257 codeBundle
       
   258     "Return a code bundle representing this Java release
       
   259      (JDK)"
       
   260 
       
   261     | src_zip |
       
   262 
       
   263     bundle isNil ifTrue:[
       
   264         bundle := JavaCodeBundle new.
       
   265         bundle name: self name.
       
   266         src_zip := self sourcePath detect:[:p|p baseName = 'src.zip'].
       
   267 
       
   268         self classPath do:[:p|
       
   269             | lib |
       
   270 
       
   271             lib := JavaCodeLibrary new.
       
   272             lib name: p baseName.
       
   273             lib source: src_zip.
       
   274 
       
   275             bundle add: lib.
       
   276         ].
       
   277     ].
       
   278     ^bundle
       
   279 
       
   280     "Created: / 12-01-2013 / 15:50:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   255 !
   281 !
   256 
   282 
   257 javaExtDirs
   283 javaExtDirs
   258 
   284 
   259     "Returns a default value of java.ext.dirs property"
   285     "Returns a default value of java.ext.dirs property"
   599 !JavaRelease methodsFor:'searching'!
   625 !JavaRelease methodsFor:'searching'!
   600 
   626 
   601 searchForClassPath
   627 searchForClassPath
   602 
   628 
   603     | jreHome jdkHome |
   629     | jreHome jdkHome |
       
   630     bundle := nil.
   604     classPath := OrderedCollection new.
   631     classPath := OrderedCollection new.
   605     jreHome := self jreHome asFilename.
   632     jreHome := self jreHome asFilename.
   606     jdkHome := self javaHome asFilename.
   633     jdkHome := self javaHome asFilename.
   607     jreHome isNil ifTrue:[ ^ #() ].
   634     jreHome isNil ifTrue:[ ^ #() ].
   608     "Ensure, that rt.jar is first"
   635     "Ensure, that rt.jar is first"
   609     classPath add: (JavaPathElement newFromRelease:(jreHome / 'lib' / 'rt.jar') asString).
   636     classPath add: (jreHome / 'lib' / 'rt.jar') pathName.
   610 
   637 
   611     self searchForClassPathIn: jreHome / 'lib' .
   638     self searchForClassPathIn: jreHome / 'lib' .
   612     self searchForClassPathIn: jreHome / 'lib' / 'modules'.
   639     self searchForClassPathIn: jreHome / 'lib' / 'modules'.
   613 
   640 
   614     "Search for JDK tools (javac & co)"
   641     "Search for JDK tools (javac & co)"
   622         Java release classPath.
   649         Java release classPath.
   623     
   650     
   624     "
   651     "
   625 
   652 
   626     "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   653     "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   627     "Modified: / 15-12-2012 / 01:05:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   654     "Modified: / 12-01-2013 / 15:55:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   628 !
   655 !
   629 
   656 
   630 searchForClassPathIn: dir 
   657 searchForClassPathIn: dir 
   631     dir exists ifFalse: [ ^ self ].
   658     dir exists ifFalse: [ ^ self ].
   632     dir directoryContentsAsFilenames do: [
   659     dir directoryContentsAsFilenames do: [
   633         :file | 
   660         :file | 
   634         " this is to make sure that rt.jar is always first --v     "
   661         " this is to make sure that rt.jar is always first --v     "
   635         (file suffix = 'jar' and: [ file baseName ~= 'rt.jar' ]) ifTrue: [
   662         (file suffix = 'jar' and: [ file baseName ~= 'rt.jar' ]) ifTrue: [
   636             classPath add: (JavaPathElement newFromRelease:file asString)
   663             classPath add: file pathName.
   637         ]
   664         ]
   638     ]
   665     ]
   639 
   666 
   640     "Created: / 27-10-2010 / 21:38:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   667     "Created: / 27-10-2010 / 21:38:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   641     "Modified: / 02-11-2011 / 17:49:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   668     "Modified: / 02-11-2011 / 17:49:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   642     "Modified: / 27-07-2012 / 11:45:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   669     "Modified: / 12-01-2013 / 15:55:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   643 !
   670 !
   644 
   671 
   645 searchForJavaHome
   672 searchForJavaHome
   646 
   673 
   647     | h |
   674     | h |
   685 searchForSourcePath
   712 searchForSourcePath
   686 
   713 
   687     | java_home src_zip |
   714     | java_home src_zip |
   688 
   715 
   689     sourcePath := OrderedCollection new.
   716     sourcePath := OrderedCollection new.
       
   717     bundle := nil.
   690     java_home := self javaHome.
   718     java_home := self javaHome.
   691     java_home notNil ifTrue:[
   719     java_home notNil ifTrue:[
   692         src_zip := self javaHome asFilename / 'src.zip'.
   720         src_zip := self javaHome asFilename / 'src.zip'.
   693         src_zip exists ifTrue:[sourcePath add: (JavaPathElement newFromRelease:src_zip asString)].
   721         src_zip exists ifTrue:[sourcePath add: src_zip pathName].
   694     ].
   722     ].
   695 
   723 
   696     "
   724     "
   697         JavaRelease openJDK6 searchForSourcePath; sourcePath      
   725         JavaRelease openJDK6 searchForSourcePath; sourcePath      
   698     "
   726     "
   699 
   727 
   700     "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   728     "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   701     "Modified: / 15-12-2012 / 14:57:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   729     "Modified: / 12-01-2013 / 15:55:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   702 ! !
   730 ! !
   703 
   731 
   704 !JavaRelease methodsFor:'validating'!
   732 !JavaRelease methodsFor:'validating'!
   705 
   733 
   706 validateJavaHome: home
   734 validateJavaHome: home
  1004         java_homes add: self javaHome
  1032         java_homes add: self javaHome
  1005     ].
  1033     ].
  1006 
  1034 
  1007     java_homes do:[ :java_home |
  1035     java_homes do:[ :java_home |
  1008         src_zip := java_home asFilename directory / 'src.zip'.
  1036         src_zip := java_home asFilename directory / 'src.zip'.
  1009         src_zip exists ifTrue:[sourcePath add: (JavaPathElement newFromRelease:src_zip asString)].
  1037         src_zip exists ifTrue:[sourcePath add: src_zip pathName].
  1010     ].
  1038     ].
  1011 
  1039 
  1012     "
  1040     "
  1013         JavaRelease openJDK7 searchForSourcePath; sourcePath      
  1041         JavaRelease openJDK7 searchForSourcePath; sourcePath      
  1014     "
  1042     "
  1015 
  1043 
  1016     "Created: / 03-09-2012 / 18:38:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1044     "Created: / 03-09-2012 / 18:38:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1017     "Modified: / 09-01-2013 / 17:09:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1045     "Modified: / 12-01-2013 / 15:56:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1018 ! !
  1046 ! !
  1019 
  1047 
  1020 !JavaRelease::OpenJDK7 class methodsFor:'documentation'!
  1048 !JavaRelease::OpenJDK7 class methodsFor:'documentation'!
  1021 
  1049 
  1022 copyright
  1050 copyright