-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #469 from krono/squeak-platformattributes
[Squeak] generalize defaultPlatformAttributes
- Loading branch information
Showing
3 changed files
with
29 additions
and
26 deletions.
There are no files selected for viewing
51 changes: 27 additions & 24 deletions
51
...atform.squeak.package/MetacelloSqueakPlatform.class/instance/defaultPlatformAttributes.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
attributes | ||
defaultPlatformAttributes | ||
| attributes | | ||
| attributes systemVersion major minor both | | ||
attributes := OrderedCollection with: #squeakCommon with: #squeak. | ||
Smalltalk | ||
at: #SystemVersion | ||
ifPresent: [:cl | |versionString| | ||
versionString := cl current version asString. | ||
" Major version " | ||
#( 'Squeak3.10' (#'squeak3.10.x' ()) | ||
'Squeak4' (#'squeak4.x' ( | ||
'Squeak4.1' #'squeak4.1.x' | ||
'Squeak4.2' #'squeak4.2.x' | ||
'Squeak4.3' #'squeak4.3.x' | ||
'Squeak4.4' #'squeak4.4.x' | ||
'Squeak4.5' #'squeak4.5.x' | ||
'Squeak4.6' #'squeak4.6.x')) | ||
'Squeak5' (#'squeak5.x' ( | ||
'Squeak5.0' #'squeak5.0.x'))) | ||
pairsDo: [:major :allAttributes | | ||
(versionString beginsWith: major) ifTrue: [ | ||
attributes add: allAttributes first. | ||
allAttributes second ifNotEmpty: [:minorVersions | | ||
minorVersions pairsDo: [:minor :attribute | | ||
(versionString beginsWith: minor) ifTrue: [ | ||
attributes add: attribute. | ||
^ attributes]]]]]]. | ||
systemVersion := (Smalltalk at: #SystemVersion ifPresent: [:cl | cl current]) | ||
ifNil: [^ attributes "get out early if we don't know about this verison"]. | ||
both := systemVersion majorMinorVersion readStream. | ||
[both peek isDigit] whileFalse: [both next]. | ||
|
||
major := both upTo: $.. | ||
minor := both upToEnd. | ||
attributes | ||
add: ('squeak', major, '.x') asSymbol; | ||
add: ('squeak', major, '.', minor, '.x') asSymbol. | ||
(systemVersion version endsWith: 'alpha') | ||
ifTrue: ["For alphas it is sensible to pretend to be the previous version, | ||
so that things can be tested and then moved forward." | ||
minor ~= '0' | ||
ifTrue: | ||
["easy" attributes add: ('squeak', major, '.', (minor asInteger - 1) asString, '.x') asSymbol] | ||
ifFalse: | ||
[" well we would have to guess the previous release for 'big jumps' here, | ||
so for now use a list of known jumps or roll down to 10 " | ||
| priorVersion priorMajor | | ||
priorMajor := major asInteger - 1. | ||
priorVersion := #(('1' '1.31') ('2' '2.8') ('3' '3.10') ('4' '4.5' "on purpose NOT 4.6") ('5' '5.1')) | ||
at: priorMajor ifAbsent: [{priorMajor asString . priorMajor asString, '.10'}]. | ||
attributes | ||
add: ('squeak', priorVersion first, '.x') asSymbol; | ||
add: ('squeak', priorVersion second, '.x') asSymbol]]. | ||
^ attributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.