class: ProjectDefinition
authorStefan Vogel <sv@exept.de>
Fri, 19 Dec 2014 15:18:43 +0100
changeset 17229 e8ed2a58e37e
parent 17228 a219a717e0aa
child 17230 c61f862aae61
class: ProjectDefinition changed: #bmake_dot_mak #subProjectMakeCallsUsing: Check errors on subproject make
ProjectDefinition.st
--- a/ProjectDefinition.st	Fri Dec 19 14:06:27 2014 +0100
+++ b/ProjectDefinition.st	Fri Dec 19 15:18:43 2014 +0100
@@ -771,8 +771,146 @@
     "Modified (comment): / 28-06-2013 / 11:25:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-
-
+!ProjectDefinition class methodsFor:'accessing - hg'!
+
+hgBinaryRevision
+
+    "
+    Answers Mercurial revision from which the package was compiled.
+    If no binary revision is available, returns nil."
+
+
+    | revInfo |
+
+    self binaryRevisionString notNil ifTrue:[
+        revInfo := HGRevisionInfo readFrom: self binaryRevisionString onError:[nil].
+        revInfo notNil ifTrue:[
+            ^revInfo changesetId
+        ].
+    ].
+    ^nil
+
+
+    "
+        stx_libbasic hgBinaryRevision
+        stx_libsvn hgBinaryRevision
+        stx_libscm_mercurial hgBinaryRevision
+
+    "
+
+    "Created: / 20-11-2012 / 23:58:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hgLogicalRevision
+
+    "
+    Answers Mercurial revision on which is this package based on logically.
+
+    Revision is computed as follows:
+        1) Look, if receiver's version_HG method has a (hidden) annotation HGRevision:, 
+           if so, return its value.
+        2) If receiver's binary revision is not nil, return it.
+        3) Look into a package directory and if there is a Mercurial repository,
+           return working copy's revision"
+
+    | versionMethod versionAnnotation revInfo pkgDir repoDir repo |
+
+    "1 --- "
+
+    versionMethod := self class compiledMethodAt: HGSourceCodeManager nameOfVersionMethodInClasses.
+    versionMethod notNil ifTrue:[
+        versionAnnotation := versionMethod annotationAt: #HGRevision:.
+        versionAnnotation notNil ifTrue:[
+            ^versionAnnotation revision
+        ].
+    ] ifFalse:[
+        HGSourceCodeManager compileVersionMethod:HGSourceCodeManager nameOfVersionMethodInClasses of:self for:'$Changeset: <not expanded> $'.
+        versionMethod := self class compiledMethodAt: HGSourceCodeManager nameOfVersionMethodInClasses.
+    ].
+    
+    "2 --- "
+    self binaryRevisionString notNil ifTrue:[
+        revInfo := HGRevisionInfo readFrom: self binaryRevisionString onError:[nil].
+        revInfo notNil ifTrue:[
+            ^revInfo changesetId
+        ].
+    ].
+
+    "3 --- "
+    pkgDir := Smalltalk getPackageDirectoryForPackage: self package.
+    pkgDir notNil ifTrue:[
+        repoDir := HGRepository discover: pkgDir.
+        repoDir notNil ifTrue:[
+            | id |
+
+            repo := HGRepository on: repoDir.
+            id := repo workingCopy changeset id.
+            versionMethod annotateWith: (HGRevisionAnnotation revision: id).
+            ^id
+        ]
+    ].
+
+    "4 --- "
+    self breakPoint: #jv.
+    ^nil
+
+
+    "
+        stx_libbasic hgLogicalRevision
+        stx_libsvn hgLogicalRevision
+        stx_libscm_mercurial hgLogicalRevision
+
+    "
+
+    "Created: / 20-11-2012 / 23:54:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-01-2013 / 13:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ProjectDefinition class methodsFor:'accessing - hg - settings'!
+
+hgEnsureCopyrightMethod
+    "If true, then #copyright method is automatically compiled in each class
+     (but iff project definition defines it)
+
+     Default is true (compile such method) but if the repository is mirror of CVS and
+     you want to merge back to CVS at some point, you may want to not compile them
+     to keep changes against CVS minimal"
+
+    ^true "default"
+
+    "Created: / 09-10-2013 / 11:48:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hgEnsureVersion_HGMethod
+    "If true, then #version_HG method is automatically compiled in each class.
+
+     Default is true (compile such method) but if the repository is mirror of CVS and
+     you want to merge back to CVS at some point, you may want to not compile them
+     to keep changes against CVS minimal. 
+
+     If false, version_HG is compiled only in classes that has been modified
+     and commited.
+
+     Note that Mercurial can live without them
+     just fine"
+
+    ^true "default"
+
+    "Created: / 09-10-2013 / 11:50:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hgRemoveContainesForDeletedClasses
+    "If true, then containers for removed classes are __AUTOMATICALLY__ removed from the
+     repositoru. If false, obsolete containes are kept.
+
+     Default is true (remove obsolete containers) but if the repository is mirror of CVS and
+     you want to merge back to CVS at some point, you may want to return false to avoid deletions
+     of obsolete files. Usefull when branching off an old CVS repo with loads of mess."
+
+    ^true "default"
+
+    "Created: / 21-05-2013 / 16:44:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
 
 !ProjectDefinition class methodsFor:'accessing - packaging'!
 
@@ -2077,6 +2215,30 @@
     "Modified: / 17-08-2006 / 19:59:26 / cg"
 ! !
 
+!ProjectDefinition class methodsFor:'description - actions - hg'!
+
+hgPostLoad
+    <postLoad>
+
+    | dir repo versionMethod |
+    "Eventually update an version_HG"
+
+    self binaryRevisionString isNil ifTrue:[
+        dir := Smalltalk getPackageDirectoryForPackage: self package.
+        dir notNil ifTrue:[  
+            dir := HGRepository discover: dir.
+            dir notNil ifTrue:[
+                repo := HGRepository on: dir.
+                versionMethod := HGSourceCodeManager ensureVersionMethodInClass: self package: self package.
+                versionMethod annotateWith: 
+                    (HGRevisionAnnotation revision: repo workingCopy changesetId)
+            ].
+        ]
+    ].
+
+    "Created: / 26-11-2012 / 13:06:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 07-02-2014 / 10:59:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
 
 !ProjectDefinition class methodsFor:'description - classes'!
 
@@ -2504,6 +2666,35 @@
     "Created: / 18-08-2006 / 12:51:38 / cg"
 ! !
 
+!ProjectDefinition class methodsFor:'description - java'!
+
+javaBundle
+    "Defines a Java code bundle provided by this package.
+     Used by STX:LIBJAVA"
+
+    ^nil
+
+    "Created: / 15-01-2013 / 16:49:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassPath
+
+    "Defines a Java class path containing java classes/jars
+     required by this package"
+
+    ^#()
+
+    "Created: / 13-12-2011 / 23:48:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaSourcePath
+
+    "Defines paths to Java source files (for packages that
+     contains Java code"
+    ^#()
+
+    "Created: / 13-12-2011 / 23:49:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
 
 !ProjectDefinition class methodsFor:'description - project information'!
 
@@ -4439,9 +4630,9 @@
             s nextPutLine:'@echo "***********************************"'.
             s nextPutLine:'@echo "Buildung ',(packageID copyReplaceAll:$: with:$/).
             s nextPutLine:'@echo "***********************************"'.
-            s nextPutLine:'@cd ', (self msdosPathToPackage:packageID from:(self package)).
-            s nextPutAll:'@'; nextPutLine:callString.
-            s nextPutLine:'@cd ', (self msdosPathToPackage:(self package) from:packageID).
+            s nextPutLine:'@pushd ', (self msdosPathToPackage:packageID from:(self package)).
+            s nextPutAll:'@'; nextPutAll:callString; nextPutLine:' || exit /b "%errorlevel%"'.
+            s nextPutLine:'@popd'.
             s cr.
         ]
     ]
@@ -4598,12 +4789,7 @@
 @IF "%%HGROOT%%" NEQ "" SET DEFINES=%%DEFINES%% "-DHGROOT=%%HGROOT%%"
 make.exe -N -f bc.mak  %%DEFINES%% %%*
 
-@REM does not work if bmake is called with DEFINES=LOCALDEFINES
-@REM @IF "%%1" EQU "exe" GOTO finish
-
 %(SUBPROJECT_BMAKE_CALLS)
-
-:finish
 '
 
     "Created: / 17-08-2006 / 20:04:14 / cg"
@@ -7657,11 +7843,11 @@
 !ProjectDefinition class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.524 2014-12-19 13:06:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.525 2014-12-19 14:18:43 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.524 2014-12-19 13:06:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.525 2014-12-19 14:18:43 stefan Exp $'
 !
 
 version_SVN