author | Claus Gittinger <cg@exept.de> |
Thu, 28 Mar 2013 17:23:21 +0100 | |
changeset 771 | cfb9eb763bc2 |
parent 769 | 6a647dbd3630 |
child 847 | 3426cc8e79d9 |
permissions | -rw-r--r-- |
738 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
3 |
MCMczWriter subclass:#MCStxMczWriter |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
7 |
category:'SCM-Monticello-St/X Storing' |
738 | 8 |
! |
9 |
||
10 |
!MCStxMczWriter class methodsFor:'documentation'! |
|
11 |
||
12 |
documentation |
|
13 |
" |
|
14 |
redefined to add some more stuff to the mcz archive: |
|
15 |
||
16 |
- package pragma to the source code. |
|
17 |
- stx subdirectory (optional), containing required support files for building |
|
18 |
plus resource files. |
|
19 |
- stx.bin subdirectory (optional), containing a precompiled binary dll as per architecture. |
|
20 |
" |
|
21 |
! ! |
|
22 |
||
23 |
!MCStxMczWriter methodsFor:'accessing'! |
|
24 |
||
25 |
snapshotWriterClass |
|
26 |
^ MCStxStWriter |
|
27 |
! ! |
|
28 |
||
771 | 29 |
!MCStxMczWriter methodsFor:'serializing'! |
30 |
||
31 |
serializeDefinitions:definitions |
|
32 |
|string| |
|
33 |
||
34 |
string := super serializeDefinitions:definitions. |
|
35 |
string isWideString ifTrue:[ |
|
36 |
^ string utf8Encoded |
|
37 |
]. |
|
38 |
^ string |
|
39 |
! ! |
|
40 |
||
738 | 41 |
!MCStxMczWriter methodsFor:'visiting'! |
42 |
||
43 |
writeBuildSupportFiles:aVersion for:aProjectDefinition |
|
769 | 44 |
Error handle:[:ex | |
45 |
Dialog information:('Cannot write build support files because:\\',ex description,'\\Writing source files only.') withCRs. |
|
46 |
^ self |
|
47 |
] do:[ |
|
48 |
aProjectDefinition forEachFileNameAndGeneratedContentsDo:[:file :contents | |
|
49 |
self addString: contents at: 'snapshot.stx/', file. |
|
50 |
]. |
|
51 |
] |
|
738 | 52 |
! |
53 |
||
54 |
writeIndividualSourceFiles:aVersion for:aProjectDefinition |
|
55 |
"individual source files for dll compilation" |
|
56 |
||
57 |
aProjectDefinition classNames do:[:eachClassName | |
|
58 |
|cls fileName source| |
|
59 |
||
60 |
cls := Smalltalk classNamed:eachClassName. |
|
61 |
cls isNil ifTrue:[ |
|
62 |
Transcript showCR:'class missing: ',eachClassName |
|
63 |
] ifFalse:[ |
|
64 |
cls autoload. |
|
65 |
||
66 |
fileName := (Smalltalk fileNameForClass:cls),'.st'. |
|
67 |
source := String streamContents:[:s | cls fileOutOn:s withTimeStamp:false]. |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
68 |
self addString: source at: 'snapshot.stx/', fileName. |
738 | 69 |
] |
70 |
]. |
|
71 |
! |
|
72 |
||
73 |
writeResourceFiles:aVersion for:aProjectDefinition |
|
74 |
"language translations kept in externalfiles" |
|
75 |
||
76 |
|dir rsrcDir| |
|
77 |
||
769 | 78 |
dir := aProjectDefinition projectDirectory. |
79 |
dir isNil ifTrue:[ |
|
80 |
"/ no directory - no resource files |
|
81 |
^ self. |
|
82 |
]. |
|
83 |
(rsrcDir := dir asFilename / 'resources') exists ifTrue:[ |
|
738 | 84 |
rsrcDir recursiveDirectoryContentsDo:[:relFn | |
85 |
(rsrcDir construct:relFn) isDirectory ifFalse:[ |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
86 |
self addString: ((rsrcDir construct:relFn) contentsOfEntireFile) at: 'snapshot.stx/resources/', relFn. |
738 | 87 |
] |
88 |
]. |
|
89 |
]. |
|
90 |
! |
|
91 |
||
759 | 92 |
writeSnapshot: aSnapshot forVersion: aVersion |
93 |
|source| |
|
94 |
||
95 |
source := |
|
96 |
('"{ Package: ''%1'' }" !!\\' withCRs bindWith:aVersion package name) |
|
97 |
, (self serializeDefinitions: aSnapshot definitions). |
|
98 |
||
99 |
self addString: source at: 'snapshot/source.', self snapshotWriterClass extension. |
|
738 | 100 |
"/ I whink, we can comment the following (or is it compatible?) |
101 |
self addString: (self serializeInBinary: aSnapshot) at: 'snapshot.bin' |
|
102 |
! |
|
103 |
||
104 |
writeVersion: aVersion |
|
105 |
|packageID prjDef| |
|
106 |
||
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
107 |
super writeVersion: aVersion. |
738 | 108 |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
109 |
aVersion snapshot includeExtrasForSTX ifTrue:[ |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
110 |
"/ ST/X specific stuff here. |
738 | 111 |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
112 |
packageID := aVersion package name. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
113 |
prjDef := ProjectDefinition definitionClassForPackage:packageID. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
114 |
prjDef isNil ifTrue:[ |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
115 |
"/ not a project definition mcz - simply skip |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
116 |
Transcript show:'No projectDefinition for ',packageID, ' generated simple source only'. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
117 |
] ifFalse:[ |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
118 |
"/ additional support files for recompilation... |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
119 |
self writeIndividualSourceFiles: aVersion for: prjDef. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
120 |
self writeBuildSupportFiles: aVersion for: prjDef. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
121 |
self writeResourceFiles: aVersion for: prjDef. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
122 |
] |
738 | 123 |
] |
124 |
! ! |
|
125 |
||
126 |
!MCStxMczWriter class methodsFor:'documentation'! |
|
127 |
||
128 |
version |
|
771 | 129 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCStxMczWriter.st,v 1.5 2013-03-28 16:23:21 cg Exp $' |
738 | 130 |
! |
131 |
||
132 |
version_CVS |
|
771 | 133 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCStxMczWriter.st,v 1.5 2013-03-28 16:23:21 cg Exp $' |
738 | 134 |
! ! |
135 |