--- a/ProjectDefinition.st Mon Mar 18 17:55:24 2013 +0000
+++ b/ProjectDefinition.st Mon Mar 18 22:12:08 2013 +0000
@@ -90,6 +90,7 @@
"
! !
+
!ProjectDefinition class methodsFor:'instance creation'!
definitionClassForMonticelloPackage:aMonicelloPackagename
@@ -223,6 +224,7 @@
"Modified: / 17-08-2006 / 17:24:23 / cg"
! !
+
!ProjectDefinition class methodsFor:'accessing'!
directory
@@ -998,6 +1000,7 @@
"Modified: / 08-08-2011 / 14:59:45 / cg"
! !
+
!ProjectDefinition class methodsFor:'class initialization'!
initialize
@@ -1119,6 +1122,7 @@
"Modified: / 20-08-2011 / 23:32:32 / cg"
! !
+
!ProjectDefinition class methodsFor:'code generation'!
applicationIconFileName_code
@@ -1490,7 +1494,6 @@
(companyName companyName_code)
(legalCopyright legalCopyright_code)
(applicationIconFileName applicationIconFileName_code)
- (productInstallDirBaseName productInstallDirBaseName_code)
) pairsDo:[:selector :codeMethodSelector |
(self class includesSelector:selector) ifFalse:[
aTwoArgBlock
@@ -1570,58 +1573,7 @@
"Modified: / 09-10-2006 / 14:27:20 / cg"
!
-preRequisites_code
- "generate the code of the #preRequisites method"
-
- |preRequisites searchedPreRequisites importantReason|
-
- searchedPreRequisites := self searchForPreRequisites.
- preRequisites := Set new
- addAll: searchedPreRequisites keys;
- removeAllFoundIn:self excludedFromPreRequisites;
- remove:self package ifAbsent:[];
- yourself.
-
- ^ String streamContents:[:s |
- s nextPutLine:'preRequisites'.
- s nextPutLine:' "list all required packages.'.
- s nextPutLine:' This list can be maintained manually or (better) generated and'.
- s nextPutLine:' updated by scanning the superclass hierarchies and looking for'.
- s nextPutLine:' global variable accesses. (the browser has a menu function for that)'.
- s nextPutLine:' However, often too much is found, and you may want to explicitely'.
- s nextPutLine:' exclude individual packages in the #excludedFromPreRequisites method.'.
- s nextPutLine:' If you have explicit preqrequisites, define them in the #includedInPreRequisites method."'.
- s nextPutLine:''.
- s nextPutLine:' ^ #('.
- preRequisites asSortedCollection do:[:eachPackageID |
- |reason|
-
- s spaces:8.
- eachPackageID asSymbol storeOn:s.
- reason := searchedPreRequisites at:eachPackageID ifAbsent:nil.
- reason notEmptyOrNil ifTrue:[
- "superclasses are really important"
- importantReason := reason detect:[:eachReasonString|
- eachReasonString includesString:' superclass '
- ] ifNone:[reason anElement].
- s nextPutAll:' "'; nextPutAll:importantReason; nextPutAll:' "'.
- ].
- s cr.
- ].
- s nextPutLine:' )'
- ].
-
- "
- bosch_dapasx_application preRequisites_code
- demo_demoApp1 preRequisites_code
- stx_libbasic3 preRequisites_code
- stx_libtool2 preRequisites_code
- "
-
- "Modified: / 08-08-2006 / 19:24:34 / fm"
- "Created: / 17-08-2006 / 21:28:09 / cg"
- "Modified: / 09-10-2006 / 14:27:20 / cg"
-!
+
productInstallDirBaseName_code
^ String streamContents:[:s |
@@ -1673,7 +1625,7 @@
|preRequisitesColl preRequisites|
preRequisitesColl := self searchForPreRequisites.
- preRequisites := self searchForPreRequisites second.
+ preRequisites := preRequisitesColl second.
preRequisites
removeAllKeys:self excludedFromPreRequisites ifAbsent:[];
removeAllKeys:preRequisitesColl first keys ifAbsent:[]. "remove the mandatory prerequisites"
@@ -1812,6 +1764,7 @@
"Created: / 23-08-2006 / 14:27:32 / cg"
! !
+
!ProjectDefinition class methodsFor:'description'!
excludedFromPreRequisites
@@ -1882,7 +1835,8 @@
ifTrue:[
"Still no project definition - maybe it does not exist?"
Transcript showCR:'Warning: no definition class for package: ', packageId.
- (ProjectDefinition searchForPreRequisites:packageId) keys
+ ((self searchForPreRequisites:packageId)
+ fold:[:d1 :d2| d1 addAll:d2; yourself]) keys
]
ifFalse:[ def effectivePreRequisites ]
@@ -1926,6 +1880,7 @@
"Modified: / 17-08-2006 / 19:57:46 / cg"
! !
+
!ProjectDefinition class methodsFor:'description - actions'!
postLoadAction
@@ -1989,6 +1944,7 @@
"Created: / 23-01-2007 / 19:08:27 / cg"
! !
+
!ProjectDefinition class methodsFor:'description - compilation'!
additionalBaseAddressDefinition_bc_dot_mak
@@ -2802,6 +2758,7 @@
"Modified: / 17-08-2006 / 19:46:29 / cg"
! !
+
!ProjectDefinition class methodsFor:'file generation'!
apspecFilename
@@ -3304,6 +3261,7 @@
"Created: / 07-09-2006 / 17:07:00 / cg"
! !
+
!ProjectDefinition class methodsFor:'file mappings'!
autopackage_default_dot_apspec_mappings
@@ -3591,6 +3549,7 @@
replaceAny:':' with:$_
! !
+
!ProjectDefinition class methodsFor:'file mappings support'!
classNamesByCategory
@@ -4129,6 +4088,59 @@
"
!
+generateRequiredMakeReferences_bc_dot_mak
+ |myProjectId preRequisites|
+
+ myProjectId := self package.
+ "Note: the trailing blank in 'CFLAGS_LOCAL=$(GLOBALDEFINES) '
+ is required!!
+ Use 'pushd' instead of 'cd', since cd is executed by borland make directly.
+ 'popd' is not needed, since each line is executed in
+ an own cmd.exe process.
+ 'popd' is not desierable, since it masks a possible
+ error return from the 'bmake'.
+ "
+
+ preRequisites := self allPreRequisitesSorted:#effectivePreRequisites.
+ "these have been already built in preReq"
+ preRequisites removeAllFoundIn:(self allPreRequisites:#mandatoryPreRequisites).
+
+ ^ String streamContents:[:s |
+ preRequisites do:[:eachProjectId |
+ s tab; nextPutAll:'pushd ';
+ nextPutAll:(self msdosPathToPackage:eachProjectId from:myProjectId);
+ nextPutLine:' & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "'.
+ ].
+ ].
+
+ "
+ exept_expecco_application generateRequiredMakeReferences_bc_dot_mak
+ alspa_batch_application generateRequiredMakeReferences_bc_dot_mak
+ "
+!
+
+generateRequiredMakeReferences_make_dot_proto
+ |libPath preRequisites|
+
+ preRequisites := self allPreRequisitesSorted:#effectivePreRequisites.
+ "these have been already built in preReq"
+ preRequisites removeAllFoundIn:(self allPreRequisites:#mandatoryPreRequisites).
+
+ ^ String streamContents:[:s |
+ preRequisites do:[:projectID |
+ libPath := self pathToPackage_unix:projectID.
+ s tab; nextPutAll: 'cd ', libPath; nextPutLine:' && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"'.
+ ].
+
+ s cr.
+ ].
+
+ "
+ exept_expecco_application generateRequiredMakeReferences_make_dot_proto
+ alspa_batch_application generateRequiredMakeReferences_make_dot_proto
+ "
+!
+
generateSubDirectories
^ String streamContents:[:s |
self subProjects
@@ -4242,6 +4254,7 @@
^ self subProjectMakeCallsUsing:'call vcmake %1 %2'.
! !
+
!ProjectDefinition class methodsFor:'file templates'!
autopackage_default_dot_apspec
@@ -4680,6 +4693,7 @@
"Modified: / 04-09-2012 / 11:45:49 / cg"
! !
+
!ProjectDefinition class methodsFor:'loading'!
ensureFullyLoaded
@@ -4846,6 +4860,7 @@
"Modified: / 20-11-2012 / 23:06:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+
!ProjectDefinition class methodsFor:'misc ui support'!
iconInBrowserSymbol
@@ -4860,6 +4875,7 @@
^ super iconInBrowserSymbol
! !
+
!ProjectDefinition class methodsFor:'private'!
abbrevs
@@ -5317,7 +5333,7 @@
].
"/ need them also...
- self effectivePreRequisites do:[:eachPreRequisitePackage |
+ self mandatoryPreRequisites do:[:eachPreRequisitePackage |
addPackage value:eachPreRequisitePackage
].
@@ -5463,6 +5479,7 @@
"Created: / 03-06-2011 / 17:01:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+
!ProjectDefinition class methodsFor:'private-extension handling'!
hasSavedOverwrittenMethods
@@ -5577,6 +5594,7 @@
^ safeForOverwrittenMethods at:(aClass name,'>>',aSelector) ifAbsent:nil
! !
+
!ProjectDefinition class methodsFor:'private-loading'!
checkPrerequisitesForLoading
@@ -6111,6 +6129,7 @@
]
! !
+
!ProjectDefinition class methodsFor:'private-prerequisites'!
addReferencesToClassesFromGlobalsIn:aSetOfClasses to:usedClassReasons
@@ -6168,12 +6187,7 @@
allPreRequisites
"answer all (recursive) prerequisite project ids of myself - in random order."
- ^ self
- allPreRequisitesWithParentDo:[:parent :prereq |
- prereq = self package ifTrue:[
- Transcript showCR:('oops: %1 depends on itself' bindWith:prereq)
- ].
- ]
+ ^ self allPreRequisites:#effectivePreRequisites.
"
stx_libbasic allPreRequisites
@@ -6188,59 +6202,34 @@
"Modified (comment): / 06-09-2011 / 08:26:06 / cg"
!
-allPreRequisitesSorted
- "answer all the prerequisites of this projects sorted in
- the order they are needed.
- Use this to e.g. compile packages in the dependency order"
-
- |allPreRequisites orderedTuples effective sortedPackages|
-
- orderedTuples := OrderedCollection new.
- allPreRequisites := self allPreRequisites.
-
- "/JV@2013-03-13: Added asSortedCollection to make the order of packages
- "/as stable as possible. Makes merging of makefiles a lot easier.
- allPreRequisites asSortedCollection do:[:eachPackageID |
- |def|
-
- self assert:(eachPackageID ~= self package).
- orderedTuples add:(Array with:eachPackageID with:self package).
-
- def := self definitionClassForPackage:eachPackageID.
- def isNil ifTrue:[
- Transcript showCR:'Warning: no definition class for package: ', eachPackageID.
- effective := (self searchForPreRequisites: eachPackageID) keys.
- ] ifFalse:[
- "extensionPackages should alread be in the #mandatoryPreRequisites"
- effective := def effectivePreRequisites union:def extensionPackages.
- effective do:[:eachPrerequisitePackageID|
- self assert:(eachPrerequisitePackageID ~= eachPackageID).
- orderedTuples add:(Array with:eachPrerequisitePackageID with:eachPackageID).
+allPreRequisites:aSelector
+ "answer all (recursive) prerequisite project ids of myself - in random order."
+
+ |result|
+
+ result := self
+ allPreRequisites:aSelector withParentDo:[:parent :prereq |
+ prereq = self package ifTrue:[
+ Transcript showCR:('oops: %1 depends on itself' bindWith:prereq)
].
].
- ].
-
- (orderedTuples detect:[:el | el first = el second] ifNone:nil) notNil ifTrue:[self halt].
- sortedPackages := orderedTuples topologicalSort.
-
- "packages which only result from extension methods are used for computing the sort order,
- but they are not added, if not present in the first place"
- ^ sortedPackages select:[:eachProject| allPreRequisites includes:eachProject]
-
- "
- stx_libbasic allPreRequisitesSorted
- stx_libbasic2 allPreRequisitesSorted
- stx_libwidg2 allPreRequisitesSorted
- exept_expecco allPreRequisitesSorted
- alspa_batch_application allPreRequisitesSorted
+ result remove:self package ifAbsent:[].
+ ^ result.
+
+ "
+ stx_libbasic allPreRequisites
+ stx_libbasic2 allPreRequisites
+ stx_libview2 allPreRequisites
+ ubs_application allPreRequisites
ubs_application allPreRequisitesSorted
- "
-
- "Modified: / 13-04-2011 / 15:19:13 / sr"
- "Modified (comment): / 13-03-2013 / 00:40:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-allPreRequisitesWithParentDo:aBlock
+ exept_expecco_application allPreRequisites
+ exept_expeccoNET_application allPreRequisites
+ alspa_batch_application allPreRequisites"
+ "Modified: / 13-04-2011 / 15:30:45 / sr"
+ "Modified (comment): / 06-09-2011 / 08:26:06 / cg"
+!
+
+allPreRequisites:aSelector withParentDo:aBlock
"answer all (recursive) prerequisite project ids of myself - in random order.
If we exclude a project, but one of our prerequisite projects depends on it,
then what ????"
@@ -6248,7 +6237,7 @@
|setOfAllPreRequisites toAdd|
setOfAllPreRequisites := Set new.
- toAdd := Set withAll:self effectivePreRequisites.
+ toAdd := Set withAll:(self perform:aSelector).
"is a subproject really a prerequisite??
No, it works the other way: parent projects are prerequisites of sub projects,
@@ -6267,7 +6256,7 @@
def isNil ifTrue:[
Transcript showCR:'ProjectDefinition ', aPreRequisiteProjectID, ' is missing - cannot find its preRequisites.'.
] ifFalse:[
- def effectivePreRequisites
+ (def perform:aSelector)
select:[:eachSubPreRequisite | (setOfAllPreRequisites includes:eachSubPreRequisite) not]
thenDo:[:eachSubPreRequisite |
Verbose == true ifTrue:[
@@ -6307,6 +6296,93 @@
"Modified: / 20-07-2012 / 18:29:31 / cg"
!
+allPreRequisitesSorted
+ ^ self allPreRequisitesSorted:#effectivePreRequisites
+!
+
+allPreRequisitesSorted:aSelector
+ "answer all the prerequisites of this projects sorted in
+ the order they are needed.
+ Use this to e.g. compile packages in the dependency order"
+
+ |allPreRequisites orderedTuples sortedPackages|
+
+ orderedTuples := OrderedCollection new.
+ allPreRequisites := self allPreRequisites:aSelector.
+
+ "/JV@2013-03-13: Added asSortedCollection to make the order of packages
+ "/as stable as possible. Makes merging of makefiles a lot easier.
+ allPreRequisites asSortedCollection do:[:eachPackageID |
+ |def preRequisites|
+
+ self assert:(eachPackageID ~= self package).
+ orderedTuples add:(Array with:eachPackageID with:self package).
+
+ def := self definitionClassForPackage:eachPackageID.
+ def isNil ifTrue:[
+ Transcript showCR:'Warning: no definition class for package: ', eachPackageID.
+ ((self searchForPreRequisites: eachPackageID)
+ fold:[:d1 :d2| d1 addAll:d2; yourself]) keys
+ ] ifFalse:[
+ preRequisites := def perform:aSelector.
+ preRequisites removeAllFoundIn:def excludedFromPreRequisites.
+ preRequisites do:[:eachPrerequisitePackageID|
+ self assert:(eachPrerequisitePackageID ~= eachPackageID).
+ orderedTuples add:(Array with:eachPrerequisitePackageID with:eachPackageID).
+ ].
+ ].
+ ].
+
+ (orderedTuples includes:[:el | el first = el second]) ifTrue:[
+ self halt
+ ].
+ sortedPackages := orderedTuples topologicalSort.
+
+ "packages which only result from extension methods are used for computing the sort order,
+ but they are not added, if not present in the first place"
+ ^ sortedPackages select:[:eachProject| allPreRequisites includes:eachProject]
+
+ "
+ stx_libbasic allPreRequisitesSorted
+ stx_libbasic2 allPreRequisitesSorted
+ stx_libwidg2 allPreRequisitesSorted
+ exept_expecco allPreRequisitesSorted
+ alspa_batch_application allPreRequisitesSorted
+ ubs_application allPreRequisitesSorted
+ "
+
+ "Modified: / 13-04-2011 / 15:19:13 / sr"
+ "Modified (comment): / 13-03-2013 / 00:40:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+
+
+allReferences
+ "answer all (recursive) projects to which I refer - in random order."
+
+ |result|
+
+ result := self
+ allPreRequisites:#referencedPreRequisites withParentDo:[:parent :prereq |
+ prereq = self package ifTrue:[
+ Transcript showCR:('oops: %1 depends on itself' bindWith:prereq)
+ ].
+ ].
+ result remove:self package ifAbsent:[].
+ ^ result.
+
+ "
+ stx_libbasic allReferences
+ stx_libbasic2 allReferences
+ stx_libview2 allReferences
+ ubs_application allReferences
+ ubs_application allReferences
+ exept_expecco_application allReferences
+ exept_expeccoNET_application allReferences
+ alspa_batch_application allReferences
+ "
+!
+
effectivePreRequisites
"get the preRequisites, that are not excluded.
This method appears to be obsolete, because its functionality
@@ -6347,14 +6423,18 @@
!
searchForPreRequisites: packageId
- "answer a Dictionary where the keys are the prerequisite package for this package
- and the values are a Set of reasons, why each package is required"
+ "answer an array containing two Dictionaries where the keys are the prerequisite package for the given package
+ and the values are a Set of reasons, why each key package is required.
+ The first entry in the array are the mandatory prereqs (required for compilation),
+ the second entry are the referenced prereqs (required for loading).
+ Referenced prereqs are due to elements accessed at execution time (such as globals)"
^ self searchForPreRequisites: packageId withSubProjects:false
"
self searchForPreRequisites
self searchForPreRequisites:#'stx:libwidg3'
+ self searchForPreRequisites:#'stx:libtool'
bosch_dapasx_Application searchForPreRequisites
bosch_dapasx_pav_browser searchForPreRequisites
"
@@ -6365,10 +6445,14 @@
!
searchForPreRequisites:packageId withSubProjects:withSubProjectsBoolean
- "answer a Dictionary where the keys are the prerequisite package for this package
- and the values are a Set of reasons, why each package is required"
-
- |requiredClasses mandatoryClassesForLoadingWithReasons referencedClassesWithReasons ignoredPackages packageExtractionBlock|
+ "answer an array containing two Dictionaries where the keys are the prerequisite package for the given package
+ and the values are a Set of reasons, why each key package is required.
+ The first entry in the array are the mandatory prereqs (required for compilation),
+ the second entry are the referenced prereqs (required for loading).
+ Referenced prereqs are due to elements accessed at execution time (such as globals)"
+
+ |requiredClasses mandatoryClassesForLoadingWithReasons referencedClassesWithReasons
+ ignoredPackages packageExtractionBlock mandatoryPackages referencedPackages|
mandatoryClassesForLoadingWithReasons := Dictionary new.
referencedClassesWithReasons := Dictionary new.
@@ -6408,39 +6492,38 @@
self addReferencesToClassesFromGlobalsIn:requiredClasses to:referencedClassesWithReasons.
self addReferencesToClassesFromGlobalsInMethods:(self searchForExtensionsWithProject:self package) to:referencedClassesWithReasons.
-
- "don't put classes from subProjects into the required list"
- ignoredPackages := (self siblingsAreSubProjects
- ifTrue:[ self searchForSiblingProjects ]
- ifFalse:[ self searchForSubProjects ]) asSet.
-
- ignoredPackages
- add:packageId;
- add:PackageId noProjectID.
-
"now map classes to packages and collect the reasons"
packageExtractionBlock := [:classesWithReasons|
|requiredPackageReasons|
requiredPackageReasons := Dictionary new.
classesWithReasons keysAndValuesDo:[:usedClass :reasonsPerClass|
- |usedClassPackage|
-
- usedClassPackage := usedClass package.
- (ignoredPackages includes:usedClassPackage) ifFalse:[
- (requiredPackageReasons at:usedClassPackage ifAbsentPut:[OrderedSet new])
- addAll:reasonsPerClass.
- ].
+ (requiredPackageReasons at:usedClass package ifAbsentPut:[OrderedSet new])
+ addAll:reasonsPerClass.
].
requiredPackageReasons
].
+ mandatoryPackages := packageExtractionBlock value:mandatoryClassesForLoadingWithReasons.
+ referencedPackages := packageExtractionBlock value:referencedClassesWithReasons.
+
+ ignoredPackages := Set
+ with:packageId
+ with:PackageId noProjectID.
+
+ referencedPackages removeAllKeys:ignoredPackages ifAbsent:[].
+
+ "don't put classes from subProjects into the required list"
+ ignoredPackages addAll:(self siblingsAreSubProjects
+ ifTrue:[ self searchForSiblingProjects ]
+ ifFalse:[ self searchForSubProjects ]) asSet.
+
+ mandatoryPackages removeAllKeys:ignoredPackages ifAbsent:[].
^ Array
- with:(packageExtractionBlock value:mandatoryClassesForLoadingWithReasons)
- with:(packageExtractionBlock value:referencedClassesWithReasons)
-
- "
- self searchForPreRequisites
+ with:mandatoryPackages
+ with:referencedPackages.
+
+ "
self searchForPreRequisites:#'stx:libwidg3'
bosch_dapasx_Application searchForPreRequisites
bosch_dapasx_pav_browser searchForPreRequisites
@@ -6451,6 +6534,7 @@
"Created: / 06-09-2011 / 08:29:37 / cg"
! !
+
!ProjectDefinition class methodsFor:'queries'!
allClassNames
@@ -6821,6 +6905,7 @@
^ self subclassResponsibility
! !
+
!ProjectDefinition class methodsFor:'queries-privacy'!
showClassDocumentationOf:aClass
@@ -6834,6 +6919,7 @@
"Created: / 05-11-2007 / 16:44:16 / cg"
! !
+
!ProjectDefinition class methodsFor:'sanity checks'!
validateDescription
@@ -6991,6 +7077,7 @@
"Created: / 05-03-2012 / 12:18:45 / cg"
! !
+
!ProjectDefinition class methodsFor:'testing'!
isApplicationDefinition
@@ -7028,6 +7115,7 @@
"Modified: / 08-02-2011 / 10:03:49 / cg"
! !
+
!ProjectDefinition::AbbrevEntry methodsFor:'accessing'!
category
@@ -7057,14 +7145,15 @@
"Created: / 18-08-2011 / 14:18:37 / cg"
! !
+
!ProjectDefinition class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.424 2013-03-11 12:47:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.431 2013-03-15 15:49:12 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.424 2013-03-11 12:47:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.431 2013-03-15 15:49:12 stefan Exp $'
!
version_HG