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