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.

Updated load-patches.st.

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.

Protocols changes

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'. ] .

UUID ByteArray variableByteSubclass: #UUID instanceVariableNames: '' classVariableNames: '' package: 'Network-UUID-Base' changed superclass and structure

In Pharo 11 UUID ByteArray variableByteSubclass: #UUID instanceVariableNames: '' classVariableNames: '' package: 'Network-UUID-Base' subclasses ByteArray ArrayedCollection variableByteSubclass: #ByteArray instanceVariableNames: '' classVariableNames: '' package: 'Collections-Native-Base' . In Pharo 12 it subclasses Object and has a uuidData slot with the byte array data. In GT it was causing issues due to how we serialize UUID objects. Most changes are limited to:

UUID>>#fromBase64EncodedString: fromBase64EncodedString: aString64 | uid | uid := self nilUUID. self forPharo12: [ (ZnBase64Encoder new decode: aString64 readStream to: uid uuidData writeStream) ] forPharo11AndPharo10: [ ZnBase64Encoder new decode: aString64 readStream to: uid writeStream ]. ^ uid

UUID>>#base64Encoded base64Encoded ^ self forPharo12: [ self uuidData base64Encoded ] forPharo11AndPharo10: [ super base64Encoded ]

OmEntry Object subclass: #OmEntry instanceVariableNames: 'tags content' classVariableNames: '' package: 'Ombu-Entries' missing time

When OmEntry Object subclass: #OmEntry instanceVariableNames: 'tags content' classVariableNames: '' package: 'Ombu-Entries' objects are created in EpLog>>#addEntryWith:tags: addEntryWith: anEvent tags: blockClosureForCustomTags "Add an event with the specified tags" | newEntry | newEntry := OmEntry content: anEvent. "add tags" newEntry tags at: self class priorReferenceKey put: self headReference; in: blockClosureForCustomTags. "write the new entry" store newEntry: newEntry. "update caches with the new entry" self cacheEntry: newEntry. self announceAdded: newEntry. ^ newEntry no time is set in Pharo 12. We are using them in OmEntry>>#gtTime gtTime ^ self tagAt: #time .

Icons for EpEvent Object subclass: #EpEvent instanceVariableNames: '' classVariableNames: '' package: 'Epicea-Model' entries

In Pharo 12 a different visitor it used to just return the name of an icon instead of a Form object. The patch is in GtEpicea>>#iconForEpiceaChange: iconForEpiceaChange: anEpChange ^ self forPharo12: [ Smalltalk ui icons iconNamed: (anEpChange accept: EpIconNameVisitor new) ] forPharo11AndPharo10: [ anEpChange accept: EpIconVisitor new ] .