author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 10 May 2015 06:09:15 +0100 | |
branch | jv |
changeset 996 | ab948c69360b |
parent 847 | 3426cc8e79d9 |
child 1000 | dbc3a47007d6 |
permissions | -rw-r--r-- |
738 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
996
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
3 |
"{ NameSpace: Smalltalk }" |
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
4 |
|
738 | 5 |
MCMczWriter subclass:#MCStxMczWriter |
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
9 |
category:'SCM-Monticello-St/X Storing' |
738 | 10 |
! |
11 |
||
12 |
!MCStxMczWriter class methodsFor:'documentation'! |
|
13 |
||
14 |
documentation |
|
15 |
" |
|
16 |
redefined to add some more stuff to the mcz archive: |
|
17 |
||
18 |
- package pragma to the source code. |
|
19 |
- stx subdirectory (optional), containing required support files for building |
|
20 |
plus resource files. |
|
21 |
- stx.bin subdirectory (optional), containing a precompiled binary dll as per architecture. |
|
22 |
" |
|
23 |
! ! |
|
24 |
||
996
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
25 |
!MCStxMczWriter class methodsFor:'as yet unclassified'! |
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
26 |
|
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
27 |
readerClass |
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
28 |
^ MCStXMczReader |
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
29 |
|
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
30 |
"Created: / 10-05-2015 / 05:46:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
31 |
! ! |
ab948c69360b
Transfrom snapshot using MCStXSnapshotPostReadTransformation after reading .mcz
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
847
diff
changeset
|
32 |
|
738 | 33 |
!MCStxMczWriter methodsFor:'accessing'! |
34 |
||
35 |
snapshotWriterClass |
|
36 |
^ MCStxStWriter |
|
37 |
! ! |
|
38 |
||
771 | 39 |
!MCStxMczWriter methodsFor:'serializing'! |
40 |
||
41 |
serializeDefinitions:definitions |
|
42 |
|string| |
|
43 |
||
44 |
string := super serializeDefinitions:definitions. |
|
45 |
string isWideString ifTrue:[ |
|
46 |
^ string utf8Encoded |
|
47 |
]. |
|
48 |
^ string |
|
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
49 |
! |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
50 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
51 |
serializePackageStX:aPackage |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
52 |
^ '(name ''', aPackage packageInfo projectDefinition package , ''')' |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
53 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
54 |
"Created: / 29-05-2013 / 01:49:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
771 | 55 |
! ! |
56 |
||
738 | 57 |
!MCStxMczWriter methodsFor:'visiting'! |
58 |
||
59 |
writeBuildSupportFiles:aVersion for:aProjectDefinition |
|
769 | 60 |
Error handle:[:ex | |
61 |
Dialog information:('Cannot write build support files because:\\',ex description,'\\Writing source files only.') withCRs. |
|
62 |
^ self |
|
63 |
] do:[ |
|
64 |
aProjectDefinition forEachFileNameAndGeneratedContentsDo:[:file :contents | |
|
65 |
self addString: contents at: 'snapshot.stx/', file. |
|
66 |
]. |
|
67 |
] |
|
738 | 68 |
! |
69 |
||
70 |
writeIndividualSourceFiles:aVersion for:aProjectDefinition |
|
71 |
"individual source files for dll compilation" |
|
72 |
||
73 |
aProjectDefinition classNames do:[:eachClassName | |
|
74 |
|cls fileName source| |
|
75 |
||
76 |
cls := Smalltalk classNamed:eachClassName. |
|
77 |
cls isNil ifTrue:[ |
|
78 |
Transcript showCR:'class missing: ',eachClassName |
|
79 |
] ifFalse:[ |
|
80 |
cls autoload. |
|
81 |
||
82 |
fileName := (Smalltalk fileNameForClass:cls),'.st'. |
|
83 |
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
|
84 |
self addString: source at: 'snapshot.stx/', fileName. |
738 | 85 |
] |
86 |
]. |
|
87 |
! |
|
88 |
||
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
89 |
writePackage: aPackage |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
90 |
super writePackage: aPackage. |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
91 |
aPackage isStXPackage ifTrue:[ |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
92 |
self writePackageStX:aPackage |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
93 |
] |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
94 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
95 |
"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
|
96 |
! |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
97 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
98 |
writePackageStX:aPackage |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
99 |
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
|
100 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
101 |
"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
|
102 |
! |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
103 |
|
738 | 104 |
writeResourceFiles:aVersion for:aProjectDefinition |
105 |
"language translations kept in externalfiles" |
|
106 |
||
107 |
|dir rsrcDir| |
|
108 |
||
769 | 109 |
dir := aProjectDefinition projectDirectory. |
110 |
dir isNil ifTrue:[ |
|
111 |
"/ no directory - no resource files |
|
112 |
^ self. |
|
113 |
]. |
|
114 |
(rsrcDir := dir asFilename / 'resources') exists ifTrue:[ |
|
738 | 115 |
rsrcDir recursiveDirectoryContentsDo:[:relFn | |
116 |
(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
|
117 |
self addString: ((rsrcDir construct:relFn) contentsOfEntireFile) at: 'snapshot.stx/resources/', relFn. |
738 | 118 |
] |
119 |
]. |
|
120 |
]. |
|
121 |
! |
|
122 |
||
759 | 123 |
writeSnapshot: aSnapshot forVersion: aVersion |
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
124 |
| source snapshot | |
759 | 125 |
|
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
126 |
snapshot := MCStXSnapshotPreWriteTransformation transform: aSnapshot. |
759 | 127 |
source := |
128 |
('"{ 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
|
129 |
, (self serializeDefinitions: snapshot definitions). |
759 | 130 |
|
131 |
self addString: source at: 'snapshot/source.', self snapshotWriterClass extension. |
|
738 | 132 |
"/ 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
|
133 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
134 |
"/ JV: |
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
135 |
"/ 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
|
136 |
"/ 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
|
137 |
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
|
138 |
|
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
139 |
"Modified (comment): / 29-05-2013 / 12:06:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
738 | 140 |
! |
141 |
||
142 |
writeVersion: aVersion |
|
143 |
|packageID prjDef| |
|
144 |
||
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
145 |
super writeVersion: aVersion. |
738 | 146 |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
147 |
aVersion snapshot includeExtrasForSTX ifTrue:[ |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
148 |
"/ ST/X specific stuff here. |
738 | 149 |
|
743
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
150 |
packageID := aVersion package name. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
151 |
prjDef := ProjectDefinition definitionClassForPackage:packageID. |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
152 |
prjDef isNil ifTrue:[ |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
153 |
"/ 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
|
154 |
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
|
155 |
] ifFalse:[ |
a43cc4d9b6dc
option to save st/x extra stuff in the mcz
Claus Gittinger <cg@exept.de>
parents:
738
diff
changeset
|
156 |
"/ 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
|
157 |
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
|
158 |
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
|
159 |
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
|
160 |
] |
738 | 161 |
] |
162 |
! ! |
|
163 |
||
164 |
!MCStxMczWriter class methodsFor:'documentation'! |
|
165 |
||
166 |
version |
|
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
167 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCStxMczWriter.st,v 1.6 2013-05-29 11:47:31 vrany Exp $' |
738 | 168 |
! |
169 |
||
170 |
version_CVS |
|
847
3426cc8e79d9
More support Squeak/Pharo interoperability - part 1:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
771
diff
changeset
|
171 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCStxMczWriter.st,v 1.6 2013-05-29 11:47:31 vrany Exp $' |
738 | 172 |
! ! |
173 |