Skip to content

Commit

Permalink
Fixes #113, Fixes #112
Browse files Browse the repository at this point in the history
  • Loading branch information
eMaringolo committed May 10, 2022
1 parent 2ceb386 commit 63b2972
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 88 deletions.
20 changes: 10 additions & 10 deletions source/.configmaps
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
#conditions : [ ],
#ts : 3826518433,
#ts : 3829653476,
#comment : '',
#formatVersion : '1.1',
#applications : OrderedCollection [
Expand All @@ -17,18 +17,18 @@
},
{
#name : 'TonelLoaderInteractiveApp',
#versionName : 'V 11.0.0 [504]',
#ts : 3825333811
#versionName : '1.6.0',
#ts : 3829651015
},
{
#name : 'TonelLoaderModel',
#versionName : '1.5.3',
#ts : 3827303214
#versionName : '1.6.0',
#ts : 3829648988
},
{
#name : 'TonelReaderModel',
#versionName : '1.5.1',
#ts : 3826106857
#versionName : '1.6.0',
#ts : 3829651795
},
{
#name : 'TonelTools',
Expand All @@ -42,11 +42,11 @@
}
],
#name : 'ENVY/Image Tonel',
#versionName : '1.5.3'
#versionName : ''
},
{
#conditions : [ ],
#ts : 3826518422,
#ts : 3827317298,
#comment : '',
#formatVersion : '1.1',
#applications : OrderedCollection [
Expand All @@ -72,6 +72,6 @@
}
],
#name : 'Test ENVY/Image Tonel',
#versionName : '1.5.3'
#versionName : ''
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ TonelLoaderInteractivePrereqStrategy >> prerequisitesFor: tonelApplication curre
Answers:
<EmShadowApplication>
"

^EtPrerequisiteCollectingPrompter
prompt: ('Please select the prequisites for %1 (chains will be resolved after selection)'

^EtPrerequisiteCollectingPrompter
prompt: (
'Please select the prequisites for %1 (chains will be resolved after selection)'
bindWith: tonelApplication name)
chooseFrom: (self loader systemLoadedApplications
chooseFrom: (
self loader systemLoadedApplications
reject: [:anApp | tonelApplication allDependentApplications includes: anApp])
current: aCollection
alwaysRequired: (Set with: Kernel) "$NLS$ Please select the prequisites for %1 (chains will be resolved after selection)"
alwaysRequired: (Set with: Kernel) "$NLS$ Please select the prequisites for %1 (chains will be resolved after selection)"
]
7 changes: 5 additions & 2 deletions source/TonelLoaderModel/TonelLoader.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,19 @@ TonelLoader class >> settings [

{ #category : 'accessing' }
TonelLoader >> addLoadedApplication: aTonelApplication [
"Adds aTonelApplication to the list of loaded applications of receiver.
It also replaces the prerequisites of receiver applications to point to the
loaded Application instead of aTonelApplication."

self loadedApplications add: aTonelApplication.
self updatePrerequisitesFrom: aTonelApplication
]

{ #category : 'resolving' }
TonelLoader >> addPrerequisite: emApplication to: tonelApplication [
TonelLoader >> addMissingPrerequisite: emApplication to: tonelApplication [
"Adds emApplication as a prerequisite of tonelApplication."

self prerequisitesStrategy addPrerequisite: emApplication to: tonelApplication
self prerequisitesStrategy addMissingPrerequisite: emApplication to: tonelApplication
]

{ #category : 'strategies-convenience' }
Expand Down
45 changes: 26 additions & 19 deletions source/TonelLoaderModel/TonelLoaderApplication.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ TonelLoaderApplication >> accountForPoolDictionaryClasses [

]

{ #category : 'querying' }
TonelLoaderApplication >> addAllDependentsInto: aCollection [
"Adds all the dependent applications of receiver into aCollection,
ignore them if they're already included in that collection.
Answers:
<Collection>
"

self dependentApplications do: [:each |
(aCollection includes: each)
ifFalse: [
aCollection add: each.
each addAllDependentsInto: aCollection]]
]

{ #category : 'querying' }
TonelLoaderApplication >> allDefinedClassNames [

Expand All @@ -31,25 +47,16 @@ TonelLoaderApplication >> allDefinedClassNames [

{ #category : 'querying' }
TonelLoaderApplication >> allDependentApplications [
"Return the complete set of applications which are dependent
on the receiver starting with its direct dependents. Sort them
alphabetically; then add all of their dependents (sorted
alphabetically and so on). No dependent may appear before
one of its prerequisites."

| result new |
"Return the complete set of applications which are dependent
on the receiver starting with its direct dependents. Sort them
alphabetically; then add all of their dependents (sorted
alphabetically and so on). No dependent may appear before
one of its prerequisites."

result := OrderedCollection new.
new := self dependentApplications.
[ new isEmpty ] whileFalse: [ | temp |
temp := Set new.
new do: [ :app |
result remove: app ifAbsent: [ ].
app dependentApplications do: [ :dep |
temp add: dep ] ].
result addAll: new. "make them be at the end"
new := temp asSortedCollection: Class sortBlock ].
^ result
| result |
result := Set new.
self addAllDependentsInto: result.
^(result asSortedCollection: Class sortBlock) asOrderedCollection
]

{ #category : 'accessing' }
Expand Down Expand Up @@ -248,7 +255,7 @@ TonelLoaderApplication >> hasSamePrerequisitesAs: anApplication [
NOTE: Comparison is based only on the names of prerequisites."

^(anApplication prerequisites collect: [:each | each name asSymbol]) asSortedCollection =
(self computePrerequisites collect: [:each | each name asSymbol]) asSortedCollection
(self prerequisites collect: [:each | each name asSymbol]) asSortedCollection
]

{ #category : 'testing' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,47 @@ Class {
#name : 'TonelLoaderApplicationPrereqStrategy',
#superclass : 'TonelLoaderStrategy',
#instVars : [
'fixesMismatchs'
'fixesMismatchs',
'addsMissingPrerequisites'
],
#category : 'TonelLoaderModel'
}

{ #category : 'api' }
TonelLoaderApplicationPrereqStrategy >> addPrerequisite: emApplication to: tonelApplication [
TonelLoaderApplicationPrereqStrategy >> addMissingPrerequisite: emApplication to: tonelApplication [
"Add emApplication as a prerequisite to tonelApplication."

tonelApplication addPrerequisite: emApplication
self addsMissingPrerequisites ifTrue: [tonelApplication addPrerequisite: emApplication]
]

{ #category : 'configuring' }
TonelLoaderApplicationPrereqStrategy >> addsMissingPrerequisites [
"Answers whether missing prereqs will be added to a loaded application
if one of the defined classes is a subclass of a class in an application
not defined as prerequisite, or if it extends a class in an aplication not
defined as prerequisite."

^addsMissingPrerequisites ifNil: [addsMissingPrerequisites := self computeAddsMissingPrerequisites]
]

{ #category : 'configuring' }
TonelLoaderApplicationPrereqStrategy >> addsMissingPrerequisites: aBoolean [
"Sets whether missing prereqs will be added to a loaded application
if one of the defined classes is a subclass of a class in an application
not defined as prerequisite, or if it extends a class in an aplication not
defined as prerequisite."

addsMissingPrerequisites := aBoolean
]

{ #category : 'initializing',
#vaVisibility : 'private' }
TonelLoaderApplicationPrereqStrategy >> computeAddsMissingPrerequisites [
"By default we add all missing prerequisites."

^true


]

{ #category : 'api' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Class {
}

{ #category : 'api' }
TonelLoaderApplicationPrereqsTableStrategy >> addPrerequisite: emApplication to: tonelApplication [
TonelLoaderApplicationPrereqsTableStrategy >> addMissingPrerequisite: emApplication to: tonelApplication [
"Add emApplication as a prerequisite to tonelApplication.
NOTE: Since we base prerequisites on a table, we only won't add anything that is not in the table."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ Class {
#category : 'TonelLoaderModel'
}

{ #category : 'initializing',
#vaVisibility : 'private' }
TonelLoaderComputedPrerequisitesStrategy >> computeAddsMissingPrerequisites [
"Determine whether we add missing prerequisites based on whether there was
prerequisite metadata in the package definition of the loader applications.
NOTE: This is so because if there is package prerequisite metadata it
likely means the code was exported from VAST, and already defines what are
the prerequisites. If it doesn't have any metadata, it's likely that the packages
come from another dialect, and we need to to compute the missing prerequisites."

^self loader applications noneSatisfy: [:each | each packageDefinition hasPrerequisitesMetadata]


]

{ #category : 'lookup' }
TonelLoaderComputedPrerequisitesStrategy >> concretePrerequisitesOf: aTonelApplication [
"Answer the immediate prerequisite application of aTonelApplication."
Expand Down
4 changes: 2 additions & 2 deletions source/TonelLoaderModel/TonelLoaderSubApplication.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ TonelLoaderSubApplication >> checkClassExtensionsExcepting: classNames [
ifNil: [
self error: (TonelMsg03 bindWith: self name with: extClass name) ]
ifNotNil: [ :rootClass |
self loader addPrerequisite: rootClass controller rootApplication to: self] ] ].
self loader addMissingPrerequisite: rootClass controller rootApplication to: self] ] ].
]

{ #category : 'loading' }
Expand All @@ -175,7 +175,7 @@ TonelLoaderSubApplication >> checkSuperclassesExcepting: classDefinitions [
emRootApp |
emRootApp := rootClass controller rootApplication.
emRootApp ~= (Smalltalk classAt: self rootTonelApplication name asSymbol)
ifTrue: [self loader addPrerequisite: emRootApp to: self]]].
ifTrue: [self loader addMissingPrerequisite: emRootApp to: self]]].

self subApplications
do: [:tonelSubApp | tonelSubApp checkSuperclassesExcepting: classDefinitions]
Expand Down
7 changes: 7 additions & 0 deletions source/TonelReaderModel/TonelReaderPackageDefinition.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ TonelReaderPackageDefinition >> extensions [
^extensions ifNil: [extensions := Dictionary new]
]

{ #category : 'testing' }
TonelReaderPackageDefinition >> hasPrerequisitesMetadata [
"Answers whether receiver has metadata describing the app prerequisites."

^self metadata includesKey: #vaPrerequisites
]

{ #category : 'initializing',
#vaVisibility : 'private' }
TonelReaderPackageDefinition >> initializeFromMetadata: aDictionary [
Expand Down
23 changes: 0 additions & 23 deletions source/TonelSystemExtensions/Collection.extension.st

This file was deleted.

14 changes: 0 additions & 14 deletions source/TonelSystemExtensions/SequenceableCollection.extension.st

This file was deleted.

5 changes: 0 additions & 5 deletions source/TonelSystemExtensions/TonelSystemExtensions.class.st

This file was deleted.

4 changes: 0 additions & 4 deletions source/TonelSystemExtensions/package.st

This file was deleted.

0 comments on commit 63b2972

Please sign in to comment.