Ever made a component or library package, and wanted the same package file to work on multiple versions of Delphi… without having to use a separate Package Project for each version?
Well, I want to!
Delphi doesn’t exactly make it easy, though!
Ever notice how Delphi RTL, VCL and other common BPL files can be referenced as “vcl”, “rtl”… and do not require the numeric suffix which determines the Delphi version to which they apply; and yet the files themselves are named like *vcl120.bpl*?
I’m not entirely sure of exactly how Borland, CodeGear and Embarcadero have accomplished this with their own Packages, but what I do know is that one crucial stage of that is the use of the *LIB suffix* value available in Project Options > Description.
The problem, however, is that since Delphi 2005, Package Projects have included a .DPROJ file, used by the IDE to store those Project Options, and used by MSBUILD (invoked either by yourself via the command line, or by the IDE to compile/build your project).
While it is easy for us to define a *Lib suffix* value using *{$LIBSUFFIX ’120′}*, this does not address the DPROJ file, which results in a Fatal Error at the end of the Compile/Build process.
To fix this, something else is needed… something beyond the capabilities provided by the IDE “out of the box”.
To solve all of the problems mentioned above, I have begun (and largely completed) development of a new self-installing Delphi IDE Plugin called *AutoSuffix*.
*AutoSuffix* is a simple IDE plugin accessed via the Project Manager’s Context Menu. The new menu item applies only to Package Projects and enables you to toggle AutoSuffix on and off.
When switched on, AutoSuffix will manage the Lib Suffix for you, in both the DPK and DPROJ files.
The best part is, whenever you load a Package Project with AutoSuffix enabled, it automatically sets the correct Lib Suffix for you… so you can compile and install the package *immediately*!
The only catch is that the AutoSuffix plugin needs to be installed on all Delphi IDEs you wish to use that Package with (*versions 2006 to XE2 supported*, older versions don’t require AutoSuffix as there’s a very simple solution you can use for them without the need for a plugin).
*AutoSuffix* will be launched packed neatly into an automated installer (made with InnoSetup) within the next 24 hours (see update for details), and will be available for *everyone*, absolutely *free of charge*.
Keep in mind that the first release is a *working prototype* (Alpha), so it is possible you may encounter the occasional bug when using it initially.
As the project evolves, it’ll be expanded to provide greater possibilities, such as version-specific version information, version-specific paths, version-specific compiler settings and more!
The ultimate goal is to enable us to distribute fully version-independant Delphi Packages to be used by the IDE (Component Packs, Wizards, Plugins, Packaged Libraries etc), without the need to maintain multiple Project Files.
A video will be available demonstrating how it works and exactly what it does… though this will most likely be *after* the Alpha release itself (due to the time it takes to produce, edit and publish videos).
Let me know your thoughts!
UPDATE 1
Due to some interest on this subject from within Embarcadero Technologies, I am now awaiting word on a decision which will change the way AutoSuffix needs to work (on a fundamental level). If the decision reached by Embarcadero is favorable, AutoSuffix will cater to those of us using Delphi 7 to XE2, and will no longer be necessary with future Delphi releases! I’ll update this post again when I have more information! This is a positive step, though!


January 10, 2012 at 3:05 am
This will save a ton of time for vendors building for multiple delphi targets!
January 10, 2012 at 3:34 am
That’s the point of the thing
January 10, 2012 at 3:24 am
Looking forward to hearing more!
January 10, 2012 at 3:34 am
Looking forward to putting it out there for everyone to download.
It’d be up already but D2007 and D2009 are being a pain in the arse (OTAPI differences).
January 10, 2012 at 9:11 am
Smart idea, from a really smart Guy
January 10, 2012 at 10:25 am
I’ll graciouslly accept the praise, even if I don’t necessarily agree with the latter portion of it
January 10, 2012 at 10:58 am
Great idea, Simon! That will be a valuable extension.
As I already have had a couple of thoughts on that problem before, I would be interested in how you are planning to address the incompatible dproj files between the different Delphi versions. AFAIK, it is not possible to open a dproj file in D2007 which has been written by XE2.
January 10, 2012 at 11:15 am
You are correct! However…
I have the ability to fully modify the DPROJ files from the extension, which means the plugin can handle the intra-version issues (indeed, it’s already dealing with some between 2009 and XE2, with the 2007 changes just started).
It just comes down to heavily analyzing the differences between DPROJ files generated by each version of Delphi, and handling those in the plugin
January 10, 2012 at 12:10 pm
Great! Can’t wait for it…
January 10, 2012 at 5:27 pm
“I’m not entirely sure of exactly how Borland, CodeGear and Embarcadero have accomplished this with their own Packages,”
It works with any package, and was introduced to avoid the need to change all the package references when building with run-time packages whenever the application is opened with a different version of Delphi. The key is that the BPL is used only at run-time, while when compiling the AFAIK the DCP is used. The DCP is compiled without the lib suffix, and that’s what is reference when “build with run-time packages” is selected. Probably it contains a reference to the needed run time package including the suffix so the application can load it properly when run.
IIRC this was introduced around D6, but many developers stubbornly continued to put version informations inside the package filename and didn’t use the new features…
January 10, 2012 at 5:56 pm
It still isn’t automatically suffixing the Delphi version, and Delphi itself has no option to do this… hence the need for the plugin.
I know how suffixing works! What I don’t know (and this is to what I was reffering in the OP) is whether EMB have the version numbers inserted as suffix AUTOMATICALLY, and if so… how they’re doing it
January 10, 2012 at 9:00 pm
Search and Replace?
January 10, 2012 at 10:15 pm
Not exactly, no! Most of the work (for the DPROJ at least) is done directly via the OTAPI (believe it or not, the Interfaces in there provide a fair degree of control to manipulate the DPROJ files).
The BPK files, however, I am manipulating using a far less sophisticated approach (loading it up in a TStringsList and parsing for case-specifics, then changing them accordingly)
January 11, 2012 at 4:48 am
Yeah. As arcane as it sounds, we actually do run a tool that updates all the .dproj and .dpk files after we branch for the previous release. It’s a pain, but it’s just one part of the a whole “version bump” routine that needs to be performed. With each release we make the process a little easier (and better documented), but invariably there is something that is missed.
AutoSuffix sounds like a great idea. I think we should add it to the product!
Mark
January 11, 2012 at 1:11 pm
Cheers for the clarification on how you guys at Embarcadero handle your packages. I also agree that AutoSuffix (or something like it, at least) should be added to Delphi/RAD Studio “out of the box”.
January 11, 2012 at 10:06 pm
I’ve just made the following report upon request publicy available
Report No: 83229 (RAID: 275628) Status: Open
{$LIBSUFFIX AUTO} for packages
http://qc.embarcadero.com/wc/qcmain.aspx?d=83229
Users vote for it if you like it.
I won’t vote for it as version independed packages need much more than just an upgrade of the suffix.
January 11, 2012 at 11:05 pm
Voted! Everyone else should too!
January 11, 2012 at 10:12 pm
http://qc.embarcadero.com/wc/qcmain.aspx?d=83229
January 11, 2012 at 11:05 pm
Voted!
January 15, 2012 at 3:36 am
While I think this is a Very Good Idea, many shops and vendors won’t use it unless it’s an integral part of the IDE.
It’s a very small tweak to the IDE that will result in very large and positive ROI for all Delphi vendors and customers alike.