CJDCodeExtractor for Dolphin Smalltalk 5
3-10-2003 Release 1
This is FREE code. Do not redistribute modifications without my permission. User at your own risk. Let me know if there are any bugs.
I started using Dolphin packages to organize my code. I have sets of packages that are always intended to be used together. The Dolphin package manager does not allow one to save or uninstall packages with cyclic prerequisites. I use the STS source control manager to get around this (sometimes code needs to be loaded twice to get all methods to compile though). The big program I ran into was deploying my application. I wanted to strip unused packages, but because some had cyclic prerequisites that could not be done. My first solution was a cyclic package tolerant image stripper class. I never quite got that totally working, and instead moved on to what I think is an even better approach.
I wrote a class that can effectively extract a package and all it's perquisite packages into one big "super package". That package can then be loaded into Dolphin via the traditional package manager. This allows me to always deploy from a fresh image. It also eliminates any problems with cyclic packages since they are all merged into one.
The advantage to using a package based format rather than a fileout format is that I can retain all the important package values such as pools and other globals. I am even using the image stripper data from the main package.
In the future I would like to expand this code to have an option to recreate the existing package structure. Then this code could be used to easily move code with cyclic packages into a new image.
This is not the most elegant code. It was developed rapidly, and in slight frustration before I needed to deploy an application. However I hope it is useful to others.
This is how it is used:
CJDCodeExtractor extractForPackage: 'MainPackageName' toPath: 'D:\PathName\'.
The instance methods systemPackages and excludeFromExportPacakges could be edited to exclude additional packages from the resulting package. You should ensure that any excluded packages are already in the destination image.
Standard disclaimers apply. Use at your own risk.
This link includes the package: Download the package (~10k)