Skip to content

Commit

Permalink
Add Object>>#forPharo12:forPharo11AndPharo10: [feenkcom/gtoolkit#3736]
Browse files Browse the repository at this point in the history
  • Loading branch information
chisandrei committed May 15, 2024
1 parent 6cce00a commit 2c05155
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
16 changes: 16 additions & 0 deletions src/GToolkit-PharoMigrations/Object.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,19 @@ Object >> forPharo12: pharo12Block forPharo11: pharo11Block forPharo10: pharo10B

^ olderBlock value
]

{ #category : #'*GToolkit-PharoMigrations' }
Object >> forPharo12: pharo12Block forPharo11AndPharo10: pharo11AndPharo10Block [
"Evaluate one of the blocks based on the pharo's major version"
| unsupportedVersionBlock |

unsupportedVersionBlock := [
self error: 'Unsupported pharo version: ',SystemVersion current major asString ].

^ self
forPharo12: pharo12Block
forPharo11: pharo11AndPharo10Block
forPharo10: pharo11AndPharo10Block
newer: unsupportedVersionBlock
older: unsupportedVersionBlock
]
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ GtRlDependenciesModelBuilder >> buildProjectFromMetacelloSpec: aMetacelloProject
forPharo12: [
(aMetacelloProjectSpec className asClassInEnvironment:
self class environment) project versions.]
forPharo11: [ aMetacelloProjectSpec project versions ]
forPharo10: [aMetacelloProjectSpec project versions ].
forPharo11AndPharo10: [
aMetacelloProjectSpec project versions ].

self assert: [ targetVersions size = 1 ].
self assert: [ aMetacelloProjectSpec repositorySpecs size = 1 ].
Expand All @@ -76,9 +76,8 @@ GtRlDependenciesModelBuilder >> buildProjectFromMetacelloSpec: aMetacelloProject
newProject := self instantiateProjectFromMetacelloSpec: aMetacelloProjectSpec.
self updateDependenciesFor: newProject fromMCVersion: (self
forPharo12: [ targetVersions first ]
forPharo11: [ aMetacelloProjectSpec version ]
forPharo10: [ aMetacelloProjectSpec version ]).

forPharo11AndPharo10: [ aMetacelloProjectSpec version ] ).

"Only add the project to the "
self projectsByBaselineClass
at: aMetacelloProjectSpec projectClass
Expand Down Expand Up @@ -124,8 +123,7 @@ GtRlDependenciesModelBuilder >> instantiateProjectFromMetacelloSpec: aBaselinePr
| repositoriesSpec project |
repositoriesSpec := self
forPharo12: [ aBaselineProjectSpec repositories ]
forPharo11: [ aBaselineProjectSpec version spec repositories ]
forPharo10: [ aBaselineProjectSpec version spec repositories ].
forPharo11AndPharo10: [ aBaselineProjectSpec version spec repositories ].

self assert: [ repositoriesSpec map size = 1 ].

Expand All @@ -136,8 +134,8 @@ GtRlDependenciesModelBuilder >> instantiateProjectFromMetacelloSpec: aBaselinePr

self
forPharo12: [ ]
forPharo11: [ project baselineVersion: aBaselineProjectSpec version ]
forPharo10: [ project baselineVersion: aBaselineProjectSpec version ].
forPharo11AndPharo10: [
project baselineVersion: aBaselineProjectSpec version ].

^ project
]
Expand Down Expand Up @@ -208,9 +206,9 @@ GtRlDependenciesModelBuilder >> updateProjectDependenciesFor: currentProject fro
| targetVersion shouldKeep |
targetVersion := self
forPharo12: [(aMetacelloProjectSpec className
asClassInEnvironment: self class environment) project versions first]
forPharo11: [ aMetacelloProjectSpec version ]
forPharo10: [ aMetacelloProjectSpec version ].
asClassInEnvironment: self class environment)
project versions first]
forPharo11AndPharo10: [ aMetacelloProjectSpec version ].
shouldKeep := targetVersion notNil
and: [ targetVersion name = 'baseline' ].

Expand Down

0 comments on commit 2c05155

Please sign in to comment.