JavaLibraries.st
changeset 2353 fa7400d022a0
parent 2277 735048b234ea
child 2380 9195eccdcbd9
child 2396 fadc6d7a2f5b
--- a/JavaLibraries.st	Sat Feb 02 01:23:18 2013 +0100
+++ b/JavaLibraries.st	Sat Feb 16 19:08:45 2013 +0100
@@ -1,11 +1,11 @@
 "
  COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                             SWING Research Group, Czech Technical University in Prague
 
- Parts of the code written by Claus Gittinger are under following
- license:
-
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
  inclusion of the above copyright notice.   This software may not
@@ -13,37 +13,16 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 
- Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the 'Software'), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- [1] Code written at SWING Research Group contain a signature
-     of one of the above copright owners.
+ [1] Code written at SWING Research Group contains a signature
+     of one of the above copright owners. For exact set of such code,
+     see the differences between this version and version stx:libjava
+     as of 1.9.2010
 "
 "{ Package: 'stx:libjava' }"
 
 Object subclass:#JavaLibraries
 	instanceVariableNames:''
-	classVariableNames:''
+	classVariableNames:'MavenRun'
 	poolDictionaries:''
 	category:'Languages-Java-Support'
 !
@@ -53,12 +32,12 @@
 copyright
 "
  COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                             SWING Research Group, Czech Technical University in Prague
 
- Parts of the code written by Claus Gittinger are under following
- license:
-
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
  inclusion of the above copyright notice.   This software may not
@@ -66,31 +45,10 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 
- Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the 'Software'), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- [1] Code written at SWING Research Group contain a signature
-     of one of the above copright owners.
+ [1] Code written at SWING Research Group contains a signature
+     of one of the above copright owners. For exact set of such code,
+     see the differences between this version and version stx:libjava
+     as of 1.9.2010
 
 "
 ! !
@@ -98,55 +56,61 @@
 !JavaLibraries class methodsFor:'accessing'!
 
 directory
+    | base |
 
-    ^Java cacheDirectory / 'libs'
+    base := Smalltalk getPackageDirectoryForPackage: 'stx:libjava/libs'.
+    base isNil ifTrue:[ ^ nil ].
+    ^base asFilename / 'java' 
 
     "
         JavaLibraries directory   
     "
 
     "Created: / 08-04-2011 / 16:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-url
-
-    ^(Smalltalk at:#stx_libjava) svnRepositoryUrlBase , '/libs'
-
-    "Created: / 08-04-2011 / 16:32:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-11-2012 / 00:11:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaLibraries class methodsFor:'private'!
 
-checkoutDirectory
-
-    OperatingSystem getNetworkAddresses size < 2 
-        ifTrue:
-            [self error: 'No network connection!!'. ^self].
-
-    (OperatingSystem
-        executeCommand:('svn co %1 %2' bindWith: self url with: self directory asString))
-        ifFalse:
-            [self error: 'Cannot checkout libraries!!'. ^self].
+runMaven
 
-    "Created: / 08-04-2011 / 16:38:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-updateDirectory
+    MavenRun ~~ true ifTrue:[
+        (OperatingSystem executeCommand:'mvn package' inDirectory: self directory asString)
+            ifFalse:[self error: 'Cannot run maven to download libraries!!'. ^self].
+        MavenRun := true
+    ].
 
-    OperatingSystem getNetworkAddresses size < 2 
-        ifTrue:
-            [^self].
-
-    (OperatingSystem
-        executeCommand:('svn update %1 %2' bindWith: self url with: self directory asString))
-        ifFalse:
-            [self error: 'Cannot update libraries!!'. ^self].
-
-    "Created: / 08-04-2011 / 16:38:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 20-08-2012 / 19:39:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaLibraries class methodsFor:'utilities'!
 
+addToClassPath
+    | dir |
+
+    (dir := self directory / 'libs') exists ifFalse: [ self update ].
+    dir recursiveDirectoryContentsAsFilenames do: [ :file | 
+        file suffix = 'jar' ifTrue: [ Java addToClassPath: file pathName ]
+    ].
+
+    (dir := self directory / 'libs-src') exists ifTrue:[
+        dir recursiveDirectoryContentsAsFilenames do: [ :file | 
+            file suffix = 'jar' ifTrue: [ Java addToSourcePath: file pathName ]
+        ]
+    ].
+
+
+
+
+    "
+        JavaLibraries addToClassPath.
+        Java classPath"
+
+    "Created: / 02-09-2011 / 09:24:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-11-2011 / 12:51:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 16-01-2013 / 13:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 addToClassPath: jarname
 
     | dir jar |
@@ -154,9 +118,11 @@
     (dir := self directory) exists 
         ifFalse:[self update].
 
-    (jar := dir / jarname) exists 
-        ifTrue: [Java addToClassPath: jar pathName]
-        ifFalse:[self error:'Library ' , jarname , ' not found in ', dir pathName].
+    (jar := dir / jarname) exists ifTrue: [
+        Java addToClassPath: jar pathName
+    ] ifFalse:[
+        self error:'Library ' , jarname , ' not found in ', dir pathName
+    ].
 
     "
         JavaLibraries addToClassPath:'junit4.jar'.
@@ -164,6 +130,7 @@
     "
 
     "Created: / 08-04-2011 / 16:49:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-01-2013 / 13:09:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 flush
@@ -174,26 +141,35 @@
 !
 
 update
+    (Smalltalk at:#stx_libjava_libs) isNil ifTrue:[
+        Smalltalk loadPackage:#'stx:libjava/libs'
+    ].
+    self runMaven.
 
-    | dir |
-    dir := self directory.
-    dir exists 
-        ifTrue: [self updateDirectory]
-        ifFalse:[self checkoutDirectory]
+    "
+        JavaLibraries flush
+        JavaLibraries update.
+
+        UserPreferences current fileBrowserClass openOn: self directory
+
+    "
 
     "Created: / 08-04-2011 / 16:29:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-11-2012 / 00:16:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaLibraries class methodsFor:'documentation'!
 
-version
-    ^ '$Header: /cvs/stx/stx/libjava/JavaLibraries.st,v 1.3 2011-11-24 11:53:54 cg Exp $'
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libjava/JavaLibraries.st,v 1.4 2013-02-16 18:08:32 vrany Exp $'
 !
 
-version_CVS
-    ^ '$Header: /cvs/stx/stx/libjava/JavaLibraries.st,v 1.3 2011-11-24 11:53:54 cg Exp $'
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 !
 
 version_SVN
-    ^ '§Id: JavaLibraries.st,v 1.1 2011/08/18 19:06:53 vrany Exp §'
+    ^ '§Id§'
 ! !
+