[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
app[scripting] Recompile all
"Ensure scripting engine is loaded"
self require: #( ScriptParser ScriptCompiler )
in: (#(Bindings Scripting ScriptCompiler ScriptSteps) collect: [:each|
'u8:aleReimondo/s8/library/scripting/',each,'.st.js' ])
"Recompile all classes using scripting framework and report errors when finished."
| toDo step each recompile ok pool finished |
pool := PoolDictionary new. Smalltalk at: #Failures put: pool.
finished := [ self note: 'Collecting results in ' ,pool asLiteral.
pool isEmpty ifFalse: [ (pool keys sorted inject: '' writeStream into: [:stream :key|
stream nextPutAll: key;cr.
(pool at: key) do: [:each| stream nextPutAll: ' ' ,each;cr ].
stream
]) contents inspect ].
self note: #done
].
toDo := Object withAllSubclasses.
recompile := [:mth| ok := nil.
[(mth source includes: ${,$') ifFalse: [
"self note: 'compiling ' ,mth."
"mth classField compiler"ScriptCompiler new
compile: mth source
forClass: mth classField
] ] on: Error do: [:ex| ok := ex description ].
ok notNil ifTrue: [
self note: $ ,mth.
(pool at: ok ifAbsentPut: [#()]) add: mth.
].
].
step := [toDo notEmpty ifTrue: [ | gap | gap := 10.
each := toDo removeFirst.
(each isKindOf: Behavior) ifTrue: [
self note: each name. gap := 1000.
each class methodsDo: [:mth| toDo addFirst: mth ].
each methodsDo: [:mth| toDo addFirst: mth ].
] ifFalse: [ recompile value: each ].
step valueDeferred: gap
] ifFalse: [ finished value ]].
step value