Skip to content

Commit 6f8404a

Browse files
committed
Issue #953: added basic Rowan V4 infrastructure code; including support for sorting using unicode codePoint or Unicode sort order; preparing to create RowanSample9V4 repos ... initial tests look good
1 parent 72fe253 commit 6f8404a

18 files changed

+347
-32
lines changed

rowan/components/common/Core.ston

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ RwSimpleNestedProjectLoadComponentV2 {
77
'common/stubs/Core',
88
'common/tests/Core',
99
'common/tonel/Core',
10-
'common/v2/Core'
10+
'common/v2/Core',
11+
'common/v3/Core'
1112
],
1213
#packageNames : [
1314
'Rowan-Core',

rowan/components/common/tests/v3/Tests.ston

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ RwSimpleNestedProjectLoadComponentV2 {
44
#projectNames : [ ],
55
#componentNames : [ ],
66
#packageNames : [
7-
'Rowan-TestsV3'
7+
'Rowan-TestsV3',
8+
'Rowan-TestsV4'
89
],
9-
#comment : 'Organize all v2 tests classes under one component'
10+
#comment : 'Organize all v4 tests classes under one component'
1011
}

rowan/components/common/v3/Core.ston

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
RwSimpleNestedProjectLoadComponentV2 {
2+
#name : 'common/v3/Core',
3+
#condition : 'v3',
4+
#projectNames : [ ],
5+
#componentNames : [ ],
6+
#packageNames : [
7+
'Rowan-CoreV4'
8+
],
9+
#comment : 'Organize all v3/v4 core classes under one component'
10+
}

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

+3-14
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ RwDefinedProject class >> newV2Named: aName [
3232
]
3333

3434
{ #category : 'instance creation' }
35-
RwDefinedProject class >> newV3Named: aName [
36-
"Create a new project that uses project spec and component classes that are compatible with Rowan v3"
35+
RwDefinedProject class >> newV4Named: aName [
36+
"Create a new project that uses project spec and component classes that are compatible with Rowan v4"
3737

3838
^ self new
3939
initializeForName: aName;
40-
_concreteProjectV3;
40+
_concreteProjectV4;
4141
yourself
4242
]
4343

@@ -63,17 +63,6 @@ RwDefinedProject >> _concreteProjectV2 [
6363
yourself ]
6464
]
6565

66-
{ #category : 'private' }
67-
RwDefinedProject >> _concreteProjectV3 [
68-
"Create a new project that uses project spec and component classes that are compatible with Rowan v2"
69-
70-
^ concreteProject
71-
ifNil: [
72-
concreteProject := RwResolvedProjectV2 newV3
73-
projectName: self name;
74-
yourself ]
75-
]
76-
7766
{ #category : 'private' }
7867
RwDefinedProject >> _concreteProjectV4 [
7968
"Create a new project that uses project spec and component classes that are compatible with Rowan v4"

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

+31-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Class {
22
#name : 'RwModificationTonelWriterVisitorV2',
33
#superclass : 'RwModificationCypressFamilyWriterVisitorV2',
4+
#instVars : [
5+
'methodSortBlock'
6+
],
47
#category : 'Rowan-Core'
58
}
69

@@ -234,18 +237,26 @@ RwModificationTonelWriterVisitorV2 >> _writeClassExtension: aClassExtension on:
234237
235238
{ #category : 'class writing' }
236239
RwModificationTonelWriterVisitorV2 >> _writeClassSideMethodDefinitions: aClassDefinition on: aStream [
237-
((aClassDefinition classMethodDefinitions values )
238-
sortWithBlock: [ :a :b | a selector _unicodeLessThan: b selector ])
240+
(aClassDefinition classMethodDefinitions values
241+
sortWithBlock: self methodSortBlock)
239242
do: [ :each |
240-
self _writeMethodDefinition: each classDefinition: aClassDefinition isMeta: true on: aStream ]
243+
self
244+
_writeMethodDefinition: each
245+
classDefinition: aClassDefinition
246+
isMeta: true
247+
on: aStream ]
241248
]
242249
243250
{ #category : 'class writing' }
244251
RwModificationTonelWriterVisitorV2 >> _writeInstanceSideMethodDefinitions: aClassDefinition on: aStream [
245-
((aClassDefinition instanceMethodDefinitions values )
246-
sortWithBlock: [ :a :b | a selector _unicodeLessThan: b selector ])
252+
(aClassDefinition instanceMethodDefinitions values
253+
sortWithBlock: self methodSortBlock)
247254
do: [ :each |
248-
self _writeMethodDefinition: each classDefinition: aClassDefinition isMeta: false on: aStream ]
255+
self
256+
_writeMethodDefinition: each
257+
classDefinition: aClassDefinition
258+
isMeta: false
259+
on: aStream ]
249260
]
250261
251262
{ #category : 'class writing' }
@@ -329,6 +340,20 @@ RwModificationTonelWriterVisitorV2 >> deletedClassExtension: aClassExtensionModi
329340
self _classExtensionSourceFile ensureDelete
330341
]
331342
343+
{ #category : 'accessing' }
344+
RwModificationTonelWriterVisitorV2 >> methodSortBlock [
345+
^ methodSortBlock
346+
ifNil: [
347+
methodSortBlock := currentProjectDefinition methodSortOrder = 'codePoint'
348+
ifTrue: [ [ :a :b | (a selector codePointCompareTo: b selector) < 1 ] ]
349+
ifFalse: [ [ :a :b | a selector _unicodeLessThan: b selector ] ] ]
350+
]
351+
352+
{ #category : 'accessing' }
353+
RwModificationTonelWriterVisitorV2 >> methodSortBlock: object [
354+
methodSortBlock := object
355+
]
356+
332357
{ #category : 'class writing' }
333358
RwModificationTonelWriterVisitorV2 >> processClass: aClassModification [
334359

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

+1-1
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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Extension { #name : 'Rowan' }
2+
3+
{ #category : '*rowan-corev4' }
4+
Rowan class >> newV4ProjectNamed: projectName [
5+
"Create a new project that uses project spec and component classes that are compatible with Rowan v4"
6+
7+
^ self platform newV4ProjectNamed: projectName
8+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Extension { #name : 'RwPlatform' }
2+
3+
{ #category : '*rowan-corev4' }
4+
RwPlatform >> newV4ProjectNamed: projectName [
5+
"Create a new project that uses project spec and component classes that are compatible with Rowan v2"
6+
7+
^ RwDefinedProject newV4Named: projectName
8+
]

rowan/src/Rowan-CoreV4/package.st

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Package { #name : 'Rowan-CoreV4' }

rowan/src/Rowan-Definitions-Common/RwAbstractResolvedObjectV2.class.st

+1-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ RwAbstractResolvedObjectV2 class >> newV2 [
2323
^ self basicNew initializeV2
2424
]
2525

26-
{ #category : 'instance creation' }
27-
RwAbstractResolvedObjectV2 class >> newV3 [
28-
"Create a new project that uses project spec and component classes that default for Rowan v3; read and written by Rowan v4"
29-
30-
^ self basicNew initializeV3
31-
]
32-
3326
{ #category : 'instance creation' }
3427
RwAbstractResolvedObjectV2 class >> newV4 [
3528
"Create a new project that uses project spec and component classes that are default for Rowan v4"
@@ -196,6 +189,7 @@ RwAbstractResolvedObjectV2 >> initializeV3 [
196189
RwAbstractResolvedObjectV2 >> initializeV4 [
197190
"Create a new project that uses Rowan v3 project spec and component classes default for Rowan v4; read and written by Rowan v3"
198191

192+
self initialize.
199193
projectSpecification := RwProjectSpecificationV4 new.
200194
loadSpecification := RwLoadSpecificationV2 new.
201195
]

rowan/src/Rowan-DefinitionsV2/RwAbstractResolvedProjectV2.class.st

+6
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ RwAbstractResolvedProjectV2 >> customConditionalAttributes: anArray [
193193
^ self loadSpecification customConditionalAttributes: anArray
194194
]
195195

196+
{ #category : 'accessing' }
197+
RwAbstractResolvedProjectV2 >> methodSortOrder [
198+
199+
^ projectSpecification methodSortOrder
200+
]
201+
196202
{ #category : 'accessing' }
197203
RwAbstractResolvedProjectV2 >> packageConvention [
198204
"

rowan/src/Rowan-DefinitionsV2/RwResolvedProjectSpecificationV2.class.st

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ RwResolvedProjectSpecificationV2 >> export [
1919
self exportProjectSpecification
2020
]
2121

22+
{ #category : 'accessing' }
23+
RwResolvedProjectSpecificationV2 >> methodSortOrder [
24+
25+
^ projectSpecification methodSortOrder
26+
]
27+
2228
{ #category : 'accessing' }
2329
RwResolvedProjectSpecificationV2 >> packageFormat: aString [
2430
self _projectSpecification packageFormat: aString
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
Class {
2+
#name : 'RwTestProjectLibraryGeneratorTestV4',
3+
#superclass : 'RwAbstractV2Test',
4+
#category : 'Rowan-Tests'
5+
}
6+
7+
{ #category : 'tests' }
8+
RwTestProjectLibraryGeneratorTestV4 >> testLibrarySample9V4Generator [
9+
"Test the specs that are shared between RowanSample9V2 and RowanSample9V3 and RowanSample9V4"
10+
11+
"run RwTestProjectLibraryGenerator to ensure that spes can be regenerated without:
12+
1. hitting errors
13+
2. changing any of the disk content"
14+
15+
"skip spec_004, because it makes two changes in a row, so always commits"
16+
17+
| commitComment |
18+
((System gemEnvironmentVariable: 'USER') = 'dhenrich')
19+
ifFalse: [
20+
"user needs to have public ssh key registered with github project to run the test, and right now that's me"
21+
^ self ].
22+
RwRowanSample9V4Test _clearLoadSpecSessionCache.
23+
(RwAbstractV2Test _testRowanProjectsSandbox / 'RowanSample9V4') ensureDeleteAll.
24+
25+
commitComment := 'running testLibraryGenerator tests ... no changes expected, thus no commits expected'.
26+
RwTestProjectLibraryGeneratorTesterV3 new
27+
testCase: self;
28+
projectName: 'RowanSample9V4';
29+
projectUrl: '[email protected]:dalehenrich/RowanSample9V4.git';
30+
preserveRowanSHA: true;
31+
primeIndexCardMap;
32+
preserveChangesOnGithub: false;
33+
genSpec_0000: commitComment;
34+
genSpec_0001: commitComment;
35+
genSpec_0002: commitComment;
36+
genSpec_0003: commitComment;
37+
" genSpec_0004: commitComment;"
38+
genSpec_0005: commitComment;
39+
genSpec_0006: commitComment;
40+
genSpec_0007: commitComment;
41+
genSpec_0008: commitComment;
42+
genSpec_0009: commitComment;
43+
genSpec_0010: commitComment;
44+
genSpec_0011: commitComment;
45+
genSpec_0012: commitComment;
46+
genSpec_0013: commitComment;
47+
genSpec_0014: commitComment;
48+
genSpec_0015: commitComment;
49+
genSpec_0016: commitComment;
50+
genSpec_0017: commitComment;
51+
genSpec_0018: commitComment;
52+
genSpec_0019: commitComment;
53+
genSpec_0020: commitComment;
54+
genSpec_0021: commitComment;
55+
genSpec_0022: commitComment;
56+
genSpec_0023: commitComment;
57+
genSpec_0024: commitComment;
58+
genSpec_0025: commitComment;
59+
genSpec_0026: commitComment;
60+
genSpec_0027: commitComment;
61+
genSpec_0028: commitComment;
62+
genSpec_0029: commitComment;
63+
genSpec_0030: commitComment;
64+
genSpec_0031: commitComment;
65+
genSpec_0032: commitComment;
66+
genSpec_0033: commitComment;
67+
genSpec_0034: commitComment;
68+
genSpec_0035: commitComment;
69+
genSpec_0036: commitComment;
70+
genSpec_0037: commitComment;
71+
genSpec_0038: commitComment;
72+
genSpec_0039: commitComment;
73+
genSpec_0040: commitComment;
74+
genSpec_0041: commitComment;
75+
genSpec_0042: commitComment;
76+
genSpec_0043: commitComment;
77+
genSpec_0044: commitComment;
78+
genSpec_0045: commitComment;
79+
genSpec_0046: commitComment;
80+
genSpec_0047: commitComment;
81+
genSpec_0048: commitComment;
82+
genSpec_0049: commitComment;
83+
genSpec_0050: commitComment;
84+
genSpec_0051: commitComment;
85+
genSpec_0052: commitComment;
86+
genSpec_0053: commitComment;
87+
genSpec_0054: commitComment;
88+
genSpec_0055: commitComment;
89+
genSpec_0056: commitComment;
90+
genSpec_0057: commitComment;
91+
genSpec_0058: commitComment;
92+
genSpec_0059: commitComment;
93+
genSpec_0060: commitComment;
94+
genSpec_0061: commitComment;
95+
genSpec_0062: commitComment;
96+
genSpec_0063: commitComment;
97+
genSpec_0065: commitComment;
98+
genSpec_0066: commitComment;
99+
genSpec_0067: commitComment;
100+
genSpec_0068: commitComment;
101+
genSpec_0069: commitComment;
102+
genSpec_0070: commitComment;
103+
genSpec_0071: commitComment;
104+
genSpec_0072: commitComment;
105+
genSpec_0073: commitComment;
106+
genSpec_0074: commitComment;
107+
genSpec_0075: commitComment;
108+
genSpec_0076: commitComment;
109+
genSpec_0077: commitComment;
110+
genSpec_0078: commitComment;
111+
genSpec_0079: commitComment;
112+
genSpec_0080: commitComment;
113+
genSpec_0081: commitComment;
114+
genSpec_0083: commitComment;
115+
genSpec_0084: commitComment;
116+
genSpec_0085: commitComment;
117+
genSpec_0089: commitComment;
118+
yourself
119+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Class {
2+
#name : 'RwRowanSample9V4Test',
3+
#superclass : 'RwRowanSample9V3Test',
4+
#category : 'Rowan-TestsV4'
5+
}
6+
7+
{ #category : 'private' }
8+
RwRowanSample9V4Test class >> _gitPullSessionCacheKey [
9+
^ #'RowanSample9V4GitBranchDict'
10+
]
11+
12+
{ #category : 'private' }
13+
RwRowanSample9V4Test class >> _loadSpecSessionCacheKey [
14+
^ #'RowanSample9V4LoadSpecsDict'
15+
]
16+
17+
{ #category : 'private' }
18+
RwRowanSample9V4Test class >> _rowanSample9ProjectName [
19+
^ 'RowanSample9V4'
20+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Class {
2+
#name : 'RwTestProjectLibraryGeneratorTesterV4',
3+
#superclass : 'RwTestProjectLibraryGeneratorTesterV3',
4+
#category : 'Rowan-TestsV4'
5+
}
6+
7+
{ #category : 'private' }
8+
RwTestProjectLibraryGeneratorTesterV4 >> _createNewProject: aString [
9+
^ Rowan newV4ProjectNamed: aString
10+
]
11+
12+
{ #category : 'private' }
13+
RwTestProjectLibraryGeneratorTesterV4 >> primaryProjectName [
14+
^ 'RowanSample9V4'
15+
]

0 commit comments

Comments
 (0)