1
0
mirror of https://github.com/lxsang/DiyaSDK.git synced 2024-11-16 18:18:22 +01:00
DiyaSDK/export.st

150 lines
4.0 KiB
Smalltalk
Raw Normal View History

2022-02-15 22:08:44 +01:00
|pkgn dest pkg fileReference fileName writer core hePackage ignoresClasses|
FFIMethodRegistry resetAll.
2022-08-08 16:37:24 +02:00
Smalltalk garbageCollect.
2022-02-15 22:08:44 +01:00
dest := Smalltalk arguments first.
pkgn := Smalltalk arguments at:2.
core := HEPackage new.
core classes: OrderedCollection new.
core traits: OrderedCollection new.
core extensionMethods: OrderedCollection new.
core packageName: pkgn.
packages := #(
'Kernel-Chronology-Extras'
'Jobs'
'Collections-Arithmetic'
'Ring-Deprecated-Core-Kernel'
2022-08-08 16:37:24 +02:00
'Ring-Deprecated-Core-Containers'
2022-02-15 22:08:44 +01:00
'Math-Operations-Extensions'
'Collections-Atomic'
'Collections-DoubleLinkedList'
'DeprecatedFileStream'
'Zinc-Resource-Meta-Core'
'Zinc-Character-Encoding-Core'
'FileSystem-Core'
'FileSystem-Disk'
'FileSystem-Memory'
'Compression'
'FileSystem-Zip'
'Multilingual-Encodings'
'Multilingual-Languages'
'Multilingual-TextConversion'
'Text-Core'
'AST-Core'
'Debugging-Core'
'OpalCompiler-Core'
'Kernel-Traits'
'AST-Core-Traits'
'Collections-Abstract-Traits'
'Transcript-Core-Traits'
'TraitsV2-Compatibility'
'Alien-Core'
'System-Model'
'PragmaCollector'
'UnifiedFFI'
'UnifiedFFI-Legacy'
'Slot-Core'
'System-Localization'
'STON-Core'
2022-03-06 21:31:35 +01:00
'Colors'
'Diya'
2022-02-15 22:08:44 +01:00
).
ignoresClasses := {
2022-08-08 16:37:24 +02:00
"RGCommentDefinition.
RGMethodDefinition."
2022-02-15 22:08:44 +01:00
ChangeRecord.
PluggableListMorph.
TextLine.
TransformMorph.
StringMorph.
AthensCairoSDLSurface.
SourceFileArray.
GlyphForm.
2022-03-16 00:02:31 +01:00
ManifestGraphicsPrimitives.
EllipseMidpointTracer.
2022-08-09 00:25:36 +02:00
GrafPort.
Form
2022-02-15 22:08:44 +01:00
}.
"remove some unused meothods"
2022-08-08 16:37:24 +02:00
AbstractFileReference
removeSelector: #fileIn.
FileStream
removeSelector: #fileIn.
GZipReadStream class
removeSelector: #fileIn:.
STCommandLineHandler
removeSelector: #installSourceFile:;
compile: 'installSourceFiles
';
removeSelector: #loadSourceFiles:;
compile: 'selectSourceFiles
'.
PharoCommandLineHandler
compile: 'changePreferences
';
compile: 'runPreferences
'.
Rectangle class
removeSelector: #fromUser:;
removeSelector: #fromUser.
2022-02-15 22:08:44 +01:00
CompositeTransform removeSelector:#asMorphicTransform.
2022-02-15 22:08:44 +01:00
packages do:[:name | |pkg trait classes extensionMethods|
Transcript show: 'Processing package ',name;cr.
FFIMethodRegistry resetAll.
2022-08-08 16:37:24 +02:00
Smalltalk garbageCollect.
2022-02-15 22:08:44 +01:00
pkg := RPackageOrganizer default packageNamed: name asSymbol.
traits := (pkg definedClasses select: #isTrait) do: [ :e | core traits add:(HETrait for: e) ].
(pkg definedClasses reject: #isTrait) do: [ :e |
2022-03-16 00:02:31 +01:00
(ignoresClasses includes:e) ifFalse:[
2022-02-15 22:08:44 +01:00
core addClass: (HEClass for: e) ].
].
pkg extensionMethods do: [ :e |
(ignoresClasses includes:e classBinding value) ifFalse:[
core extensionMethods add:(HEMethod for: e)
]
].
].
"SDL binding class"
pkg := RPackageOrganizer default packageNamed: 'OSWindow-SDL2' asSymbol.
(pkg classNamesForClassTag: 'Bindings') do:[:e|
(ignoresClasses includes:e asClass) ifFalse:[
core addClass:(HEClass for:e asClass) ]].
"FreeType binding class"
pkg := RPackageOrganizer default packageNamed: 'FreeType' asSymbol.
(pkg classNamesForClassTag: 'Base') do:[:e|
(ignoresClasses includes:e asClass) ifFalse:[
core addClass:(HEClass for:e asClass) ]].
(pkg classNamesForClassTag: 'Bindings') do:[:e|
(ignoresClasses includes:e asClass) ifFalse:[
core addClass:(HEClass for:e asClass) ]].
2022-02-15 22:08:44 +01:00
"fixing some missing classes"
core addClass: (HEClass for:OSWindowPlatformSpecificHandle);
addClass: (HEClass for:ChunkWriteStream);
addClass: (HEClass for:ChunkReadStream);
2022-08-08 16:37:24 +02:00
addClass: (HEClass for: PharoCommandLineHandler);
2022-03-04 20:45:12 +01:00
addClass: (HEClass for:STCommandLineHandler);
addClass: (HEClass for:FreeTypeFace);
"form object support"
addClass: (HEClass for: ShortIntegerArray);
addClass: (HEClass for:DisplayTransform);
addClass: (HEClass for:MatrixTransform2x3);
addClass: (HEClass for:CompositeTransform)
2022-02-15 22:08:44 +01:00
.
fileReference := (dest,'/',(pkgn replaceAll: Character space with: $-),'.hermes') asFileReference.
fileName := fileReference fullName.
writer := HEBinaryReaderWriter new
stream: (File openForWriteFileNamed:fileName);
yourself.
core writeInto: writer.
writer stream flush.
Transcript show: 'File exported to ', dest, '/', pkgn, '.hermes'; cr.