common/SCMAbstractFileoutLikeTask.st
changeset 515 d460ef249979
parent 509 f92210d4585b
child 516 dad7345b8c70
--- a/common/SCMAbstractFileoutLikeTask.st	Mon Jan 19 10:10:26 2015 +0000
+++ b/common/SCMAbstractFileoutLikeTask.st	Mon Jan 19 22:38:09 2015 +0100
@@ -18,6 +18,8 @@
 "
 "{ Package: 'stx:libscm/common' }"
 
+"{ NameSpace: Smalltalk }"
+
 SCMAbstractTask subclass:#SCMAbstractFileoutLikeTask
 	instanceVariableNames:'suppressClasses suppressExtensions suppresBuildSupportFiles
 		packageClassesChanged packageExtensionsChanged extensionMethods
@@ -77,14 +79,27 @@
 !
 
 filesToGenerateFor: package
-    ^ package definition fileNamesToGenerate keys
+    | files definition |
+
+    files := OrderedCollection new.
+    definition := package definition.
+    package definition fileNamesToGenerate keysAndValuesDo:[:file :selector |
+        | annotation |
+
+        annotation := (definition class lookupMethodFor: selector) annotationAt: #file:overwrite:.
+        (annotation isNil or:[ (annotation argumentAt: 2) or:[ (package temporaryWorkingCopyRoot / file) exists not] ]) ifTrue:[ 
+            files add: file
+        ].
+    ].
+    ^ files
 
     "
-	SVN::CommitTask new
-	    package: #stx:libsvn;
-	    buildSupportFiles"
+        SVN::CommitTask new
+            package: #stx:libsvn;
+            buildSupportFiles"
 
     "Created: / 22-02-2014 / 22:31:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-01-2015 / 22:11:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 packageDefinition
@@ -442,46 +457,51 @@
 !
 
 doUpdateBuildSupportFilesFor: package
-    |pkgDef|
+    | pkgDef files |
 
     suppresBuildSupportFiles == true ifTrue:[
-	^self.
+        ^self.
     ].
 
     pkgDef := package definition.
 
     (self isSelectiveFileoutTask and:[packageClassesChanged not and:[(classes includes: pkgDef) not]]) ifTrue:[
-	^self.
+        ^self.
     ].
+    files := OrderedCollection new.
 
     ActivityNotification notify:'Updating build files'.
     "First, generate files into a temporary files - so originals
      are not destroyed when something goes wrong."
     (self filesToGenerateFor: package) do:[:supportFileName |
-	| supportFile |
+        | supportFile supportFileContents |
 
-	supportFile := package temporaryWorkingCopyRoot / (supportFileName , '.tmp').
-	(packageClassesChanged or:[ supportFile exists not ]) ifTrue:[
-	    ActivityNotification notify:'Updating ' , supportFileName.
-	    supportFile directory exists ifFalse: [supportFile directory makeDirectory].
-	    supportFile writingFileDo:[:s|
-		    s nextPutAll:(self for: package generateFile:supportFileName)
-	    ]
-	]
+        supportFile := package temporaryWorkingCopyRoot / (supportFileName , '.tmp').
+        (packageClassesChanged or:[ supportFile exists not ]) ifTrue:[
+            ActivityNotification notify:'Updating ' , supportFileName.
+            supportFileContents := self for: package generateFile:supportFileName.
+            supportFileContents notNil ifTrue:[  
+                supportFile directory exists ifFalse: [supportFile directory makeDirectory].
+                supportFile writingFileDo:[:s|
+                    s nextPutAll:supportFileContents
+                ].
+                files add: supportFileName.
+            ]
+        ]
     ].
     "Now, copy them over the old files"
-    (self filesToGenerateFor: package) do:[:supportFileName |
-	| supportFile supportFileTmp |
+    files do:[:supportFileName |
+        | supportFile supportFileTmp |
 
-	supportFile := package temporaryWorkingCopyRoot / supportFileName.
-	supportFileTmp := package temporaryWorkingCopyRoot / (supportFileName , '.tmp').
+        supportFile := package temporaryWorkingCopyRoot / supportFileName.
+        supportFileTmp := package temporaryWorkingCopyRoot / (supportFileName , '.tmp').
 
-	supportFileTmp moveTo: supportFile.
-	supportFile track.
+        supportFileTmp moveTo: supportFile.
+        supportFile track.
     ].
 
     "Created: / 21-02-2014 / 23:16:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 22-02-2014 / 22:47:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-01-2015 / 22:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 doUpdateCode