11 " |
11 " |
12 |
12 |
13 Object subclass:#Project |
13 Object subclass:#Project |
14 instanceVariableNames:'name changeSet views directoryName properties packageName |
14 instanceVariableNames:'name changeSet views directoryName properties packageName |
15 repositoryDirectory repositoryModule defaultNameSpace |
15 repositoryDirectory repositoryModule defaultNameSpace |
16 overwrittenMethods' |
16 overwrittenMethods subProjects prerequisites bitmapFiles |
17 classVariableNames:'CurrentProject SystemProject NextSequential' |
17 documentFiles otherFiles' |
|
18 classVariableNames:'CurrentProject SystemProject NextSequential AllProjects' |
18 poolDictionaries:'' |
19 poolDictionaries:'' |
19 category:'System-Support' |
20 category:'System-Support' |
20 ! |
21 ! |
21 |
22 |
22 !Project class methodsFor:'documentation'! |
23 !Project class methodsFor:'documentation'! |
75 " |
76 " |
76 ! ! |
77 ! ! |
77 |
78 |
78 !Project class methodsFor:'initialization'! |
79 !Project class methodsFor:'initialization'! |
79 |
80 |
|
81 initKnownProjects |
|
82 "this is a temporary experimental kludge - |
|
83 once the ProjectBrowser is finished, this info is read from |
|
84 '.prj' files ..." |
|
85 |
|
86 |stx p| |
|
87 |
|
88 stx := self new name:'stx'. |
|
89 stx packageName:'noPackage'. |
|
90 stx changeSet:nil. |
|
91 stx type:#smalltalk. |
|
92 stx comment:'ST/X itself'. |
|
93 |
|
94 AllProjects add:stx. |
|
95 |
|
96 #( |
|
97 ('libbasic' 'Basic (non-GUI) classes. Required for all applications') |
|
98 ('libbasic2' 'More basic (non-GUI) classes. Required for most applications') |
|
99 ('libbasic3' 'More basic (non-GUI) classes. Required for development') |
|
100 ('libcomp' 'The bytecode compiler. Required for all applications') |
|
101 ('libview' 'Low level GUI classes. Required for all GUI applications') |
|
102 ('libview2' 'Additional low level GUI classes. Required for most GUI applications') |
|
103 ('libwidg' 'Basic widgets. Required for all GUI applications') |
|
104 ('libwidg2' 'More widgets. Required for most GUI applications') |
|
105 ('libwidg3' 'More (fun) widgets. Seldom required') |
|
106 ('libtool' 'Development applications. Required for program development') |
|
107 ('libtool2' 'More development applications. Required for GUI development') |
|
108 ('libui' 'UI spec classes. Required for UIPainter applications') |
|
109 ('libhtml' 'HTML related classes. Required for Web applications and the HTML browser') |
|
110 ) do:[:entry | |
|
111 |libName comment| |
|
112 |
|
113 libName := entry at:1. |
|
114 comment := entry at:2. |
|
115 |
|
116 p := self new name:libName. |
|
117 p packageName:libName. |
|
118 p type:#library. |
|
119 p comment:comment. |
|
120 stx addSubProject:p. |
|
121 ]. |
|
122 |
|
123 " |
|
124 self initKnownProjects |
|
125 " |
|
126 ! |
|
127 |
80 initialize |
128 initialize |
81 SystemProject isNil ifTrue:[ |
129 SystemProject isNil ifTrue:[ |
82 NextSequential := 1. |
130 NextSequential := 1. |
83 SystemProject := self new name:'default'. |
131 SystemProject := self new name:'default'. |
84 SystemProject packageName:'private'. |
132 SystemProject packageName:'private'. |
85 SystemProject defaultNameSpace:Smalltalk. |
133 SystemProject defaultNameSpace:Smalltalk. |
|
134 SystemProject comment:'A default (dummy) project. |
|
135 Will be made the current project in case no real project is ever activated.'. |
|
136 |
86 " |
137 " |
87 the SystemProject does not keep a record if changes, |
138 the SystemProject does not keep a record if changes, |
88 but instead depends on the changes file - recording anything there. |
139 but instead depends on the changes file - recording anything there. |
89 " |
140 " |
90 SystemProject changeSet:nil. |
141 SystemProject changeSet:nil. |
91 ]. |
142 ]. |
92 |
143 |
93 CurrentProject := SystemProject. |
144 CurrentProject := SystemProject. |
94 |
145 AllProjects := OrderedCollection with:SystemProject. |
95 " |
146 self initKnownProjects. |
|
147 |
|
148 " |
|
149 SystemProject := nil. |
96 Project initialize |
150 Project initialize |
97 " |
151 " |
98 ! ! |
152 ! ! |
99 |
153 |
100 !Project class methodsFor:'instance creation'! |
154 !Project class methodsFor:'instance creation'! |
517 self repositoryModule:(OperatingSystem getLoginName). |
590 self repositoryModule:(OperatingSystem getLoginName). |
518 self repositoryDirectory:'private' |
591 self repositoryDirectory:'private' |
519 |
592 |
520 "Created: 25.11.1995 / 18:05:44 / cg" |
593 "Created: 25.11.1995 / 18:05:44 / cg" |
521 "Modified: 3.1.1997 / 13:24:10 / cg" |
594 "Modified: 3.1.1997 / 13:24:10 / cg" |
|
595 ! ! |
|
596 |
|
597 !Project methodsFor:'load & save'! |
|
598 |
|
599 loadFromProjectFile:aFilename |
|
600 |f s l| |
|
601 |
|
602 f := aFilename asFilename. |
|
603 self directory:(f directory pathName). |
|
604 s := f readStream. |
|
605 self loadFromProjectFileStream:s. |
|
606 s close. |
|
607 |
|
608 |
|
609 " |
|
610 Project current saveAsProjectFile. |
|
611 |
|
612 Project new loadFromProjectFile:'default.prj' |
|
613 " |
|
614 ! |
|
615 |
|
616 loadFromProjectFileStream:aStream |
|
617 |s l| |
|
618 |
|
619 s := aStream. |
|
620 l := s nextLine. |
|
621 [s atEnd] whileFalse:[ |
|
622 (l startsWith:';') ifTrue:[ |
|
623 l := s nextLine. |
|
624 ] ifFalse:[ |
|
625 l asLowercase = '[name]' ifTrue:[ |
|
626 l := s nextLine. |
|
627 name := Object readFromString:l. |
|
628 l := s nextLine. |
|
629 ] ifFalse:[l asLowercase = '[type]' ifTrue:[ |
|
630 l := s nextLine. |
|
631 self type:(Object readFromString:l). |
|
632 l := s nextLine. |
|
633 ] ifFalse:[l asLowercase = '[subprojects]' ifTrue:[ |
|
634 l := s nextLine. |
|
635 [l notNil and:[(l startsWith:'[') not]] whileTrue:[ |
|
636 l := s nextLine. |
|
637 ]. |
|
638 ] ifFalse:[l asLowercase = '[prerequisites]' ifTrue:[ |
|
639 l := s nextLine. |
|
640 [l notNil and:[(l startsWith:'[') not]] whileTrue:[ |
|
641 l := s nextLine. |
|
642 ]. |
|
643 ] ifFalse:[l asLowercase = '[classes]' ifTrue:[ |
|
644 l := s nextLine. |
|
645 [l notNil and:[(l startsWith:'[') not]] whileTrue:[ |
|
646 l := s nextLine. |
|
647 ]. |
|
648 ] ifFalse:[l asLowercase = '[package]' ifTrue:[ |
|
649 l := s nextLine. |
|
650 self packageName:(Object readFromString:l). |
|
651 l := s nextLine. |
|
652 ] ifFalse:[ |
|
653 self halt. |
|
654 ]]]]]] |
|
655 ] |
|
656 ]. |
|
657 |
|
658 " |
|
659 Project current saveOn:Transcript |
|
660 " |
|
661 ! |
|
662 |
|
663 saveAsProjectFile |
|
664 |fn s| |
|
665 |
|
666 fn := self directory asFilename. |
|
667 fn := fn construct:self name. |
|
668 fn := fn withSuffix:'prj'. |
|
669 |
|
670 s := fn writeStream. |
|
671 self saveAsProjectFileOn:s. |
|
672 s close. |
|
673 |
|
674 " |
|
675 Project current saveAsProjectFile |
|
676 " |
|
677 ! |
|
678 |
|
679 saveAsProjectFileOn:aStream |
|
680 |s coll| |
|
681 |
|
682 s := aStream. |
|
683 |
|
684 s nextPutLine:'[name]'. |
|
685 s tab. s nextPutLine:(name storeString). |
|
686 s nextPutLine:'[type]'. |
|
687 s tab. s nextPutLine:(self type storeString). |
|
688 s nextPutLine:'[package]'. |
|
689 s tab. s nextPutLine:(self packageName storeString). |
|
690 |
|
691 coll := self subProjects. |
|
692 coll size > 0 ifTrue:[ |
|
693 s nextPutLine:'[subprojects]'. |
|
694 coll do:[:aSubProject | |
|
695 s tab. s nextPutLine:(aSubProject name soreString). |
|
696 ]. |
|
697 ]. |
|
698 |
|
699 coll := self prerequisites. |
|
700 coll size > 0 ifTrue:[ |
|
701 s nextPutLine:'[prerequisites]'. |
|
702 coll do:[:aProject | |
|
703 s tab. s nextPutLine:(aProject name soreString). |
|
704 ]. |
|
705 ]. |
|
706 |
|
707 coll := self classes. |
|
708 coll size > 0 ifTrue:[ |
|
709 s nextPutLine:'[classes]'. |
|
710 coll do:[:aClass | |
|
711 s tab. s nextPutLine:(aClass name). |
|
712 ] |
|
713 ] |
|
714 |
|
715 " |
|
716 Project current saveOn:Transcript |
|
717 " |
522 ! ! |
718 ! ! |
523 |
719 |
524 !Project methodsFor:'maintenance'! |
720 !Project methodsFor:'maintenance'! |
525 |
721 |
526 buildProject |
722 buildProject |
847 ! |
1065 ! |
848 |
1066 |
849 type |
1067 type |
850 "return the type of project" |
1068 "return the type of project" |
851 |
1069 |
852 ^ properties at:#type ifAbsent:[#application] |
1070 properties isNil ifTrue:[^ #application]. |
|
1071 ^ properties at:#type ifAbsent:#application |
853 ! |
1072 ! |
854 |
1073 |
855 type:aSymbol |
1074 type:aSymbol |
856 "set the projects type" |
1075 "set the projects type" |
857 |
1076 |
858 (#(application library smalltalk) includes:aSymbol) ifFalse:[ |
1077 (#(application library smalltalk) includes:aSymbol) ifFalse:[ |
859 self warn:'invalid project type'. |
1078 self warn:'invalid project type'. |
860 ^ self |
1079 ^ self |
|
1080 ]. |
|
1081 properties isNil ifTrue:[ |
|
1082 properties := IdentityDictionary new |
861 ]. |
1083 ]. |
862 properties at:#type put:aSymbol |
1084 properties at:#type put:aSymbol |
863 ! ! |
1085 ! ! |
864 |
1086 |
865 !Project methodsFor:'queries'! |
1087 !Project methodsFor:'queries'! |