ProjectDefinition.st
branchjv
changeset 18042 2aa6ef1820fe
parent 18040 a11a12546f23
parent 14988 3c06d7207200
child 18043 03660093fe98
equal deleted inserted replaced
18041:d17dbf11e306 18042:2aa6ef1820fe
   951             ].
   951             ].
   952         ].
   952         ].
   953     ].
   953     ].
   954 
   954 
   955     self classNamesAndAttributes:newSpec usingCompiler:compilerOrNil
   955     self classNamesAndAttributes:newSpec usingCompiler:compilerOrNil
       
   956 !
       
   957 
       
   958 updateExtensionMethodNamesUsingCompiler:compilerOrNil
       
   959     "set the set of extension methods
       
   960      Because this requires compilation of my extensionMethodNames-method, 
       
   961      a compiler can be passed in, which has to do the job.
       
   962      (this is used by the systembrowser to pass in a CodeGeneratorTool with undo support)"
       
   963 
       
   964     |newCode|
       
   965 
       
   966     newCode := self extensionMethodNames_code.
       
   967 
       
   968     (compilerOrNil ? self compilerClass)
       
   969         compile:newCode
       
   970         forClass:self theMetaclass
       
   971         inCategory:'description - contents'.
   956 ! !
   972 ! !
   957 
   973 
   958 
   974 
   959 !ProjectDefinition class methodsFor:'accessing - tests'!
   975 !ProjectDefinition class methodsFor:'accessing - tests'!
   960 
   976 
  1456         aTwoArgBlock
  1472         aTwoArgBlock
  1457             value: self excludedFromPreRequisites_code
  1473             value: self excludedFromPreRequisites_code
  1458             value: 'description'.
  1474             value: 'description'.
  1459     ].
  1475     ].
  1460 
  1476 
       
  1477     aTwoArgBlock
       
  1478         value: self subProjects_code
       
  1479         value: 'description'.
       
  1480 
  1461     (self monticelloPackageName notNil and:[self respondsTo:#monticelloTimestamps_code]) ifTrue:[
  1481     (self monticelloPackageName notNil and:[self respondsTo:#monticelloTimestamps_code]) ifTrue:[
  1462         aTwoArgBlock
  1482         aTwoArgBlock
  1463             value: self monticelloTimestamps_code
  1483             value: self monticelloTimestamps_code
  1464             value: 'description - monticello'.
  1484             value: 'description - monticello'.
  1465     ].
  1485     ].
  1656     "Modified: / 08-08-2006 / 19:24:34 / fm"
  1676     "Modified: / 08-08-2006 / 19:24:34 / fm"
  1657     "Created: / 17-08-2006 / 21:28:09 / cg"
  1677     "Created: / 17-08-2006 / 21:28:09 / cg"
  1658     "Modified: / 09-10-2006 / 14:27:20 / cg"
  1678     "Modified: / 09-10-2006 / 14:27:20 / cg"
  1659 !
  1679 !
  1660 
  1680 
       
  1681 subProjects_code
       
  1682     "generate the code of the #subProjects method.
       
  1683      Returns nil if no such code is needed (because there are none)"
       
  1684 
       
  1685     ^ String streamContents:[:s |
       
  1686         s nextPutLine:'subProjects'.
       
  1687         s nextPutLine:'    "list packages which are known as subprojects.'. 
       
  1688         s nextPutLine:'     The generated makefile will enter those and make there as well.'.
       
  1689         s nextPutLine:'     However: they are not forced to be loaded when a package is loaded;'. 
       
  1690         s nextPutLine:'     for those, redefine requiredPrerequisites"'.
       
  1691         s nextPutLine:''.
       
  1692         s nextPutLine:'    ^ #('.
       
  1693         ProjectDefinition allSubclassesDo:[:each |
       
  1694             (each package startsWith:(self package,'/')) ifTrue:[
       
  1695                 s nextPutLine:'        #''',each package,''''.
       
  1696             ]
       
  1697         ].
       
  1698         s nextPutLine:'    )'
       
  1699     ].
       
  1700 !
       
  1701 
  1661 svnRevisionNr_code: revisionNrOrNil
  1702 svnRevisionNr_code: revisionNrOrNil
  1662     ^ String streamContents:[:s |
  1703     ^ String streamContents:[:s |
  1663         s nextPutLine:'svnRevisionNr'.
  1704         s nextPutLine:'svnRevisionNr'.
  1664         s nextPutLine:'    "Return a SVN revision number of myself.'.
  1705         s nextPutLine:'    "Return a SVN revision number of myself.'.
  1665         s nextPutLine:'     This number is updated after a commit"'.
  1706         s nextPutLine:'     This number is updated after a commit"'.
  1860 !
  1901 !
  1861 
  1902 
  1862 subProjects
  1903 subProjects
  1863     "list packages which are known as subprojects. 
  1904     "list packages which are known as subprojects. 
  1864      The generated makefile will enter those and make there as well.
  1905      The generated makefile will enter those and make there as well.
  1865      However: they are not forced to be loaded when a package is loaded; for those,
  1906      However: they are not forced to be loaded when a package is loaded; 
  1866      redefine requiredPrerequisites."
  1907      for those, redefine requiredPrerequisites."
  1867 
  1908 
  1868     ^ #()
  1909     ^ #()
  1869 
  1910 
  1870     "Modified: / 17-08-2006 / 19:57:46 / cg"
  1911     "Modified: / 17-08-2006 / 19:57:46 / cg"
  1871 ! !
  1912 ! !
  5487      These methods are now in my safe"
  5528      These methods are now in my safe"
  5488 
  5529 
  5489     ^ safeForOverwrittenMethods notEmptyOrNil
  5530     ^ safeForOverwrittenMethods notEmptyOrNil
  5490 !
  5531 !
  5491 
  5532 
  5492 methodOverwrittenBy:aMethod
  5533 methodOverwrittenBy:anExtensionMethod
  5493     "return the (hidden) original method, which was located in another package
  5534     "return the (hidden) original method, which was located in another package
  5494      and which got overwritten by one of my extension methods. Nil if there is none."
  5535      and which got overwritten by one of my extension methods. Nil if there is none."
  5495 
  5536 
  5496     |mclass selector oldPackage|
  5537     |mclass selector oldPackage|
  5497 
  5538 
  5498     extensionOverwriteInfo isNil ifTrue:[^ nil].
  5539     extensionOverwriteInfo isNil ifTrue:[^ nil].
  5499 
  5540 
  5500     mclass := aMethod mclass.
  5541     mclass := anExtensionMethod mclass.
  5501     selector := aMethod selector.
  5542     selector := anExtensionMethod selector.
  5502     oldPackage := extensionOverwriteInfo at:(mclass name,'>>',selector) ifAbsent:nil.
  5543     oldPackage := extensionOverwriteInfo at:(mclass name,'>>',selector) ifAbsent:nil.
  5503     oldPackage isNil ifTrue:[^ nil].
  5544     oldPackage isNil ifTrue:[^ nil].
  5504     ^ oldPackage asPackageId projectDefinitionClass
  5545     ^ oldPackage asPackageId projectDefinitionClass
  5505         savedOverwrittenMethodForClass:mclass selector:selector.
  5546         savedOverwrittenMethodForClass:mclass selector:selector.
  5506 !
  5547 !
  5562     ].
  5603     ].
  5563 
  5604 
  5564     safeForOverwrittenMethods isNil ifTrue:[
  5605     safeForOverwrittenMethods isNil ifTrue:[
  5565         safeForOverwrittenMethods := Dictionary new.
  5606         safeForOverwrittenMethods := Dictionary new.
  5566     ].
  5607     ].
  5567     safeForOverwrittenMethods at:(aClass name -> selector) put:oldMethod.
  5608     safeForOverwrittenMethods at:(aClass name,'>>',selector) put:oldMethod.
  5568 !
  5609 !
  5569 
  5610 
  5570 restoreOverwrittenExtensionMethods
  5611 restoreOverwrittenExtensionMethods
  5571     "after unloading, tell other packages to restore any safed reference to any method
  5612     "after unloading, tell other packages to restore any safed reference to any method
  5572      which got overloaded by me."
  5613      which got overloaded by me.
       
  5614      Unfinished!!"
  5573 
  5615 
  5574     self extensionMethodNames pairWiseDo:[:className :selector |
  5616     self extensionMethodNames pairWiseDo:[:className :selector |
  5575         |class oldMethod oldPackage|
  5617         |class oldMethod oldPackage|
  5576 
  5618 
  5577         oldPackage := extensionOverwriteInfo at:(className,'>>',selector).
  5619         oldPackage := extensionOverwriteInfo at:(className,'>>',selector).
  5590 savedOverwrittenMethodForClass:aClass selector:aSelector
  5632 savedOverwrittenMethodForClass:aClass selector:aSelector
  5591     "return one of my saved original methods"
  5633     "return one of my saved original methods"
  5592 
  5634 
  5593     safeForOverwrittenMethods isNil ifTrue:[^ nil].
  5635     safeForOverwrittenMethods isNil ifTrue:[^ nil].
  5594     ^ safeForOverwrittenMethods at:(aClass name,'>>',aSelector) ifAbsent:nil
  5636     ^ safeForOverwrittenMethods at:(aClass name,'>>',aSelector) ifAbsent:nil
       
  5637 !
       
  5638 
       
  5639 savedOverwrittenMethods
       
  5640     "return my saved original methods"
       
  5641 
       
  5642     ^ safeForOverwrittenMethods ? #()
  5595 ! !
  5643 ! !
  5596 
  5644 
  5597 !ProjectDefinition class methodsFor:'private-loading'!
  5645 !ProjectDefinition class methodsFor:'private-loading'!
  5598 
  5646 
  5599 checkPrerequisitesForLoading
  5647 checkPrerequisitesForLoading
  6575 
  6623 
  6576     "Modified: / 07-08-2006 / 21:25:25 / fm"
  6624     "Modified: / 07-08-2006 / 21:25:25 / fm"
  6577     "Created: / 30-08-2007 / 18:48:09 / cg"
  6625     "Created: / 30-08-2007 / 18:48:09 / cg"
  6578 !
  6626 !
  6579 
  6627 
       
  6628 canHaveExtensions
       
  6629     "return true, if this class allows extensions from other packages.
       
  6630      Private classes, namespaces and projectDefinitions don't allow this"
       
  6631 
       
  6632     ^ self isAbstract
       
  6633 
       
  6634     "
       
  6635      Smalltalk allClasses select:[:each | each canHaveExtensions not]
       
  6636     "
       
  6637 
       
  6638     "Created: / 30-08-2006 / 15:29:49 / cg"
       
  6639 !
       
  6640 
  6580 classNames
  6641 classNames
  6581     "answer an array containing all the class names of the project's classes"
  6642     "answer an array containing all the class names of the project's classes"
  6582 
  6643 
  6583     ^ self classNamesAndAttributesAsSpecArray collect:[:entry | entry first].
  6644     ^ self classNamesAndAttributesAsSpecArray collect:[:entry | entry first].
  6584 
  6645 
  6918 
  6979 
  6919 !ProjectDefinition class methodsFor:'sanity checks'!
  6980 !ProjectDefinition class methodsFor:'sanity checks'!
  6920 
  6981 
  6921 validateDescription
  6982 validateDescription
  6922     "perform some consistency checks (set of classes in project same as those listed in description);
  6983     "perform some consistency checks (set of classes in project same as those listed in description);
  6923      called before checking in build support files"
  6984      called before checking in build support files.
       
  6985      Somewhat obsolete: use the ProjectChecker, which does more checks"
  6924 
  6986 
  6925     |emptyProjects nonProjects emptyOrNonProjects classesInImage 
  6987     |emptyProjects nonProjects emptyOrNonProjects classesInImage 
  6926      classesInDescription onlyInImage onlyInDescription missingPools myPackage|
  6988      classesInDescription onlyInImage onlyInDescription missingPools myPackage|
  6927 
  6989 
  6928     emptyProjects := Set withAll:self subProjects.
  6990     emptyProjects := Set withAll:self subProjects.
  6991                     missingPools add:eachPoolName.
  7053                     missingPools add:eachPoolName.
  6992                 ].
  7054                 ].
  6993             ].
  7055             ].
  6994         ].
  7056         ].
  6995     ].
  7057     ].
       
  7058 
  6996     missingPools notEmpty ifTrue:[
  7059     missingPools notEmpty ifTrue:[
  6997         (Dialog
  7060         (Dialog
  6998             confirm:('The following sharedpools are non-existent, or not pools:\\    '
  7061             confirm:('The following sharedpools are non-existent, or not pools:\\    '
  6999                     , ((missingPools
  7062                     , ((missingPools
  7000                             asSortedCollection
  7063                             asSortedCollection
  7005         ifFalse:[
  7068         ifFalse:[
  7006             AbortSignal raise
  7069             AbortSignal raise
  7007         ].
  7070         ].
  7008     ].
  7071     ].
  7009 
  7072 
       
  7073 "/ also found by ProjectChecker...
  7010     classesInImage ~= classesInDescription ifTrue:[
  7074     classesInImage ~= classesInDescription ifTrue:[
  7011         onlyInImage := (classesInImage reject:[:cls | classesInDescription includes:cls]).
  7075         onlyInImage := (classesInImage reject:[:cls | classesInDescription includes:cls]).
  7012         onlyInImage notEmpty ifTrue:[
  7076         onlyInImage notEmpty ifTrue:[
  7013             Transcript show:self name; show:': only in image: '; showCR:onlyInImage
  7077             Transcript show:self name; show:': only in image: '; showCR:onlyInImage
  7014         ].
  7078         ].
  7018         ].
  7082         ].
  7019         (Dialog confirm:'The set of classes in the image is different from the listed classes in the project definition.\\Proceed?' withCRs) ifFalse:[
  7083         (Dialog confirm:'The set of classes in the image is different from the listed classes in the project definition.\\Proceed?' withCRs) ifFalse:[
  7020             AbortSignal raiseRequest
  7084             AbortSignal raiseRequest
  7021         ]
  7085         ]
  7022     ].
  7086     ].
       
  7087 
  7023 "/    self validateOrderOfClasses
  7088 "/    self validateOrderOfClasses
  7024 
  7089 
  7025     "
  7090     "
  7026      squeak_vmMaker validateDescription
  7091      squeak_vmMaker validateDescription
  7027     "
  7092     "
  7102 !
  7167 !
  7103 
  7168 
  7104 isProjectDefinition
  7169 isProjectDefinition
  7105     "concrete i.e. not abstract"
  7170     "concrete i.e. not abstract"
  7106 
  7171 
  7107     ^ self ~~ ProjectDefinition "/ skip myself - I am abstract
  7172     ^ self isAbstract not
  7108 
  7173 
  7109     "Created: / 10-08-2006 / 16:24:02 / cg"
  7174     "Created: / 10-08-2006 / 16:24:02 / cg"
  7110     "Modified: / 08-02-2011 / 10:03:49 / cg"
  7175     "Modified: / 08-02-2011 / 10:03:49 / cg"
  7111 ! !
  7176 ! !
  7112 
  7177 
  7140 ! !
  7205 ! !
  7141 
  7206 
  7142 !ProjectDefinition class methodsFor:'documentation'!
  7207 !ProjectDefinition class methodsFor:'documentation'!
  7143 
  7208 
  7144 version
  7209 version
  7145     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.439 2013-03-26 13:21:07 cg Exp $'
  7210     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.444 2013-03-27 19:36:15 cg Exp $'
  7146 !
  7211 !
  7147 
  7212 
  7148 version_CVS
  7213 version_CVS
  7149     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.439 2013-03-26 13:21:07 cg Exp $'
  7214     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.444 2013-03-27 19:36:15 cg Exp $'
  7150 !
  7215 !
  7151 
  7216 
  7152 version_HG
  7217 version_HG
  7153 
  7218 
  7154     ^ '$Changeset: <not expanded> $'
  7219     ^ '$Changeset: <not expanded> $'