Changes in GT for supporting in Pharo 12
This page documents changes that we did in GT for supporting it in Pharo 12.
Some changes are quick fixes that fix an issue, but would be better to review.
RPackage>>#toTagName:
is not in Pharo 12 so no need to patch it.
CompiledMethod>>#basicAsMCMethodDefinition
basicAsMCMethodDefinition
<gtPharoPatch: #Pharo>
^ MCMethodDefinition
className: self methodClass instanceSide name
classIsMeta: self isClassSide
selector: self selector
category: self protocol
timeStamp: '' "self stamp"
source: self sourceCode
should use #protocolName instead of #protocol. Before #protocol returned a string, now it returns an object.
Added MetacelloToolBox to releaser
MetacelloToolBox
Object subclass: #MetacelloToolBox
instanceVariableNames: 'project methodSpec'
classVariableNames: ''
package: 'GToolkit-Releaser-BaselineModel-Metacello'
is not much used in Pharo and was removed in https://github.com/pharo-project/pharo/pull/15287. We copied it to releaser for now. We should review how/why we need to use it.
Added MetacelloMCProjectSpec>>#projectClass
projectClass
<gtPharoPatch: #Pharo>
self className == nil
ifTrue: [ ^ nil ].
^ Smalltalk at: self className asSymbol ifAbsent: [ ]
; commit
we should review why we need it
Update GtRlDependenciesModelBuilder
Object subclass: #GtRlDependenciesModelBuilder
instanceVariableNames: 'projectsByBaselineClass repositoriesByUrl projectsChain'
classVariableNames: ''
package: 'GToolkit-Releaser-BaselineModel-Builder'
In Pharo 12 getting the metacelo version throug MetacelloMCProjectSpec
MetacelloGenericProjectSpec subclass: #MetacelloMCProjectSpec
instanceVariableNames: 'file'
classVariableNames: ''
package: 'Metacello-MC-Specs'
. Instead we get it directly from the baseline class.
Move announcer
attribute to Job
Object subclass: #Job
instanceVariableNames: 'block currentValue min max title children isRunning parent process owner announcer'
classVariableNames: ''
package: 'Jobs-Base'
from GtJob
Job subclass: #GtJob
instanceVariableNames: ''
classVariableNames: ''
package: 'GToolkit-Pharo-Coder-UI-Refactorings'
In Pharo 12, Job
Object subclass: #Job
instanceVariableNames: 'block currentValue min max title children isRunning parent process owner announcer'
classVariableNames: ''
package: 'Jobs-Base'
has an announcemt. So we add it to Pharo 10&11 in BaselineOfGToolkitPrerequisites>>#applyPatchForJob
applyPatchForJob
self
forPharo12: []
forPharo11AndPharo10: [ Job addSlot: #announcer ]
as we need GtJob
Job subclass: #GtJob
instanceVariableNames: ''
classVariableNames: ''
package: 'GToolkit-Pharo-Coder-UI-Refactorings'
to have its own announcemet.
The hierarchy of the class Protocol
AbstractProtocol subclass: #Protocol
instanceVariableNames: 'name methodSelectors'
classVariableNames: ''
package: 'Kernel-Protocols'
is changed in Pharo 12. There is no more AbstractProtocol, AllProtocol andProtocolOrganizer.
Login to handle the finalization process was extracted from WeakArray
Array weakSubclass: #WeakArray
instanceVariableNames: ''
classVariableNames: 'FinalizationProcess FinalizationSemaphore MournLoopProcess StopRequested StoppedSemaphore'
package: 'Collections-Weak-Base'
.
In Pharo 11 the logic to handle the finalization process is on the class side of WeakArray
Array weakSubclass: #WeakArray
instanceVariableNames: ''
classVariableNames: 'FinalizationProcess FinalizationSemaphore MournLoopProcess StopRequested StoppedSemaphore'
package: 'Collections-Weak-Base'
. In Pharo 12 a dedicated class, FinalizationProcess
Object subclass: #FinalizationProcess
instanceVariableNames: ''
classVariableNames: 'FinalizationSemaphore MournLoopProcess StopRequested StoppedSemaphore TheFinalizationProcess'
package: 'GToolkit-UtilitySystemStubs'
, was added.
One issue is that in Pharo 11, the class WeakArray has an class variable named FinalisationProcess, that is being changed. We add those methods that change the class variable FinalisationProcess using the patch BaselineOfGToolkitPrerequisites>>#applyPatchForWeakArray
applyPatchForWeakArray
self
forPharo12: [
WeakArray
addClassVarNamed: 'MournLoopProcess';
addClassVarNamed: 'StopRequested';
addClassVarNamed: 'StoppedSemaphore';
addClassVarNamed: 'TheFinalizationProcess';
addClassVarNamed: 'FinalizationSemaphore' ]
forPharo11AndPharo10: [
WeakArray
addClassVarNamed: 'MournLoopProcess';
addClassVarNamed: 'StopRequested';
addClassVarNamed: 'StoppedSemaphore';
initialize.
WeakArray class
compile: 'startUp: resuming
<gtPharoPatch: #Pharo11>
"DO NOT EDIT HERE"
self restartFinalizationProcess'
classified: 'gt-pharo-patch'.
WeakArray class
compile: 'shutDown: quitting
<gtPharoPatch: #Pharo11>
"DO NOT EDIT HERE"
self stopFinalizationProcess'
classified: 'gt-pharo-patch'.
WeakArray class
compile: 'restartFinalizationProcess
"kill any old process, just in case"
"DO NOT EDIT HERE"
<gtPharoPatch: #Pharo11>
self stopFinalizationProcess.
FinalizationSemaphore := Smalltalk specialObjectsArray at: 42.
StopRequested := false.
FinalizationProcess := [self finalizationProcess]
forkAt: Processor userInterruptPriority.
FinalizationProcess name: ''WeakArray Finalization Process'''
classified: 'gt-pharo-patch'.
WeakArray class
compile: 'stopFinalizationProcess
<gtPharoPatch: #Pharo11>
"DO NOT EDIT HERE"
FinalizationProcess ifNotNil:
[FinalizationProcess terminate.
FinalizationProcess := nil].
(MournLoopProcess isNil or: [ MournLoopProcess isTerminated ])
ifTrue: [ ^ self ].
self assert: self stoppedSemaphore isSignaled not.
StopRequested := true.
StoppedSemaphore wait.'
classified: 'gt-pharo-patch' ]
only in Pharo 11.
For FinalizationProcess
Object subclass: #FinalizationProcess
instanceVariableNames: ''
classVariableNames: 'FinalizationSemaphore MournLoopProcess StopRequested StoppedSemaphore TheFinalizationProcess'
package: 'GToolkit-UtilitySystemStubs'
we compile the class in Pharo 11 as a patch, and missing class variables in Pharo 12, in BaselineOfGToolkitPrerequisites>>#applyPatchForFinalizationProcess
applyPatchForFinalizationProcess
self
forPharo12: [
(#FinalizationProcess asClassInEnvironment: Smalltalk globals)
addClassVarNamed: 'MournLoopProcess';
addClassVarNamed: 'StopRequested';
addClassVarNamed: 'StoppedSemaphore';
initialize.
]
forPharo11AndPharo10: [
Object subclass: #FinalizationProcess
instanceVariableNames: ''
classVariableNames: 'TheFinalizationProcess FinalizationSemaphore MournLoopProcess StopRequested StoppedSemaphore'
package: 'GToolkit-UtilitySystemStubs'.
]
.