--- a/Project.st Thu Mar 25 17:29:38 1999 +0100
+++ b/Project.st Thu Mar 25 18:34:23 1999 +0100
@@ -643,6 +643,11 @@
repositoryModule := pack at:'repository.module' ifAbsent:repositoryModule.
repositoryDirectory := pack at:'repository.directory' ifAbsent:repositoryDirectory.
+ s := pack at:'nameSpace' ifAbsent:nil.
+ s notNil ifTrue:[
+ defaultNameSpace := Namespace name:s.
+ ].
+
subProjects := pack at:'subProjects' ifAbsent:subProjects.
(s := pack at:'comment' ifAbsent:nil) notNil ifTrue:[
self comment:s
@@ -715,11 +720,22 @@
!
saveAsProjectFileOn:aStream
- |s coll|
+ "save the project info in a format which is both usable for reload
+ and somehow readable for humans.
+ Actually, the format is the same as used for resources (i.e. key - value pairs)
+ and the code below could be much simpler - if there where no humans to read it ..."
+
+ |s coll first|
s := aStream.
- s nextPutLine:';'; nextPutLine:'; general'; nextPutLine:';'.
+ s nextPutLine:'; $Header: /cvs/stx/stx/libbasic/Project.st,v 1.71 1999-03-25 17:34:23 cg Exp $'; nextPutLine:';'.
+ s nextPutLine:'; Project saved ' , Smalltalk timeStamp; nextPutLine:';'.
+ s nextPutLine:'; Be careful when editing - do not corrupt the files syntax.'.
+ s nextPutLine:'; (Lines starting with a semicolon are comment lines)'.
+ s nextPutLine:'; (Lines ending with a backslash are concatenated with the following line)'.
+
+ s cr; nextPutLine:';'; nextPutLine:'; general:'; nextPutLine:';'.
s nextPutAll:'comment'.
s tab. s nextPutLine:(self comment storeString).
@@ -733,47 +749,79 @@
s nextPutAll:'package'.
s tab. s nextPutLine:(self packageName storeString).
- s nextPutLine:';'; nextPutLine:'; repository'; nextPutLine:';'.
+ (defaultNameSpace notNil and:[defaultNameSpace ~~ Smalltalk]) ifTrue:[
+ s nextPutAll:'nameSpace'.
+ s tab. s nextPutLine:(defaultNameSpace name storeString).
+ ].
+
+ s cr; nextPutLine:';'; nextPutLine:'; repository:'; nextPutLine:';'.
s nextPutAll:'repository.module'.
s tab. s nextPutLine:repositoryModule ? 'private'.
s nextPutAll:'repository.directory'.
s tab. s nextPutLine:repositoryDirectory ? self packageName.
s cr.
- s nextPutLine:';'; nextPutLine:'; properties'; nextPutLine:';'.
+ first := true.
properties keysAndValuesDo:[:key :val |
(#(
comment
wasLoadedFromFile
targetconditions
+ classes
+ classInfo
) includes:key) ifFalse:[
+ first ifTrue:[
+ first := false.
+ s cr; nextPutLine:';'; nextPutLine:'; properties:'; nextPutLine:';'.
+ ].
s nextPutAll:'property.'; nextPutAll:key.
s tab. s nextPutLine:val storeString.
]
].
- coll := self subProjects.
- coll size > 0 ifTrue:[
- s nextPutLine:'[subprojects]'.
- coll do:[:aSubProject |
- s tab. s nextPutLine:(aSubProject name soreString).
+"/ coll := self subProjects.
+"/ coll size > 0 ifTrue:[
+"/ s nextPutLine:'[subprojects]'.
+"/ coll do:[:aSubProject |
+"/ s tab. s nextPutLine:(aSubProject name soreString).
+"/ ].
+"/ ].
+
+ s cr; nextPutLine:';'; nextPutLine:'; required packages:'; nextPutLine:';'.
+ s nextPutAll:'prerequisites'; tab.
+ coll := self prerequisites.
+ coll size = 0 ifTrue:[
+ s nextPutLine:'#()'.
+ ] ifFalse:[
+ s nextPutLine:'#( \'.
+ coll do:[:aProject |
+ s tab. s nextPutAll:(aProject name soreString); nextPutLine:' \'.
].
+ s nextPutLine:')'.
].
- coll := self prerequisites.
+ s cr; nextPutLine:';'; nextPutLine:'; classes:'; nextPutLine:';'.
+ s nextPutLine:'; (for each class: condition className fileName)'; nextPutLine:';'.
+
+ coll := self classInfo.
coll size > 0 ifTrue:[
- s nextPutLine:'prerequisites'.
- coll do:[:aProject |
- s tab. s nextPutLine:(aProject name soreString).
+ s nextPutAll:'classes'; tab; nextPutLine:'#( \'.
+ coll do:[:aClassInfo |
+ |clsName fileName cond|
+
+ clsName := aClassInfo className.
+ fileName := aClassInfo classFileName.
+ fileName isNil ifTrue:[
+ fileName := clsName , '.st'
+ ].
+ cond := aClassInfo conditionForInclusion.
+ s tab. s nextPutAll:'( ';
+ nextPutAll:cond storeString;
+ tab; nextPutAll:clsName;
+ tab; nextPutAll:fileName storeString;
+ nextPutLine:') \'.
].
- ].
-
- coll := self classes.
- coll size > 0 ifTrue:[
- s nextPutLine:'[classes]'.
- coll do:[:aClass |
- s tab. s nextPutLine:(aClass name).
- ]
+ s nextPutLine:')'.
]
"
@@ -1457,6 +1505,6 @@
!Project class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.70 1999-03-25 16:29:38 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.71 1999-03-25 17:34:23 cg Exp $'
! !
Project initialize!