Skip to content

Commit dfc8ec1

Browse files
committed
Issue #953: (prematurely) changed the method sort order to codePoint before realizing that I would be jeopardizing my ability the cleanly merge work from other branches ... so this branch should not be merged
1 parent b0e403d commit dfc8ec1

6 files changed

+115
-59
lines changed

rowan/src/Rowan-Core/RwModificationFiletreeWriterVisitorV2.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ RwModificationFiletreeWriterVisitorV2 >> _createFileNameMapForMethods: aMethodDe
123123
put: (self _methodFileNameFor: def) ]
124124
ifFalse: [
125125
"tack on postfix to guarantee file names are unique on case insensitive file systems"
126-
sortedCol := col sort: [ :a :b | a selector asString _unicodeLessThan: b selector asString ].
126+
sortedCol := col sort: [ :a :b | (a selector asString codePointCompareTo: b selector asString) < 1 ].
127127
(1 to: sortedCol size) do: [ :index |
128128
| def filename |
129129
def := sortedCol at: index.

rowan/src/Rowan-Core/RwModificationTonelWriterVisitorV2.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,15 @@ RwModificationTonelWriterVisitorV2 >> _writeClassExtension: aClassExtension on:
235235
{ #category : 'class writing' }
236236
RwModificationTonelWriterVisitorV2 >> _writeClassSideMethodDefinitions: aClassDefinition on: aStream [
237237
((aClassDefinition classMethodDefinitions values )
238-
sortWithBlock: [ :a :b | a selector _unicodeLessThan: b selector ])
238+
sortWithBlock: [ :a :b | (a selector codePointCompareTo: b selector) < 1 ])
239239
do: [ :each |
240240
self _writeMethodDefinition: each classDefinition: aClassDefinition isMeta: true on: aStream ]
241241
]
242242
243243
{ #category : 'class writing' }
244244
RwModificationTonelWriterVisitorV2 >> _writeInstanceSideMethodDefinitions: aClassDefinition on: aStream [
245245
((aClassDefinition instanceMethodDefinitions values )
246-
sortWithBlock: [ :a :b | a selector _unicodeLessThan: b selector ])
246+
sortWithBlock: [ :a :b | (a selector codePointCompareTo: b selector) < 1 ])
247247
do: [ :each |
248248
self _writeMethodDefinition: each classDefinition: aClassDefinition isMeta: false on: aStream ]
249249
]

rowan/src/Rowan-Core/RwModificationWriterVisitor.class.st

+15-15
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ RwModificationWriterVisitor >> _createFileNameMapForClassesOrPackages: aClassOrP
4747
put: def name ]
4848
ifFalse: [
4949
"tack on postfix to guarantee file names are unique on case insensitive file systems"
50-
sortedCol := col sort: [ :a :b | a asString _unicodeLessThan: b asString ].
50+
sortedCol := col sort: [ :a :b | (a asString codePointCompareTo: b asString) < 1 ].
5151
(1 to: sortedCol size) do: [ :index |
5252
| def filename |
5353
def := sortedCol at: index.
@@ -201,13 +201,6 @@ RwModificationWriterVisitor >> visit: aPackageSetModification [
201201
self export.
202202
]
203203

204-
{ #category : 'visiting' }
205-
RwModificationWriterVisitor >> visitClassesModification: aClassesModification [
206-
207-
aClassesModification elementsModified
208-
do: [:each | each acceptVisitor: self]
209-
]
210-
211204
{ #category : 'visiting' }
212205
RwModificationWriterVisitor >> visitClassExtensionModification: aClassExtensionModification [
213206

@@ -246,6 +239,13 @@ RwModificationWriterVisitor >> visitClassModification: aClassModification [
246239

247240
]
248241

242+
{ #category : 'visiting' }
243+
RwModificationWriterVisitor >> visitClassesModification: aClassesModification [
244+
245+
aClassesModification elementsModified
246+
do: [:each | each acceptVisitor: self]
247+
]
248+
249249
{ #category : 'visiting' }
250250
RwModificationWriterVisitor >> visitPackageModification: aPackageModification [
251251

@@ -262,13 +262,6 @@ RwModificationWriterVisitor >> visitPackagesModification: aPackagesModification
262262
aPackagesModification elementsModified do: [ :each | each acceptVisitor: self ]
263263
]
264264

265-
{ #category : 'visiting' }
266-
RwModificationWriterVisitor >> visitProjecteSetModification: aProjectSetModification [
267-
268-
aProjectSetModification elementsModified
269-
do: [ :each | each acceptVisitor: self ]
270-
]
271-
272265
{ #category : 'visiting' }
273266
RwModificationWriterVisitor >> visitProjectModification: aProjectModification [
274267

@@ -279,6 +272,13 @@ RwModificationWriterVisitor >> visitProjectModification: aProjectModification [
279272
^ self changedProject: aProjectModification
280273
]
281274

275+
{ #category : 'visiting' }
276+
RwModificationWriterVisitor >> visitProjecteSetModification: aProjectSetModification [
277+
278+
aProjectSetModification elementsModified
279+
do: [ :each | each acceptVisitor: self ]
280+
]
281+
282282
{ #category : 'visiting' }
283283
RwModificationWriterVisitor >> visitTraitModification: aTraitModification [
284284
aTraitModification isAddition

rowan/src/Rowan-SpecificationsV2/RwProjectSpecificationV2.class.st

+51-36
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,6 @@ RwProjectSpecificationV2 class >> label [
2323
^ 'project specification '
2424
]
2525

26-
{ #category : 'accessing' }
27-
RwProjectSpecificationV2 >> _repoType [
28-
"direct access to IV ... used by ="
29-
30-
^ repoType
31-
]
32-
33-
{ #category : 'private' }
34-
RwProjectSpecificationV2 >> _validate [
35-
"ensure that the data structures within the receiver contain valid information:
36-
1. platform implementation is responsible for validating platform structures"
37-
38-
#(#'componentsPath' #'packagesPath' #'projectsPath' #'specsPath' #'projectName' #'specName' #'projectSpecPath')
39-
do: [ :messageName |
40-
(self perform: messageName)
41-
ifNil: [
42-
Error
43-
signal:
44-
'The instance variable ' , messageName asString printString , ' cannot be nil' ] ].
45-
^ true
46-
]
47-
4826
{ #category : 'comparing' }
4927
RwProjectSpecificationV2 >> = anObject [
5028
| lazyEqual |
@@ -72,6 +50,28 @@ RwProjectSpecificationV2 >> = anObject [
7250
and: [ self loadedCommitId = anObject loadedCommitId ] ] ] ] ] ] ] ] ] ]
7351
]
7452

53+
{ #category : 'accessing' }
54+
RwProjectSpecificationV2 >> _repoType [
55+
"direct access to IV ... used by ="
56+
57+
^ repoType
58+
]
59+
60+
{ #category : 'private' }
61+
RwProjectSpecificationV2 >> _validate [
62+
"ensure that the data structures within the receiver contain valid information:
63+
1. platform implementation is responsible for validating platform structures"
64+
65+
#(#'componentsPath' #'packagesPath' #'projectsPath' #'specsPath' #'projectName' #'specName' #'projectSpecPath')
66+
do: [ :messageName |
67+
(self perform: messageName)
68+
ifNil: [
69+
Error
70+
signal:
71+
'The instance variable ' , messageName asString printString , ' cannot be nil' ] ].
72+
^ true
73+
]
74+
7575
{ #category : 'accessing' }
7676
RwProjectSpecificationV2 >> comment [
7777
^ comment ifNil: [ ^ '' ]
@@ -158,14 +158,25 @@ RwProjectSpecificationV2 >> packageConvention [
158158
]
159159

160160
{ #category : 'accessing' }
161-
RwProjectSpecificationV2 >> packageConvention: aString [
161+
RwProjectSpecificationV2 >> packageConvention: aStringOrNil [
162162
"
163163
RowanHybrid - [default] Class category is package name, method protocol with leading $* is case insensitive package name
164164
Monticello - Class category is package name, method protocol with leading $* begins with case insensitive package name
165165
Rowan - Class category and method protocol are not overloaded with packaging information
166166
"
167167

168-
packageConvention := aString
168+
aStringOrNil
169+
ifNil: [
170+
packageConvention := nil.
171+
^ self ].
172+
(#('RowanHybrid' 'Monticello' 'Rowan') includes: aStringOrNil)
173+
ifFalse: [
174+
self
175+
error:
176+
'project specification packageConventions field is ' , aStringOrNil printString
177+
, ' legal values are: nil, ''RowanHybrid'', ''Monticello'', or ''Rowan''' ].
178+
179+
packageConvention := aStringOrNil
169180
]
170181

171182
{ #category : 'accessing' }
@@ -220,17 +231,6 @@ RwProjectSpecificationV2 >> projectName: aString [
220231
projectName := aString
221232
]
222233

223-
{ #category : 'accessing' }
224-
RwProjectSpecificationV2 >> projectsPath [
225-
226-
^ projectsPath
227-
]
228-
229-
{ #category : 'accessing' }
230-
RwProjectSpecificationV2 >> projectsPath: aString [
231-
projectsPath := aString
232-
]
233-
234234
{ #category : 'accessing' }
235235
RwProjectSpecificationV2 >> projectSpecPath [
236236

@@ -254,6 +254,17 @@ RwProjectSpecificationV2 >> projectVersion: aStringOrVersion [
254254
"noop for now"
255255
]
256256

257+
{ #category : 'accessing' }
258+
RwProjectSpecificationV2 >> projectsPath [
259+
260+
^ projectsPath
261+
]
262+
263+
{ #category : 'accessing' }
264+
RwProjectSpecificationV2 >> projectsPath: aString [
265+
projectsPath := aString
266+
]
267+
257268
{ #category : 'accessing' }
258269
RwProjectSpecificationV2 >> repoType [
259270
^ repoType ifNil: [ repoType := #disk ]
@@ -264,7 +275,11 @@ RwProjectSpecificationV2 >> repoType: aSymbol [
264275
"#disk, #git or #none"
265276

266277
(#(#'disk' #'git' #'none') includes: aSymbol asSymbol)
267-
ifFalse: [ self error: 'Unknown repo type ' , aSymbol asSymbol printString ].
278+
ifFalse: [
279+
self
280+
error:
281+
'Unknown repo type ' , aSymbol asSymbol printString
282+
, 'expecting ''disk'', ''git'', or ''none''' ].
268283
^ repoType := aSymbol asSymbol
269284
]
270285

rowan/src/Rowan-SpecificationsV2/RwProjectSpecificationV3.class.st

+44-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@ Class {
22
#name : 'RwProjectSpecificationV3',
33
#superclass : 'RwProjectSpecificationV2',
44
#instVars : [
5-
'projectVersion'
5+
'projectVersion',
6+
'methodSortOrder'
67
],
78
#category : 'Rowan-SpecificationsV2'
89
}
910

11+
{ #category : 'ston' }
12+
RwProjectSpecificationV3 class >> fromSton: stonReader [
13+
"Create a new instance and delegate decoding to instance side.
14+
Override only when new instance should be created directly (see implementors). "
15+
16+
^ self basicNew
17+
initializeForSton;
18+
fromSton: stonReader;
19+
yourself
20+
]
21+
1022
{ #category : 'comparing' }
1123
RwProjectSpecificationV3 >> = anObject [
1224
^ super = anObject and: [ self projectVersion = anObject projectVersion ]
@@ -38,12 +50,41 @@ RwProjectSpecificationV3 >> initialize [
3850
packagesPath := 'src'.
3951
projectVersion := '1.0.0'.
4052
packageConvention := 'RowanHybrid'.
41-
packageFormat := 'tonel'
53+
packageFormat := 'tonel'.
54+
methodSortOrder := 'codePoint' "when creating a new project from scratch `codePoint` is default (see initializeForSton)"
55+
]
56+
57+
{ #category : 'initialization' }
58+
RwProjectSpecificationV3 >> initializeForSton [
59+
"default value for methodSortOrder depends upon whether or not `methodSortOrder` is explicitly specified or not"
60+
61+
self initialize.
62+
methodSortOrder := 'unicode' "when loading from STON and methodSortOrder is not explicitly set in ston file, `unicode` is default (""https://github.com/GemTalk/Rowan/issues/953"")"
4263
]
4364

4465
{ #category : 'ston' }
4566
RwProjectSpecificationV3 >> instVarNamesInOrderForSton [
46-
^ #(#'specName' #'projectName' #'projectVersion' #'projectSpecPath' #'componentsPath' #'packagesPath' #'projectsPath' #'specsPath' #'packageFormat' #'packageConvention' #'comment' #'repoType' #'loadedCommitId')
67+
^ #(#'specName' #'projectName' #'projectVersion' #'projectSpecPath' #'componentsPath' #'packagesPath' #'projectsPath' #'specsPath' #'packageFormat' #'packageConvention' #'methodSortOrder' #'comment' #'repoType' #'loadedCommitId')
68+
]
69+
70+
{ #category : 'accessing' }
71+
RwProjectSpecificationV3 >> methodSortOrder [
72+
^ methodSortOrder
73+
]
74+
75+
{ #category : 'accessing' }
76+
RwProjectSpecificationV3 >> methodSortOrder: aStringOrNil [
77+
aStringOrNil
78+
ifNil: [
79+
methodSortOrder := nil.
80+
^ self ].
81+
(#('codePoint' 'unicode') includes: aStringOrNil)
82+
ifFalse: [
83+
self
84+
error:
85+
'project specification sortOrder field is ' , aStringOrNil printString
86+
, ' legal values are: nil, ''codePoint'', or ''unicode''' ].
87+
methodSortOrder := aStringOrNil
4788
]
4889

4990
{ #category : 'accessing' }

rowan/src/Rowan-Tonel-Core/RwTonelParser.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ RwTonelParser >> checkTonelClassMethodOrder: aBoolean [
172172
ifTrue: [
173173
self
174174
dynamicInstVarAt: #'checkTonelInstanceSelectors'
175-
put: (SortedCollection sortBlock: [ :a :b | a _unicodeLessThan: b ]).
175+
put: (SortedCollection sortBlock: [ :a :b | (a codePointCompareTo: b ) < 1]).
176176
self
177177
dynamicInstVarAt: #'checkTonelClassSelectors'
178-
put: (SortedCollection sortBlock: [ :a :b | a _unicodeLessThan: b ]) ]
178+
put: (SortedCollection sortBlock: [ :a :b | (a codePointCompareTo: b) < 1 ]) ]
179179
]
180180

181181
{ #category : 'private' }

0 commit comments

Comments
 (0)