author | Claus Gittinger <cg@exept.de> |
Thu, 27 Mar 2014 21:44:08 +0100 | |
changeset 920 | 3d0f65b1ab71 |
parent 847 | 3426cc8e79d9 |
child 996 | ab948c69360b |
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 |
|
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
39 |
! |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
40 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
41 |
serializePackageStX:aPackage |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
42 |
^ '(name ''', aPackage packageInfo projectDefinition package , ''')' |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
43 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
44 |
"Created: / 29-05-2013 / 01:49:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
771 | 45 |
! ! |
46 |
||
738 | 47 |
!MCStxMczWriter methodsFor:'visiting'! |
48 |
||
49 |
writeBuildSupportFiles:aVersion for:aProjectDefinition |
|
769 | 50 |
Error handle:[:ex | |
51 |
Dialog information:('Cannot write build support files because:\\',ex description,'\\Writing source files only.') withCRs. |
|
52 |
^ self |
|
53 |
] do:[ |
|
54 |
aProjectDefinition forEachFileNameAndGeneratedContentsDo:[:file :contents | |
|
55 |
self addString: contents at: 'snapshot.stx/', file. |
|
56 |
]. |
|
57 |
] |
|
738 | 58 |
! |
59 |
||
60 |
writeIndividualSourceFiles:aVersion for:aProjectDefinition |
|
61 |
"individual source files for dll compilation" |
|
62 |
||
63 |
aProjectDefinition classNames do:[:eachClassName | |
|
64 |
|cls fileName source| |
|
65 |
||
66 |
cls := Smalltalk classNamed:eachClassName. |
|
67 |
cls isNil ifTrue:[ |
|
68 |
Transcript showCR:'class missing: ',eachClassName |
|
69 |
] ifFalse:[ |
|
70 |
cls autoload. |
|
71 |
||
72 |
fileName := (Smalltalk fileNameForClass:cls),'.st'. |
|
73 |
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
|
74 |
self addString: source at: 'snapshot.stx/', fileName. |
738 | 75 |
] |
76 |
]. |
|
77 |
! |
|
78 |
||
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
79 |
writePackage: aPackage |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
80 |
super writePackage: aPackage. |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
81 |
aPackage isStXPackage ifTrue:[ |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
82 |
self writePackageStX:aPackage |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
83 |
] |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
84 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
85 |
"Created: / 29-05-2013 / 01:48:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
86 |
! |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
87 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
88 |
writePackageStX:aPackage |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
89 |
self addString:(self serializePackageStX:aPackage) at:'package.stx' |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
90 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
91 |
"Created: / 29-05-2013 / 01:48:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
92 |
! |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
93 |
|
738 | 94 |
writeResourceFiles:aVersion for:aProjectDefinition |
95 |
"language translations kept in externalfiles" |
|
96 |
||
97 |
|dir rsrcDir| |
|
98 |
||
769 | 99 |
dir := aProjectDefinition projectDirectory. |
100 |
dir isNil ifTrue:[ |
|
101 |
"/ no directory - no resource files |
|
102 |
^ self. |
|
103 |
]. |
|
104 |
(rsrcDir := dir asFilename / 'resources') exists ifTrue:[ |
|
738 | 105 |
rsrcDir recursiveDirectoryContentsDo:[:relFn | |
106 |
(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
|
107 |
self addString: ((rsrcDir construct:relFn) contentsOfEntireFile) at: 'snapshot.stx/resources/', relFn. |
738 | 108 |
] |
109 |
]. |
|
110 |
]. |
|
111 |
! |
|
112 |
||
759 | 113 |
writeSnapshot: aSnapshot forVersion: aVersion |
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
114 |
| source snapshot | |
759 | 115 |
|
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
116 |
snapshot := MCStXSnapshotPreWriteTransformation transform: aSnapshot. |
759 | 117 |
source := |
118 |
('"{ Package: ''%1'' }" !!\\' withCRs bindWith:aVersion package name) |
|
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
119 |
, (self serializeDefinitions: snapshot definitions). |
759 | 120 |
|
121 |
self addString: source at: 'snapshot/source.', self snapshotWriterClass extension. |
|
738 | 122 |
"/ I whink, we can comment the following (or is it compatible?) |
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
123 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
124 |
"/ JV: |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
125 |
"/ NO, DON'T DO IT!! snapshot.bin is THE ONLY thing that Pharo/Squeak reads. |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
126 |
"/ It does not care about snapshot/source.st, actually |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
127 |
self addString: (self serializeInBinary: snapshot) at: 'snapshot.bin' |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
128 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
129 |
"Modified (comment): / 29-05-2013 / 12:06:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
738 | 130 |
! |
131 |
||
132 |
writeVersion: aVersion |
|
133 |
|packageID prjDef| |
|
134 |
||
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
135 |
super writeVersion: aVersion. |
738 | 136 |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
137 |
aVersion snapshot includeExtrasForSTX ifTrue:[ |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
138 |
"/ ST/X specific stuff here. |
738 | 139 |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
140 |
packageID := aVersion package name. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
141 |
prjDef := ProjectDefinition definitionClassForPackage:packageID. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
142 |
prjDef isNil ifTrue:[ |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
143 |
"/ 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
|
144 |
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
|
145 |
] ifFalse:[ |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
146 |
"/ 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
|
147 |
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
|
148 |
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
|
149 |
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
|
150 |
] |
738 | 151 |
] |
152 |
! ! |
|
153 |
||
154 |
!MCStxMczWriter class methodsFor:'documentation'! |
|
155 |
||
156 |
version |
|
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
157 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCStxMczWriter.st,v 1.6 2013-05-29 11:47:31 vrany Exp $' |
738 | 158 |
! |
159 |
||
160 |
version_CVS |
|
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
161 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCStxMczWriter.st,v 1.6 2013-05-29 11:47:31 vrany Exp $' |
738 | 162 |
! ! |
163 |