AbstractSourceCodeManager.st
changeset 2838 31706d7a4429
parent 2827 f473f55da102
child 2842 e707972b6af6
--- a/AbstractSourceCodeManager.st	Wed Jul 18 19:12:40 2012 +0200
+++ b/AbstractSourceCodeManager.st	Thu Jul 19 15:05:10 2012 +0200
@@ -66,15 +66,24 @@
 initCacheDirPath
     "initialize the name of the cacheDirectory.
      This is:
-          <tempDir>/stx_sourceCache."
-
+        <tempDir>/stx_sourceCache (non-UNIX)
+        ~/.smalltalk/source-cache (UNIX, as <tempDir> is pruned upon each reboot)
+    "
+    "JV@2012-03-14: Changed to use .smalltalk/source-cache on UNIX machines"
+
+    OperatingSystem isUNIXlike ifTrue:[
+        CacheDirectoryName := '~/.smalltalk/sourceCache'.
+        ^self
+    ].
     CacheDirectoryName := (Filename defaultTempDirectory constructString:'stx_sourceCache').
 
+
     "
-     self initCacheDirPath
+     self initCacheDirPath     
     "
 
-    "Modified: / 12.7.1999 / 10:01:31 / cg"
+    "Modified: / 12-07-1999 / 10:01:31 / cg"
+    "Modified (comment): / 19-07-2012 / 14:03:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 initialize
@@ -791,6 +800,12 @@
     "Modified (format): / 21-12-2011 / 18:58:53 / cg"
 ! !
 
+!AbstractSourceCodeManager class methodsFor:'others'!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.293 2012-07-19 13:05:10 vrany Exp $'
+! !
+
 !AbstractSourceCodeManager class methodsFor:'private'!
 
 checkMethodPackagesOf:aClass
@@ -1279,7 +1294,7 @@
     "/ the info given by the classes source ...
     "/ (i.e. its revisionString)
     "/
-    revInfo := cls revisionInfo.
+    revInfo := cls revisionInfoOfManager: self.
     revInfo notNil ifTrue:[
         revInfo keysAndValuesDo:[:key :value |
             newInfo at:key put:value
@@ -1423,6 +1438,7 @@
     "
 
     "Modified: / 22-10-2008 / 20:49:15 / cg"
+    "Modified: / 19-07-2012 / 13:38:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 updateVersionMethod:selector of:aClass for:newRevisionString
@@ -1645,6 +1661,17 @@
     "Modified (comment): / 29-09-2011 / 13:27:09 / cg"
 !
 
+performsCompilabilityChecks
+    "Should return true, if the manager itself performs
+     compilability checks, false otherwise.
+
+     Basically a hack, see my senders..."
+
+    ^false"/by default
+
+    "Created: / 11-04-2012 / 16:54:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 prefixOfVersionMethodForExtensionsSelector
     "all scm-extensionsVersion methods start with this prefix"
 
@@ -2388,6 +2415,67 @@
     "
 !
 
+fileOutSourceCodeExtensions: extensions package: package on: stream
+    "File out extension methods for given package on stream. 
+     Not programming-language safe  - can handle smalltalk methods.
+
+    NOTE: method body taken from
+    SourceCodeManagerUtilities>>checkinExtensionMethods:forPackage:withInfo:
+    CVS revision 1.240
+    "
+
+    | methodsSortedByName defClass |
+
+    self withSourceRewriteHandlerDo:[
+        stream nextPutAll:'"{ Package: '''.
+        stream nextPutAll:package asString.
+        stream nextPutAll:''' }"'; nextPutChunkSeparator; cr; cr.
+
+"/        s nextPutAll:(Smalltalk timeStamp).
+"/        s nextPutChunkSeparator. 
+"/        s cr; cr.
+
+        "/ sort them by name (to avoid conflict due to CVS merge)
+        methodsSortedByName := extensions asOrderedCollection.
+        methodsSortedByName sort:[:a :b |
+                                    |clsA clsB|
+
+                                    clsA := a mclass name.
+                                    clsB := b mclass name.
+                                    clsA < clsB ifTrue:[
+                                        true
+                                    ] ifFalse:[
+                                        clsA > clsB ifTrue:[
+                                            false
+                                        ] ifFalse:[
+                                            a selector < b selector
+                                        ]
+                                    ]
+                                  ].
+        methodsSortedByName do:[:aMethod |
+            self assert: aMethod package = package.
+            self assert: aMethod programmingLanguage isSmalltalk.
+            aMethod mclass fileOutMethod:aMethod on:stream.
+            stream cr.
+        ].
+
+        defClass := ProjectDefinition definitionClassForPackage:package.
+        defClass notNil ifTrue:[
+            "/ make sure, an extensionVersion_XXX method is included...
+            "/ (notice: no need to support a secondary backward compatible non-manager related version method here)
+            (methodsSortedByName contains:[:aMethod | aMethod selector == self nameOfVersionMethodForExtensions]) ifFalse:[
+                stream nextPutLine:('!!%1 class methodsFor:''documentation''!!' bindWith:defClass name).
+                stream cr.
+                stream nextChunkPut:
+                    (self versionMethodTemplateForSmalltalkFor:(self nameOfVersionMethodForExtensions)).
+                stream space; nextPutChunkSeparator.
+            ].
+        ].    
+    ].
+
+    "Created: / 02-02-2012 / 15:30:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 fileOutSourceCodeOf:aClass on:aStream
 
     self withSourceRewriteHandlerDo:[
@@ -2399,13 +2487,24 @@
       withTimeStamp:withTimeStamp withInitialize:withInitialize withDefinition:withDefinition
       methodFilter:methodFilter
 
+    | filter |
+    "JV@2012-02-02: Do not fileout extensionVersion methods, that one is filed out
+     when extensions are filed out."
+    (aClass inheritsFrom: ProjectDefinition) ifTrue:[
+        filter := [:m| (methodFilter value: m) and:[m selector ~~ self nameOfVersionMethodForExtensions] ]
+    ] ifFalse:[
+        filter := methodFilter.
+    ].
+
     self withSourceRewriteHandlerDo:[
         aClass fileOutOn:aStream 
                withTimeStamp:withTimeStamp 
                withInitialize:withInitialize 
                withDefinition:withDefinition
-               methodFilter:methodFilter
+               methodFilter:filter.
     ].
+
+    "Modified: / 02-02-2012 / 15:53:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 getExistingContainersInModule:aModule directory:aPackage
@@ -3546,11 +3645,11 @@
 !AbstractSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.292 2012-06-01 08:41:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.293 2012-07-19 13:05:10 vrany Exp $'
 !
 
-version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.292 2012-06-01 08:41:31 cg Exp $'
+version_SVN
+    ^ '§Id: AbstractSourceCodeManager.st 1925 2012-06-05 13:52:00Z vranyj1 §'
 ! !
 
 AbstractSourceCodeManager initialize!