--- a/Smalltalk.st Tue Feb 19 16:25:15 2019 +0100
+++ b/Smalltalk.st Tue Feb 19 16:30:01 2019 +0100
@@ -2524,10 +2524,10 @@
loadOK errorInInitialize|
packageDirOrStringOrNil notNil ifTrue:[
- packageDirOrNil := packageDirOrStringOrNil asFilename.
+ packageDirOrNil := packageDirOrStringOrNil asFilename.
].
silent := VerboseLoading not
- and:[SilentLoading or:[StandAlone or:[InfoPrinting not]]].
+ and:[SilentLoading or:[StandAlone or:[InfoPrinting not]]].
"For now: have to read the project definition first!!
The class library may contain subclasses of classes in prerequisite packages -
@@ -2537,106 +2537,110 @@
"maybe, it is already in the image"
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
projectDefinitionClass notNil ifTrue:[
- projectDefinitionClass checkForLoad.
+ projectDefinitionClass checkForLoad.
].
"Is there a shared library (.dll or .so) ?"
binaryClassLibraryFilename := ObjectFileLoader
- binaryClassFilenameForPackage:aPackageString
- inDirectory:packageDirOrNil.
+ binaryClassFilenameForPackage:aPackageString
+ inDirectory:packageDirOrNil.
(binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[
- |loadErrorOccurred|
-
- loadErrorOccurred := false.
- ObjectFileLoader objectFileLoadErrorNotification handle:[:ex |
- loadErrorOccurred := true.
- ex proceedWith:true.
- ] do:[
- loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil.
- "/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename.
- ].
- (loadOK and:[loadErrorOccurred not]) ifTrue:[
- "now, all compiled classes have been loaded.
- keep classes in the package which are autoloaded as autoloaded."
- ^ true
- ].
-
- loadErrorOccurred ifTrue:[
- self breakPoint:#cg.
- projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
- projectDefinitionClass notNil ifTrue:[
- projectDefinitionClass
- checkForLoad;
- loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
- ].
- ].
+ |loadErrorOccurred|
+
+ loadErrorOccurred := loadOK := false.
+ PackageNotCompatibleError handle:[:ex |
+ loadErrorOccurred := true.
+ ] do:[
+ ObjectFileLoader objectFileLoadErrorNotification handle:[:ex |
+ loadErrorOccurred := true.
+ ex proceedWith:true.
+ ] do:[
+ loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil.
+ "/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename.
+ ].
+ ].
+ (loadOK and:[loadErrorOccurred not]) ifTrue:[
+ "now, all compiled classes have been loaded.
+ keep classes in the package which are autoloaded as autoloaded."
+ ^ true
+ ].
+
+ loadErrorOccurred ifTrue:[
+ self breakPoint:#cg.
+ projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
+ projectDefinitionClass notNil ifTrue:[
+ projectDefinitionClass
+ checkForLoad;
+ loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
+ ].
+ ].
].
packageDirOrNil isNil ifTrue:[
- ^ PackageNotFoundError raiseRequestWith:aPackageString.
+ ^ PackageNotFoundError raiseRequestWith:aPackageString.
].
"fallback - go through the project definition"
projectDefinitionClass isNil ifTrue:[
- projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString.
- "/ try to load the project definition class
- projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'.
- projectDefinitionFilename exists ifFalse:[
- projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'.
- ].
- projectDefinitionFilename exists ifTrue:[
- Class withoutUpdatingChangesDo:[
- Smalltalk silentlyLoadingDo:[
- Error handle:[:ex |
- "/ catch error during initialization;
- ex suspendedContext withAllSendersDo:[:sender |
- (sender selector == #initialize
- and:[sender receiver isBehavior
- and:[sender receiver name = projectDefinitionClassName]]
- ) ifTrue:[
- errorInInitialize := true
- ].
- ].
- errorInInitialize ifFalse:[ ex reject ].
- ] do:[
- projectDefinitionFilename fileIn.
- ].
- ].
- ].
- errorInInitialize ifTrue:[
- Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'.
- ].
- projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
- ].
+ projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString.
+ "/ try to load the project definition class
+ projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'.
+ projectDefinitionFilename exists ifFalse:[
+ projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'.
+ ].
+ projectDefinitionFilename exists ifTrue:[
+ Class withoutUpdatingChangesDo:[
+ Smalltalk silentlyLoadingDo:[
+ Error handle:[:ex |
+ "/ catch error during initialization;
+ ex suspendedContext withAllSendersDo:[:sender |
+ (sender selector == #initialize
+ and:[sender receiver isBehavior
+ and:[sender receiver name = projectDefinitionClassName]]
+ ) ifTrue:[
+ errorInInitialize := true
+ ].
+ ].
+ errorInInitialize ifFalse:[ ex reject ].
+ ] do:[
+ projectDefinitionFilename fileIn.
+ ].
+ ].
+ ].
+ errorInInitialize ifTrue:[
+ Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'.
+ ].
+ projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
+ ].
].
projectDefinitionClass notNil ifTrue:[
- projectDefinitionClass
- autoload;
- checkForLoad;
- loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
-
- somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
- errorInInitialize ifTrue:[
- Transcript showCR:('Smalltalk [info]: retrying #initialize').
- projectDefinitionClass initialize.
- ].
- (silent not and:[somethingHasBeenLoaded]) ifTrue:[
- Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition').
- ].
- ^ true.
+ projectDefinitionClass
+ autoload;
+ checkForLoad;
+ loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
+
+ somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
+ errorInInitialize ifTrue:[
+ Transcript showCR:('Smalltalk [info]: retrying #initialize').
+ projectDefinitionClass initialize.
+ ].
+ (silent not and:[somethingHasBeenLoaded]) ifTrue:[
+ Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition').
+ ].
+ ^ true.
].
"/ source files-file loading no longer supported
"/ however, allow for autoload-stub loaded
doLoadAsAutoloaded ifTrue:[
- self
- recursiveInstallAutoloadedClassesFrom:packageDirOrNil
- rememberIn:Set new
- maxLevels:2
- noAutoload:false
- packageTop:packageDirOrNil
- showSplashInLevels:0.
- ^ true
+ self
+ recursiveInstallAutoloadedClassesFrom:packageDirOrNil
+ rememberIn:Set new
+ maxLevels:2
+ noAutoload:false
+ packageTop:packageDirOrNil
+ showSplashInLevels:0.
+ ^ true
].
^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'.
@@ -2648,6 +2652,7 @@
"
"Modified: / 29-07-2011 / 19:55:35 / cg"
+ "Modified: / 19-02-2019 / 16:29:30 / Claus Gittinger"
!
loadExtensionsForPackage:aPackageId