Reinvent The Wheel

Round is nice, but we can do better!

AutoSuffix_1

AutoSuffix – One Package Project, Multiple Delphi Versions (Automatically)

| 20 Comments

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.

AutoSuffix managing the DPROJ

AutoSuffix managing the DPROJ

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!

Author: Simon J Stuart

Automation and Productivity Systems Specialist, Author of various Components, Libraries and Tools for Embarcadero Delphi, Embarcadero Technology Partner, Founder and CEO of LaKraven Studios Ltd, Father of 2 (+ 2 dogs), Credited Technical Editor, Published Technical Author, Seeker of peace!

20 Comments

  1. This will save a ton of time for vendors building for multiple delphi targets!

  2. Looking forward to hearing more!

  3. Smart idea, from a really smart Guy ;)

  4. 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.

    • 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 ;)

  5. “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…

  6. 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.

Leave a Reply

Required fields are marked *.

*


*