Skip to content

Commit

Permalink
Fixes #89
Browse files Browse the repository at this point in the history
  • Loading branch information
eMaringolo committed Jul 7, 2021
1 parent 7bb8eba commit f76bd37
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 25 deletions.
27 changes: 27 additions & 0 deletions docs/strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,33 @@ This strategy uses the prequisites specified in the metadata plus the ones compu
aTonelLoader useComputedPrerequisites
```


### `TonelLoaderApplicationPrereqsTableStrategy`

This strategy allows to specify mappings between a Tonel package name and ENVY applications that will be set as application prerequisites.

```smalltalk
"Enable it by evaluating"
aTonelLoader useApplicationPrerequisitesTable
at: 'Seaside-Core' put: #('Kernel' 'GreaseCoreApp')
```

### Common prerequisites strategy options

#### Prerequisites mismatch
There might be the case where the computed prerequisites or the specified prequisites are redundant after all the classes and application editions have been created, for that, there is the option to fix any mismatch at the end of the load of the application.


```smalltalk
aTonelLoader useApplicationPrerequisitesTable
at: 'Seaside-Core' put: #('Kernel' 'GreaseCoreApp' 'SUnit');
fixMismatchs
```

In the example above, `Seaside-Core` should only depend on `GreaseCoreApp` since this one already depends on `Kernel`, and should not depend on `SUnit` because there is no real dependency to it. So enabling this options will remove redundant or unnecessary dependencies.



## Version strategy

The version strategy handles both the versioning, and also the creation of editions prior to versioning.
Expand Down
8 changes: 4 additions & 4 deletions source/.configmaps
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
#conditions : [ ],
#ts : 3803108852,
#ts : 3803117976,
#comment : '',
#formatVersion : '1.1',
#applications : OrderedCollection [
Expand All @@ -22,8 +22,8 @@
},
{
#name : 'TonelLoaderModel',
#versionName : 'strategies-19',
#ts : 3803107495
#versionName : 'strategies-20',
#ts : 3803114237
},
{
#name : 'TonelReaderModel',
Expand All @@ -42,7 +42,7 @@
}
],
#name : 'ENVY/Image Tonel',
#versionName : '2021/07/07 A'
#versionName : '2021/07/07 B'
},
{
#conditions : [ ],
Expand Down
7 changes: 7 additions & 0 deletions source/TonelLoaderModel/TonelApplicationLoader.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ TonelApplicationLoader >> createAndLoadApplication [
deleteRemovedClasses;
loadApplication;
deleteRemovedSubApplications;
fixPrerequisitesMismatch;
versionApplication;
markAsLoaded

Expand Down Expand Up @@ -212,6 +213,12 @@ TonelApplicationLoader >> detectAllRootSuperclassesWithinApp [
^superclasses
]

{ #category : 'loading-internal' }
TonelApplicationLoader >> fixPrerequisitesMismatch [

self loader prerequisitesStrategy fixPrerequisitesMismatchOf: self tonelApplication
]

{ #category : 'testing' }
TonelApplicationLoader >> hasVersionName [

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Class {
#name : 'TonelLoaderApplicationPrereqStrategy',
#superclass : 'TonelLoaderStrategy',
#instVars : [
'fixesMismatchs'
],
#category : 'TonelLoaderModel'
}

Expand All @@ -18,10 +21,37 @@ TonelLoaderApplicationPrereqStrategy >> concretePrerequisitesOf: aTonelApplicati
self subclassResponsibility
]

{ #category : 'testing' }
{ #category : 'accessing' }
TonelLoaderApplicationPrereqStrategy >> fixesMismatchs [
^fixesMismatchs
]

{ #category : 'accessing' }
TonelLoaderApplicationPrereqStrategy >> fixesMismatchs: aBoolean [
fixesMismatchs := aBoolean
]

{ #category : 'configuring' }
TonelLoaderApplicationPrereqStrategy >> fixMismatchs [

^false
self fixesMismatchs: true
]

{ #category : 'api' }
TonelLoaderApplicationPrereqStrategy >> fixPrerequisitesMismatchOf: tonelApplication [

self fixesMismatchs
ifTrue: [
tonelApplication emApplication
prerequisites: (self reducedPrerequisitesOf: tonelApplication)]
]

{ #category : 'initializing',
#vaVisibility : 'private' }
TonelLoaderApplicationPrereqStrategy >> initialize [

super initialize.
fixesMismatchs := false
]

{ #category : 'api' }
Expand All @@ -30,25 +60,13 @@ TonelLoaderApplicationPrereqStrategy >> prerequisitesFor: tonelApplication curre
self subclassResponsibility
]

{ #category : 'api' }
TonelLoaderApplicationPrereqStrategy >> reducePrerequisitesOf: tonelApplication current: currentPrereqs [

| requiredPrereqs allRequired anApp |

anApp := tonelApplication emApplication.
requiredPrereqs := EmInterface current requiredDependentApplicationsIncludingReferencesFor: anApp.
allRequired := Set new.
currentPrereqs do: [:each | allRequired addAll: each withAllPrerequisites].
requiredPrereqs do: [:each |
((allRequired includes: each) not and: [self fixesMismatchs])
ifTrue: [
allRequired addAll: (
self
requiredDependentApplicationsIncludingReferencesFor: anApp
reportInApps: (Array with: each))]].

currentPrereqs do: [:r | (requiredPrereqs includes: r) ifFalse: [allRequired remove: r]].
^allRequired
{ #category : 'api',
#vaVisibility : 'private' }
TonelLoaderApplicationPrereqStrategy >> reducedPrerequisitesOf: tonelApplication [

^(EmInterface current
requiredDependentApplicationsIncludingReferencesFor: tonelApplication emApplication)
asOrderedCollection
]

{ #category : 'lookup',
Expand Down

0 comments on commit f76bd37

Please sign in to comment.