- ProjectDefinition jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 27 Nov 2012 08:58:37 +0000
branchjv
changeset 17989 7982cc05fa88
parent 17988 ebcc76802351
child 17990 e989b5d7da98
- ProjectDefinition added: #hgPostLoad changed: #executeHooks: - Smalltalk added: #versionBuildNumber
ProjectDefinition.st
Smalltalk.st
--- a/ProjectDefinition.st	Fri Nov 23 20:26:31 2012 +0000
+++ b/ProjectDefinition.st	Tue Nov 27 08:58:37 2012 +0000
@@ -1948,6 +1948,24 @@
 
 !ProjectDefinition class methodsFor:'description - actions'!
 
+hgPostLoad
+    <postLoad>
+
+    | dir repo versionMethod |
+    "Eventually update an version_HG"
+
+    dir := Smalltalk getPackageDirectoryForPackage: self package.
+    dir := HGRepository discover: dir.
+    dir notNil ifTrue:[
+        repo := HGRepository on: dir.
+        versionMethod := HGSourceCodeManager ensureVersionMethodInClass: self package: self package.
+        versionMethod annotateWith: 
+            (HGRevisionAnnotation revision: repo workingCopy changeset id)
+    ].
+
+    "Created: / 26-11-2012 / 13:06:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 postLoadAction
     "invoked after loading a project"
 
@@ -5546,17 +5564,25 @@
     "Execute all hooks annotate by given symbol. Currently supported 
      hooks are: #preLoad, #postLoad, #preUnload."
 
-    self class selectorsAndMethodsDo:[:selector :method|
-        (method annotationAt: hook) notNil ifTrue:[
-            method numArgs == 0 ifTrue:[
-                self perform: selector
-            ] ifFalse:[
-                self error:'Hook for %1 must have no arguments' mayProceed: true.
+    | cls |
+
+    cls := self.
+
+    [ cls notNil ] whileTrue:[
+        cls class allSelectorsAndMethodsDo:[:selector :method|
+            (method annotationAt: hook) notNil ifTrue:[
+                method numArgs == 0 ifTrue:[
+                    self perform: selector
+                ] ifFalse:[
+                    self error:'Hook for %1 must have no arguments' mayProceed: true.
+                ]
             ]
-        ]
-    ]
+        ].
+        cls := cls superclass.
+    ].
 
     "Created: / 20-11-2012 / 23:00:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-11-2012 / 13:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 extensionOverwriteInfo
@@ -6880,7 +6906,7 @@
 !ProjectDefinition class methodsFor:'documentation'!
 
 version
-    ^ '$Id: ProjectDefinition.st 10869 2012-11-23 11:30:05Z vranyj1 $'
+    ^ '$Id: ProjectDefinition.st 10872 2012-11-27 08:58:37Z vranyj1 $'
 !
 
 version_CVS
@@ -6888,7 +6914,7 @@
 !
 
 version_SVN
-    ^ '$Id:: ProjectDefinition.st 10869 2012-11-23 11:30:05Z vranyj1                                                                $'
+    ^ '$Id:: ProjectDefinition.st 10872 2012-11-27 08:58:37Z vranyj1                                                                $'
 ! !
 
 ProjectDefinition initialize!
--- a/Smalltalk.st	Fri Nov 23 20:26:31 2012 +0000
+++ b/Smalltalk.st	Tue Nov 27 08:58:37 2012 +0000
@@ -1177,37 +1177,6 @@
     "
 ! !
 
-!Smalltalk class methodsFor:'change & update'!
-
-changed: what with: param
-    "Trigger a change event"
-
-    | ts |
-
-    "Experimental!!!!!!
-     Do not trigger many events if they're comming to fast"
-    ts := OperatingSystem getMillisecondTime.
-    TimeOfLastChangeEvent isNil ifTrue:[
-        TimeOfLastChangeEvent := ts.
-        NumberOfChangeEventsInLast200msecs := 0.
-        super changed: what with: param.
-        ^self.
-    ].
-    (ts - TimeOfLastChangeEvent) < 500"msecs" ifTrue:[
-        NumberOfChangeEventsInLast200msecs < 10 ifTrue:[
-            NumberOfChangeEventsInLast200msecs := 
-                NumberOfChangeEventsInLast200msecs + 1.
-            super changed: what with: param.
-        ].
-        ^self.
-    ].
-    TimeOfLastChangeEvent := ts.
-    NumberOfChangeEventsInLast200msecs := 0.
-    super changed: what with: param.
-
-    "Modified: / 23-02-2012 / 11:35:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !Smalltalk class methodsFor:'class management'!
 
 changeCategoryOf:aClass to:newCategory
@@ -7794,6 +7763,27 @@
        )
 !
 
+versionBuildNumber
+    "{ Pragma: +optSpace }"
+
+    "return the executables build number - that's the jenkins build #.
+     Empty if not built by jenkins"
+"
+%{  /* NOCONTEXT */
+    extern char *__getBuildNumberString();
+
+    RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) );
+%}.
+"
+    ^ ''
+
+    "
+     Smalltalk versionBuildNumber
+    "
+
+    "Created: / 26-11-2012 / 13:43:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 versionDate
     "{ Pragma: +optSpace }"
 
@@ -7847,7 +7837,7 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Smalltalk.st 10864 2012-11-19 22:57:08Z vranyj1 $'
+    ^ '$Id: Smalltalk.st 10872 2012-11-27 08:58:37Z vranyj1 $'
 !
 
 version_CVS
@@ -7855,5 +7845,5 @@
 !
 
 version_SVN
-    ^ '$Id:: Smalltalk.st 10864 2012-11-19 22:57:08Z vranyj1                                                                        $'
+    ^ '$Id:: Smalltalk.st 10872 2012-11-27 08:58:37Z vranyj1                                                                        $'
 ! !