From cfc953a0e4412dcf95d27d403e6d60cc67bf3a4c Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Thu, 5 Oct 2023 17:07:56 +0200 Subject: [PATCH 1/2] Monticello: Repackage classes and methods In this change I propose to move all classes that are just present to be able to read old exported code of Monticello in "Monticello-BackwardCompatibility". I also moved #isTraitDefinition from Tonel to Pharo. Next step is to remove them from Tonel once this is merged. --- .../BaselineOfBasicTools.class.st | 2 +- .../MCClassTraitDefinition.class.st | 16 +++++-- .../MCClassTraitParser.class.st | 5 +-- .../MCDataStream.extension.st | 42 +++++++++---------- .../MCOldDataStreamExtensions.class.st | 5 +-- .../MCSystemCategoryParser.class.st | 5 +-- ...ticelloOldDataStreamCompatibility.class.st | 11 +++++ .../WordArray.extension.st | 2 +- .../package.st | 1 + ...ticelloOldDataStreamCompatibility.class.st | 10 ----- .../package.st | 1 - src/Monticello/MCDefinition.class.st | 5 +++ src/Monticello/MCOrganizationParser.class.st | 2 +- src/Monticello/MCTraitDefinition.class.st | 5 +++ .../MCClassTraitDefinition.extension.st | 16 ------- .../MCClassTraitDefinition.extension.st | 21 ---------- 16 files changed, 65 insertions(+), 84 deletions(-) rename src/{Monticello => Monticello-BackwardCompatibility}/MCClassTraitDefinition.class.st (93%) rename src/{Monticello => Monticello-BackwardCompatibility}/MCClassTraitParser.class.st (89%) rename src/{Monticello-OldDataStreamCompatibility => Monticello-BackwardCompatibility}/MCDataStream.extension.st (87%) rename src/{Monticello-OldDataStreamCompatibility => Monticello-BackwardCompatibility}/MCOldDataStreamExtensions.class.st (91%) rename src/{Monticello => Monticello-BackwardCompatibility}/MCSystemCategoryParser.class.st (93%) create mode 100644 src/Monticello-BackwardCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st rename src/{Monticello-OldDataStreamCompatibility => Monticello-BackwardCompatibility}/WordArray.extension.st (89%) create mode 100644 src/Monticello-BackwardCompatibility/package.st delete mode 100644 src/Monticello-OldDataStreamCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st delete mode 100644 src/Monticello-OldDataStreamCompatibility/package.st delete mode 100644 src/Ring-Definitions-Monticello/MCClassTraitDefinition.extension.st delete mode 100644 src/Ring-Monticello/MCClassTraitDefinition.extension.st diff --git a/src/BaselineOfBasicTools/BaselineOfBasicTools.class.st b/src/BaselineOfBasicTools/BaselineOfBasicTools.class.st index c712b8f4239..cf1a0ebc96d 100644 --- a/src/BaselineOfBasicTools/BaselineOfBasicTools.class.st +++ b/src/BaselineOfBasicTools/BaselineOfBasicTools.class.st @@ -85,7 +85,7 @@ BaselineOfBasicTools >> baseline: spec [ spec package: 'Refactoring-Core'. spec package: 'Refactoring-UI'. spec package: 'Refactoring-Environment'. - spec package: 'Monticello-OldDataStreamCompatibility'. + spec package: 'Monticello-BackwardCompatibility'. spec package: 'MonticelloFileServices'. self specRefactoring: spec. diff --git a/src/Monticello/MCClassTraitDefinition.class.st b/src/Monticello-BackwardCompatibility/MCClassTraitDefinition.class.st similarity index 93% rename from src/Monticello/MCClassTraitDefinition.class.st rename to src/Monticello-BackwardCompatibility/MCClassTraitDefinition.class.st index 13a62328196..f115685b262 100644 --- a/src/Monticello/MCClassTraitDefinition.class.st +++ b/src/Monticello-BackwardCompatibility/MCClassTraitDefinition.class.st @@ -10,9 +10,8 @@ Class { 'packageName', 'tagName' ], - #category : 'Monticello-Modeling', - #package : 'Monticello', - #tag : 'Modeling' + #category : 'Monticello-BackwardCompatibility', + #package : 'Monticello-BackwardCompatibility' } { #category : 'instance creation' } @@ -78,6 +77,12 @@ MCClassTraitDefinition >> category: aCategoryString [ self packageName: aCategoryString ] +{ #category : 'accessing' } +MCClassTraitDefinition >> classDefinitionString [ + + ^self definitionString +] + { #category : 'accessing' } MCClassTraitDefinition >> className [ ^self baseTrait @@ -189,3 +194,8 @@ MCClassTraitDefinition >> tagName: anObject [ tagName := anObject ] + +{ #category : 'accessing' } +MCClassTraitDefinition >> traitComposition [ + ^ self classTraitComposition +] diff --git a/src/Monticello/MCClassTraitParser.class.st b/src/Monticello-BackwardCompatibility/MCClassTraitParser.class.st similarity index 89% rename from src/Monticello/MCClassTraitParser.class.st rename to src/Monticello-BackwardCompatibility/MCClassTraitParser.class.st index 088e1091145..c7e05a88c69 100644 --- a/src/Monticello/MCClassTraitParser.class.st +++ b/src/Monticello-BackwardCompatibility/MCClassTraitParser.class.st @@ -6,9 +6,8 @@ MCClassTraitDefinition are not generated anymore by Pharo. This is just here for Class { #name : 'MCClassTraitParser', #superclass : 'MCDoItParser', - #category : 'Monticello-Chunk Format', - #package : 'Monticello', - #tag : 'Chunk Format' + #category : 'Monticello-BackwardCompatibility', + #package : 'Monticello-BackwardCompatibility' } { #category : 'factory identification hook' } diff --git a/src/Monticello-OldDataStreamCompatibility/MCDataStream.extension.st b/src/Monticello-BackwardCompatibility/MCDataStream.extension.st similarity index 87% rename from src/Monticello-OldDataStreamCompatibility/MCDataStream.extension.st rename to src/Monticello-BackwardCompatibility/MCDataStream.extension.st index 88b36baee50..37048373a01 100644 --- a/src/Monticello-OldDataStreamCompatibility/MCDataStream.extension.st +++ b/src/Monticello-BackwardCompatibility/MCDataStream.extension.st @@ -1,13 +1,13 @@ Extension { #name : 'MCDataStream' } -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readBitmap [ "PRIVATE -- Read the contents of a Bitmap." ^ Bitmap newFromStream: byteStream "Note that the reader knows that the size is in long words, but the data is in bytes." ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readByteArray [ "PRIVATE -- Read the contents of a ByteArray." @@ -17,12 +17,12 @@ MCDataStream >> readByteArray [ ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readClass [ ^ self error: 'Classes cannot be materialized with DataStream' ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readFloat [ "PRIVATE -- Read the contents of a Float. This is the fast way to read a Float. @@ -35,7 +35,7 @@ MCDataStream >> readFloat [ ^ new ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readMethod [ "PRIVATE -- Read the contents of an arbitrary instance. ASSUMES: readDataFrom:size: sends me beginReference: after it @@ -62,7 +62,7 @@ MCDataStream >> readMethod [ ^ newMethod ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readRectangle [ "Read a compact Rectangle. Rectangles with values outside +/- 2047 were stored as normal objects (type=9). They will not come here. 17:22 tk" @@ -84,7 +84,7 @@ MCDataStream >> readRectangle [ ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readReference [ "Read the contents of an object reference. (Cf. outputReference:) File is not now positioned at this object." | referencePosition | @@ -93,7 +93,7 @@ MCDataStream >> readReference [ ifFalse: [self objectAt: referencePosition] "relative pos" ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readShortInst [ "Read the contents of an arbitrary instance that has a short header. ASSUMES: readDataFrom:size: sends me beginReference: after it @@ -116,34 +116,34 @@ MCDataStream >> readShortInst [ ^ anObject ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readShortRef [ "Read an object reference from two bytes only. Original object must be in first 65536 bytes of the file. Relative to start of data. vacantRef not a possibility." ^ self objectAt: (byteStream nextNumber: 2) ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readStringOld [ ^ byteStream nextStringOld ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readUser [ "Reconstruct both the private class and the instance. Still used??" ^ self readInstance. "Will create new unique class" ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readWordArray [ "PRIVATE -- Read the contents of a WordArray." ^ WordArray newFromStream: byteStream "Size is number of long words." ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> readWordLike [ | refPosn aSymbol newClass anObject | "Can be used by any class that is bits and not bytes (WordArray, Bitmap, SoundBuffer, etc)." @@ -155,7 +155,7 @@ MCDataStream >> readWordLike [ ^ anObject ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> writeBitmap: aBitmap [ "PRIVATE -- Write the contents of a Bitmap." @@ -163,7 +163,7 @@ MCDataStream >> writeBitmap: aBitmap [ "Note that this calls (byteStream nextPutAll: aBitmap) which knows enough to put 4-byte quantities on the stream! Reader must know that size is in long words." ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> writeByteArray: aByteArray [ "PRIVATE -- Write the contents of a ByteArray." @@ -172,12 +172,12 @@ MCDataStream >> writeByteArray: aByteArray [ byteStream nextPutAll: aByteArray. ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> writeClass: aClass [ ^ self error: 'Classes cannot be serialized with DataStream' ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> writeFloat: aFloat [ "PRIVATE -- Write the contents of a Float. We support 8-byte Floats here." @@ -187,7 +187,7 @@ MCDataStream >> writeFloat: aFloat [ ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> writeRectangle: anObject [ "Write the contents of a Rectangle. See if it can be a compact Rectangle (type=15). Rectangles with values outside +/- 2047 were stored as normal objects (type=9). 17:22 tk" @@ -213,7 +213,7 @@ MCDataStream >> writeRectangle: anObject [ byteStream nextNumber: 3 put: acc. ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> writeStringOld: aString [ "PRIVATE -- Write the contents of a String." @@ -229,7 +229,7 @@ MCDataStream >> writeStringOld: aString [ ifFalse: [self writeByteArray: aString]. "takes more space" ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> writeUser: anObject [ "Write the contents of an arbitrary User instance (and its devoted class)." @@ -237,7 +237,7 @@ MCDataStream >> writeUser: anObject [ ^ anObject storeDataOn: self ] -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } MCDataStream >> writeWordLike: aWordArray [ "Note that we put the class name before the size." diff --git a/src/Monticello-OldDataStreamCompatibility/MCOldDataStreamExtensions.class.st b/src/Monticello-BackwardCompatibility/MCOldDataStreamExtensions.class.st similarity index 91% rename from src/Monticello-OldDataStreamCompatibility/MCOldDataStreamExtensions.class.st rename to src/Monticello-BackwardCompatibility/MCOldDataStreamExtensions.class.st index ee11a4947a4..4c496876314 100644 --- a/src/Monticello-OldDataStreamCompatibility/MCOldDataStreamExtensions.class.st +++ b/src/Monticello-BackwardCompatibility/MCOldDataStreamExtensions.class.st @@ -6,9 +6,8 @@ This package is unloadeable. Class { #name : 'MCOldDataStreamExtensions', #superclass : 'Object', - #category : 'Monticello-OldDataStreamCompatibility-Base', - #package : 'Monticello-OldDataStreamCompatibility', - #tag : 'Base' + #category : 'Monticello-BackwardCompatibility', + #package : 'Monticello-BackwardCompatibility' } { #category : 'class initialization' } diff --git a/src/Monticello/MCSystemCategoryParser.class.st b/src/Monticello-BackwardCompatibility/MCSystemCategoryParser.class.st similarity index 93% rename from src/Monticello/MCSystemCategoryParser.class.st rename to src/Monticello-BackwardCompatibility/MCSystemCategoryParser.class.st index 8f18c74b224..95965601df3 100644 --- a/src/Monticello/MCSystemCategoryParser.class.st +++ b/src/Monticello-BackwardCompatibility/MCSystemCategoryParser.class.st @@ -4,9 +4,8 @@ A MCSystemCategoryParser extracts or set a category/protocol to the correspondin Class { #name : 'MCSystemCategoryParser', #superclass : 'MCDoItParser', - #category : 'Monticello-Chunk Format', - #package : 'Monticello', - #tag : 'Chunk Format' + #category : 'Monticello-BackwardCompatibility', + #package : 'Monticello-BackwardCompatibility' } { #category : 'factory identification hook' } diff --git a/src/Monticello-BackwardCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st b/src/Monticello-BackwardCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st new file mode 100644 index 00000000000..c606005f633 --- /dev/null +++ b/src/Monticello-BackwardCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st @@ -0,0 +1,11 @@ +" +I am a package containing backward compatibility code of Monticello. + +I contains things that are not needed anymore in Monticello but that are present to be able to read code exported in the past in newer version of Pharo. +" +Class { + #name : 'ManifestMonticelloOldDataStreamCompatibility', + #superclass : 'PackageManifest', + #category : 'Monticello-BackwardCompatibility', + #package : 'Monticello-BackwardCompatibility' +} diff --git a/src/Monticello-OldDataStreamCompatibility/WordArray.extension.st b/src/Monticello-BackwardCompatibility/WordArray.extension.st similarity index 89% rename from src/Monticello-OldDataStreamCompatibility/WordArray.extension.st rename to src/Monticello-BackwardCompatibility/WordArray.extension.st index c54de0eb3a3..d2858063d5f 100644 --- a/src/Monticello-OldDataStreamCompatibility/WordArray.extension.st +++ b/src/Monticello-BackwardCompatibility/WordArray.extension.st @@ -1,6 +1,6 @@ Extension { #name : 'WordArray' } -{ #category : '*Monticello-OldDataStreamCompatibility' } +{ #category : '*Monticello-BackwardCompatibility' } WordArray class >> newFromStream: s [ "Only meant for my subclasses that are raw bits and word-like. For quick unpack form the disk." | len | diff --git a/src/Monticello-BackwardCompatibility/package.st b/src/Monticello-BackwardCompatibility/package.st new file mode 100644 index 00000000000..75440ad344d --- /dev/null +++ b/src/Monticello-BackwardCompatibility/package.st @@ -0,0 +1 @@ +Package { #name : 'Monticello-BackwardCompatibility' } diff --git a/src/Monticello-OldDataStreamCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st b/src/Monticello-OldDataStreamCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st deleted file mode 100644 index 6a87640efc7..00000000000 --- a/src/Monticello-OldDataStreamCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st +++ /dev/null @@ -1,10 +0,0 @@ -" -Compatibility package for old data streams -" -Class { - #name : 'ManifestMonticelloOldDataStreamCompatibility', - #superclass : 'PackageManifest', - #category : 'Monticello-OldDataStreamCompatibility-Manifest', - #package : 'Monticello-OldDataStreamCompatibility', - #tag : 'Manifest' -} diff --git a/src/Monticello-OldDataStreamCompatibility/package.st b/src/Monticello-OldDataStreamCompatibility/package.st deleted file mode 100644 index 0245b4b597b..00000000000 --- a/src/Monticello-OldDataStreamCompatibility/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : 'Monticello-OldDataStreamCompatibility' } diff --git a/src/Monticello/MCDefinition.class.st b/src/Monticello/MCDefinition.class.st index 57957585b22..13a22b4fd8d 100644 --- a/src/Monticello/MCDefinition.class.st +++ b/src/Monticello/MCDefinition.class.st @@ -108,6 +108,11 @@ MCDefinition >> isScriptDefinition [ ^false ] +{ #category : 'testing' } +MCDefinition >> isTraitDefinition [ + ^ false +] + { #category : 'installing' } MCDefinition >> load [ diff --git a/src/Monticello/MCOrganizationParser.class.st b/src/Monticello/MCOrganizationParser.class.st index cd52403273c..9680556caa5 100644 --- a/src/Monticello/MCOrganizationParser.class.st +++ b/src/Monticello/MCOrganizationParser.class.st @@ -3,7 +3,7 @@ A MCSystemCategoryParser extracts or set a category/protocol to the correspondin " Class { #name : 'MCOrganizationParser', - #superclass : 'MCSystemCategoryParser', + #superclass : 'MCDoItParser', #category : 'Monticello-Chunk Format', #package : 'Monticello', #tag : 'Chunk Format' diff --git a/src/Monticello/MCTraitDefinition.class.st b/src/Monticello/MCTraitDefinition.class.st index 8f2248337cd..4715d3e74a1 100644 --- a/src/Monticello/MCTraitDefinition.class.st +++ b/src/Monticello/MCTraitDefinition.class.st @@ -89,6 +89,11 @@ MCTraitDefinition >> hash [ ^ (name hash bitXor: traitComposition hash) bitXor: self category hash ] +{ #category : 'testing' } +MCTraitDefinition >> isTraitDefinition [ + ^ true +] + { #category : 'printing' } MCTraitDefinition >> printClassDefinitionOn: stream [ diff --git a/src/Ring-Definitions-Monticello/MCClassTraitDefinition.extension.st b/src/Ring-Definitions-Monticello/MCClassTraitDefinition.extension.st deleted file mode 100644 index 73c8829eae2..00000000000 --- a/src/Ring-Definitions-Monticello/MCClassTraitDefinition.extension.st +++ /dev/null @@ -1,16 +0,0 @@ -Extension { #name : 'MCClassTraitDefinition' } - -{ #category : '*Ring-Definitions-Monticello' } -MCClassTraitDefinition >> asRingDefinition [ - - ^(RGMetatraitDefinition named: baseTrait) - traitCompositionSource: self classTraitCompositionString; - definitionSource: self definitionString; - yourself -] - -{ #category : '*Ring-Definitions-Monticello' } -MCClassTraitDefinition >> classDefinitionString [ - - ^self definitionString -] diff --git a/src/Ring-Monticello/MCClassTraitDefinition.extension.st b/src/Ring-Monticello/MCClassTraitDefinition.extension.st deleted file mode 100644 index 03154c79961..00000000000 --- a/src/Ring-Monticello/MCClassTraitDefinition.extension.st +++ /dev/null @@ -1,21 +0,0 @@ -Extension { #name : 'MCClassTraitDefinition' } - -{ #category : '*Ring-Monticello' } -MCClassTraitDefinition >> asRGDefinition [ - - ^ self ensureRingDefinitionIn: RGEnvironment new -] - -{ #category : '*Ring-Monticello' } -MCClassTraitDefinition >> ensureRingDefinitionIn: anRGEnvironment [ - - ^ anRGEnvironment backend definitionFor: self ifAbsentRegister: [ - | def traitDef | - def := anRGEnvironment ensureMetaclassTraitNamed: (self baseTrait, ' classTrait') asSymbol. - traitDef := anRGEnvironment ensureTraitNamed: (self baseTrait) asSymbol. - def baseTrait: traitDef. - traitDef classTrait: def. - def traitComposition: (self traitCompositionFrom: self classTraitComposition parent: def). - traitDef category: self category. "makes no sense for metaclass trait" - def] -] From 073977af654c973b4875a2166d25d2143cd8a804 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Fri, 6 Oct 2023 14:44:04 +0200 Subject: [PATCH 2/2] Manage manifest --- ...st => ManifestMonticelloBackwardCompatibility.class.st} | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) rename src/Monticello-BackwardCompatibility/{ManifestMonticelloOldDataStreamCompatibility.class.st => ManifestMonticelloBackwardCompatibility.class.st} (60%) diff --git a/src/Monticello-BackwardCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st b/src/Monticello-BackwardCompatibility/ManifestMonticelloBackwardCompatibility.class.st similarity index 60% rename from src/Monticello-BackwardCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st rename to src/Monticello-BackwardCompatibility/ManifestMonticelloBackwardCompatibility.class.st index c606005f633..03776a422e1 100644 --- a/src/Monticello-BackwardCompatibility/ManifestMonticelloOldDataStreamCompatibility.class.st +++ b/src/Monticello-BackwardCompatibility/ManifestMonticelloBackwardCompatibility.class.st @@ -4,8 +4,9 @@ I am a package containing backward compatibility code of Monticello. I contains things that are not needed anymore in Monticello but that are present to be able to read code exported in the past in newer version of Pharo. " Class { - #name : 'ManifestMonticelloOldDataStreamCompatibility', + #name : 'ManifestMonticelloBackwardCompatibility', #superclass : 'PackageManifest', - #category : 'Monticello-BackwardCompatibility', - #package : 'Monticello-BackwardCompatibility' + #category : 'Monticello-BackwardCompatibility-Manifest', + #package : 'Monticello-BackwardCompatibility', + #tag : 'Manifest' }