ProjectDefinition.st
changeset 14882 24cda9c60389
parent 14877 0e4127d94963
child 14885 eda1041261e5
equal deleted inserted replaced
14881:28ba52b80aa7 14882:24cda9c60389
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libbasic' }"
    12 "{ Package: 'stx:libbasic' }"
    13 
    13 
    14 Object subclass:#ProjectDefinition
    14 Object subclass:#ProjectDefinition
    15         instanceVariableNames:''
    15 	instanceVariableNames:''
    16         classVariableNames:'LibraryType GUIApplicationType NonGUIApplicationType
    16 	classVariableNames:'LibraryType GUIApplicationType NonGUIApplicationType
    17                 PackagesBeingLoaded Verbose AbbrevDictionary AccessLock'
    17 		PackagesBeingLoaded Verbose AbbrevDictionary AccessLock'
    18         poolDictionaries:''
    18 	poolDictionaries:''
    19         category:'System-Support-Projects'
    19 	category:'System-Support-Projects'
    20 !
    20 !
    21 
    21 
    22 ProjectDefinition class instanceVariableNames:'safeForOverwrittenMethods extensionOverwriteInfo projectIsLoaded'
    22 ProjectDefinition class instanceVariableNames:'safeForOverwrittenMethods extensionOverwriteInfo projectIsLoaded'
    23 
    23 
    24 "
    24 "
    25  No other class instance variables are inherited by this class.
    25  No other class instance variables are inherited by this class.
    26 "
    26 "
    27 !
    27 !
    28 
    28 
    29 Object subclass:#AbbrevEntry
    29 Object subclass:#AbbrevEntry
    30         instanceVariableNames:'className fileName category numClassInstVars'
    30 	instanceVariableNames:'className fileName category numClassInstVars'
    31         classVariableNames:''
    31 	classVariableNames:''
    32         poolDictionaries:''
    32 	poolDictionaries:''
    33         privateIn:ProjectDefinition
    33 	privateIn:ProjectDefinition
    34 !
    34 !
    35 
    35 
    36 !ProjectDefinition class methodsFor:'documentation'!
    36 !ProjectDefinition class methodsFor:'documentation'!
    37 
    37 
    38 buildingMakefiles
    38 buildingMakefiles
  1486         (productName productName_code)
  1486         (productName productName_code)
  1487         (description description_code)
  1487         (description description_code)
  1488         (companyName companyName_code)
  1488         (companyName companyName_code)
  1489         (legalCopyright legalCopyright_code)
  1489         (legalCopyright legalCopyright_code)
  1490         (applicationIconFileName applicationIconFileName_code)
  1490         (applicationIconFileName applicationIconFileName_code)
  1491         (productInstallDirBaseName productInstallDirBaseName_code)
       
  1492     ) pairsDo:[:selector :codeMethodSelector |
  1491     ) pairsDo:[:selector :codeMethodSelector |
  1493         (self class includesSelector:selector) ifFalse:[
  1492         (self class includesSelector:selector) ifFalse:[
  1494             aTwoArgBlock
  1493             aTwoArgBlock
  1495                 value: (self perform:codeMethodSelector)
  1494                 value: (self perform:codeMethodSelector)
  1496                 value: 'description - project information'.
  1495                 value: 'description - project information'.
  2314 
  2313 
  2315     ^ '-warnNonStandard'
  2314     ^ '-warnNonStandard'
  2316 
  2315 
  2317     "Created: / 18-08-2006 / 12:51:38 / cg"
  2316     "Created: / 18-08-2006 / 12:51:38 / cg"
  2318 ! !
  2317 ! !
       
  2318 
  2319 
  2319 
  2320 !ProjectDefinition class methodsFor:'description - project information'!
  2320 !ProjectDefinition class methodsFor:'description - project information'!
  2321 
  2321 
  2322 applicationAdditionalIconFileNames
  2322 applicationAdditionalIconFileNames
  2323     "Return the icon-filenames for additional icons of the application
  2323     "Return the icon-filenames for additional icons of the application
  4070      exept_expecco_application generateRequiredMakePrerequisites_make_dot_proto
  4070      exept_expecco_application generateRequiredMakePrerequisites_make_dot_proto
  4071      alspa_batch_application generateRequiredMakePrerequisites_make_dot_proto
  4071      alspa_batch_application generateRequiredMakePrerequisites_make_dot_proto
  4072     "
  4072     "
  4073 !
  4073 !
  4074 
  4074 
       
  4075 generateRequiredMakeReferences_bc_dot_mak
       
  4076     |myProjectId preRequisites|
       
  4077 
       
  4078     myProjectId := self package.
       
  4079     "Note: the trailing blank in 'CFLAGS_LOCAL=$(GLOBALDEFINES) '
       
  4080      is required!!
       
  4081      Use 'pushd' instead of 'cd', since cd is executed by borland make directly.
       
  4082      'popd' is not needed, since each line is executed in
       
  4083             an own cmd.exe process.
       
  4084      'popd' is not desierable, since it masks a possible
       
  4085             error return from the 'bmake'.
       
  4086     "
       
  4087 
       
  4088     preRequisites := self allPreRequisitesSorted:#effectivePreRequisites.
       
  4089     "these have been already built in preReq"
       
  4090     preRequisites removeAllFoundIn:(self allPreRequisites:#mandatoryPreRequisites).
       
  4091 
       
  4092     ^ String streamContents:[:s |
       
  4093         preRequisites do:[:eachProjectId |
       
  4094             s tab; nextPutAll:'pushd ';
       
  4095                    nextPutAll:(self msdosPathToPackage:eachProjectId from:myProjectId);
       
  4096                    nextPutLine:' & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "'.
       
  4097         ].
       
  4098     ].
       
  4099 
       
  4100     "
       
  4101      exept_expecco_application generateRequiredMakeReferences_bc_dot_mak
       
  4102      alspa_batch_application generateRequiredMakeReferences_bc_dot_mak
       
  4103     "
       
  4104 !
       
  4105 
       
  4106 generateRequiredMakeReferences_make_dot_proto
       
  4107     |libPath preRequisites|
       
  4108 
       
  4109     preRequisites := self allPreRequisitesSorted:#effectivePreRequisites.
       
  4110     "these have been already built in preReq"
       
  4111     preRequisites removeAllFoundIn:(self allPreRequisites:#mandatoryPreRequisites).
       
  4112 
       
  4113     ^ String streamContents:[:s |
       
  4114         preRequisites do:[:projectID |
       
  4115             libPath := self pathToPackage_unix:projectID.
       
  4116             s tab; nextPutAll: 'cd ', libPath; nextPutLine:' && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"'.
       
  4117         ].
       
  4118 
       
  4119         s cr.
       
  4120     ].
       
  4121 
       
  4122     "
       
  4123      exept_expecco_application generateRequiredMakeReferences_make_dot_proto
       
  4124      alspa_batch_application generateRequiredMakeReferences_make_dot_proto
       
  4125     "
       
  4126 !
       
  4127 
  4075 generateSubDirectories
  4128 generateSubDirectories
  4076     ^ String streamContents:[:s |
  4129     ^ String streamContents:[:s |
  4077         self subProjects
  4130         self subProjects
  4078             do:[:eachProjectID |
  4131             do:[:eachProjectID |
  4079                 s space; nextPutAll:(self unixPathToPackage:eachProjectID from:self package)
  4132                 s space; nextPutAll:(self unixPathToPackage:eachProjectID from:self package)
  6101      alspa_batch_application allPreRequisites"
  6154      alspa_batch_application allPreRequisites"
  6102     "Modified: / 13-04-2011 / 15:30:45 / sr"
  6155     "Modified: / 13-04-2011 / 15:30:45 / sr"
  6103     "Modified (comment): / 06-09-2011 / 08:26:06 / cg"
  6156     "Modified (comment): / 06-09-2011 / 08:26:06 / cg"
  6104 !
  6157 !
  6105 
  6158 
       
  6159 allPreRequisites:aSelector
       
  6160     "answer all (recursive) prerequisite project ids of myself - in random order."
       
  6161 
       
  6162     |result|
       
  6163 
       
  6164     result := self 
       
  6165         allPreRequisites:aSelector withParentDo:[:parent :prereq | 
       
  6166             prereq = self package ifTrue:[
       
  6167                 Transcript showCR:('oops: %1 depends on itself' bindWith:prereq)
       
  6168             ].
       
  6169         ].
       
  6170     result remove:self package ifAbsent:[].
       
  6171     ^ result.
       
  6172 
       
  6173     "
       
  6174      stx_libbasic allPreRequisites
       
  6175      stx_libbasic2 allPreRequisites
       
  6176      stx_libview2 allPreRequisites
       
  6177      ubs_application allPreRequisites
       
  6178      ubs_application allPreRequisitesSorted
       
  6179      exept_expecco_application allPreRequisites
       
  6180      exept_expeccoNET_application allPreRequisites
       
  6181      alspa_batch_application allPreRequisites"
       
  6182     "Modified: / 13-04-2011 / 15:30:45 / sr"
       
  6183     "Modified (comment): / 06-09-2011 / 08:26:06 / cg"
       
  6184 !
       
  6185 
       
  6186 allPreRequisites:aSelector withParentDo:aBlock
       
  6187     "answer all (recursive) prerequisite project ids of myself - in random order.
       
  6188      If we exclude a project, but one of our prerequisite projects depends on it,
       
  6189      then what ????"
       
  6190 
       
  6191     |setOfAllPreRequisites toAdd|
       
  6192 
       
  6193     setOfAllPreRequisites := Set new.
       
  6194     toAdd := Set withAll:(self perform:aSelector).
       
  6195 
       
  6196     "is a subproject really a prerequisite??
       
  6197      No, it works the other way: parent projects are prerequisites of sub projects,
       
  6198      so the following line has been deleted.
       
  6199      Unfortunately the meaning of 'subproject' has never been well defined. SV."
       
  6200 "/    toAdd addAll:self effectiveSubProjects.
       
  6201 
       
  6202     [toAdd notEmpty] whileTrue:[
       
  6203         |aPreRequisiteProjectID def|
       
  6204 
       
  6205         aPreRequisiteProjectID := toAdd removeFirst.
       
  6206         (setOfAllPreRequisites includes:aPreRequisiteProjectID) ifFalse:[
       
  6207             setOfAllPreRequisites add:aPreRequisiteProjectID.
       
  6208 
       
  6209             def := self definitionClassForPackage:aPreRequisiteProjectID.
       
  6210             def isNil ifTrue:[
       
  6211                 Transcript showCR:'ProjectDefinition ', aPreRequisiteProjectID, ' is missing - cannot find its preRequisites.'.
       
  6212             ] ifFalse:[
       
  6213                 (def perform:aSelector)
       
  6214                     select:[:eachSubPreRequisite | (setOfAllPreRequisites includes:eachSubPreRequisite) not]
       
  6215                     thenDo:[:eachSubPreRequisite |
       
  6216                                 Verbose == true ifTrue:[
       
  6217                                     Transcript show:'ProjectDefinition preRequisites: '; showCR:(aPreRequisiteProjectID, ' requires ', eachSubPreRequisite).
       
  6218                                 ].
       
  6219                                 aBlock value:def value:eachSubPreRequisite.
       
  6220                                 toAdd add:eachSubPreRequisite
       
  6221                            ].
       
  6222 
       
  6223                 "but subprojects of our prerequisites are also prerequisites"
       
  6224                 def effectiveSubProjects
       
  6225                     select:[:eachSubSubRequisite | eachSubSubRequisite ~= self package and:[ (setOfAllPreRequisites includes:eachSubSubRequisite) not ]]
       
  6226                     thenDo:[:eachSubSubRequisite |
       
  6227                                 Verbose == true ifTrue:[
       
  6228                                     Transcript show:'ProjectDefinition preRequisites: '; showCR:(aPreRequisiteProjectID, ' hasSub ', eachSubSubRequisite).
       
  6229                                 ].
       
  6230                                 aBlock value:def value:eachSubSubRequisite.
       
  6231                                 toAdd add:eachSubSubRequisite
       
  6232                            ].
       
  6233             ].
       
  6234         ]
       
  6235     ].
       
  6236     ^ setOfAllPreRequisites.
       
  6237 
       
  6238     "
       
  6239      stx_libbasic allPreRequisites
       
  6240      stx_libbasic2 allPreRequisites
       
  6241      stx_libview2 allPreRequisites
       
  6242      ubs_application allPreRequisites
       
  6243      ubs_application allPreRequisitesSorted
       
  6244      exept_expecco_application allPreRequisites
       
  6245      exept_expeccoNET_application allPreRequisites
       
  6246      alspa_batch_application allPreRequisites
       
  6247     "
       
  6248 
       
  6249     "Created: / 13-04-2011 / 15:23:21 / sr"
       
  6250     "Modified: / 20-07-2012 / 18:29:31 / cg"
       
  6251 !
       
  6252 
  6106 allPreRequisitesSorted
  6253 allPreRequisitesSorted
  6107     "answer all the prerequisites of this projects sorted in
  6254     "answer all the prerequisites of this projects sorted in
  6108      the order they are needed.
  6255      the order they are needed.
  6109      Use this to e.g. compile packages in the dependency order"
  6256      Use this to e.g. compile packages in the dependency order"
  6110 
  6257 
  6128                 fold:[:d1 :d2| d1 addAll:d2; yourself]) keys
  6275                 fold:[:d1 :d2| d1 addAll:d2; yourself]) keys
  6129         ] ifFalse:[
  6276         ] ifFalse:[
  6130             "extensionPackages should alread be in the #mandatoryPreRequisites"
  6277             "extensionPackages should alread be in the #mandatoryPreRequisites"
  6131             effective := def effectivePreRequisites union:def extensionPackages.
  6278             effective := def effectivePreRequisites union:def extensionPackages.
  6132             effective do:[:eachPrerequisitePackageID|
  6279             effective do:[:eachPrerequisitePackageID|
       
  6280                 self assert:(eachPrerequisitePackageID ~= eachPackageID).
       
  6281                 orderedTuples add:(Array with:eachPrerequisitePackageID with:eachPackageID).
       
  6282             ].
       
  6283         ].
       
  6284     ].
       
  6285 
       
  6286     (orderedTuples includes:[:el | el first = el second]) ifTrue:[
       
  6287         self halt
       
  6288     ].
       
  6289     sortedPackages := orderedTuples topologicalSort.
       
  6290 
       
  6291     "packages which only result from extension methods are used for computing the sort order,
       
  6292      but they are not added, if not present in the first place"
       
  6293     ^ sortedPackages select:[:eachProject| allPreRequisites includes:eachProject]
       
  6294 
       
  6295     "
       
  6296      stx_libbasic allPreRequisitesSorted
       
  6297      stx_libbasic2 allPreRequisitesSorted
       
  6298      stx_libwidg2 allPreRequisitesSorted
       
  6299      exept_expecco allPreRequisitesSorted
       
  6300      alspa_batch_application allPreRequisitesSorted
       
  6301      ubs_application allPreRequisitesSorted
       
  6302     "
       
  6303 
       
  6304     "Modified: / 13-04-2011 / 15:19:13 / sr"
       
  6305     "Modified (comment): / 13-03-2013 / 00:40:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  6306 !
       
  6307 
       
  6308 allPreRequisitesSorted:aSelector
       
  6309     "answer all the prerequisites of this projects sorted in
       
  6310      the order they are needed.
       
  6311      Use this to e.g. compile packages in the dependency order"
       
  6312 
       
  6313     |allPreRequisites orderedTuples sortedPackages|
       
  6314 
       
  6315     orderedTuples := OrderedCollection new.
       
  6316     allPreRequisites := self allPreRequisites:aSelector.
       
  6317 
       
  6318     "/JV@2013-03-13: Added asSortedCollection to make the order of packages
       
  6319     "/as stable as possible. Makes merging of makefiles a lot easier.
       
  6320     allPreRequisites asSortedCollection do:[:eachPackageID |
       
  6321         |def preRequisites|
       
  6322 
       
  6323         self assert:(eachPackageID ~= self package).
       
  6324         orderedTuples add:(Array with:eachPackageID with:self package).
       
  6325 
       
  6326         def := self definitionClassForPackage:eachPackageID.
       
  6327         def isNil ifTrue:[
       
  6328             Transcript showCR:'Warning: no definition class for package: ', eachPackageID.
       
  6329             ((self searchForPreRequisites: eachPackageID) 
       
  6330                 fold:[:d1 :d2| d1 addAll:d2; yourself]) keys
       
  6331         ] ifFalse:[
       
  6332             preRequisites := def perform:aSelector.
       
  6333             preRequisites removeAllFoundIn:def excludedFromPreRequisites.
       
  6334             preRequisites do:[:eachPrerequisitePackageID|
  6133                 self assert:(eachPrerequisitePackageID ~= eachPackageID).
  6335                 self assert:(eachPrerequisitePackageID ~= eachPackageID).
  6134                 orderedTuples add:(Array with:eachPrerequisitePackageID with:eachPackageID).
  6336                 orderedTuples add:(Array with:eachPrerequisitePackageID with:eachPackageID).
  6135             ].
  6337             ].
  6136         ].
  6338         ].
  6137     ].
  6339     ].
  6221      alspa_batch_application allPreRequisites
  6423      alspa_batch_application allPreRequisites
  6222     "
  6424     "
  6223 
  6425 
  6224     "Created: / 13-04-2011 / 15:23:21 / sr"
  6426     "Created: / 13-04-2011 / 15:23:21 / sr"
  6225     "Modified: / 20-07-2012 / 18:29:31 / cg"
  6427     "Modified: / 20-07-2012 / 18:29:31 / cg"
       
  6428 !
       
  6429 
       
  6430 allReferences
       
  6431     "answer all (recursive) projects to which I refer - in random order."
       
  6432 
       
  6433     |result|
       
  6434 
       
  6435     result := self 
       
  6436         allPreRequisites:#referencedPreRequisites withParentDo:[:parent :prereq | 
       
  6437             prereq = self package ifTrue:[
       
  6438                 Transcript showCR:('oops: %1 depends on itself' bindWith:prereq)
       
  6439             ].
       
  6440         ].
       
  6441     result remove:self package ifAbsent:[].
       
  6442     ^ result.
       
  6443 
       
  6444     "
       
  6445      stx_libbasic allReferences
       
  6446      stx_libbasic2 allReferences
       
  6447      stx_libview2 allReferences
       
  6448      ubs_application allReferences
       
  6449      ubs_application allReferences
       
  6450      exept_expecco_application allReferences
       
  6451      exept_expeccoNET_application allReferences
       
  6452      alspa_batch_application allReferences
       
  6453     "
  6226 !
  6454 !
  6227 
  6455 
  6228 effectivePreRequisites
  6456 effectivePreRequisites
  6229     "get the preRequisites, that are not excluded.
  6457     "get the preRequisites, that are not excluded.
  6230      This method appears to be obsolete, because its functionality
  6458      This method appears to be obsolete, because its functionality
  6983 ! !
  7211 ! !
  6984 
  7212 
  6985 !ProjectDefinition class methodsFor:'documentation'!
  7213 !ProjectDefinition class methodsFor:'documentation'!
  6986 
  7214 
  6987 version
  7215 version
  6988     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.428 2013-03-15 10:32:13 stefan Exp $'
  7216     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.429 2013-03-15 13:40:24 stefan Exp $'
  6989 !
  7217 !
  6990 
  7218 
  6991 version_CVS
  7219 version_CVS
  6992     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.428 2013-03-15 10:32:13 stefan Exp $'
  7220     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.429 2013-03-15 13:40:24 stefan Exp $'
  6993 !
  7221 !
  6994 
  7222 
  6995 version_SVN
  7223 version_SVN
  6996     ^ '§ Id: ProjectDefinition.st 10645 2011-06-09 15:28:45Z vranyj1  §'
  7224     ^ '§ Id: ProjectDefinition.st 10645 2011-06-09 15:28:45Z vranyj1  §'
  6997 ! !
  7225 ! !