[Lazarus] Lazarus Version

Michael Van Canneyt michael at freepascal.org
Tue Nov 8 21:45:16 CET 2016



On Tue, 8 Nov 2016, Mattias Gaertner via Lazarus wrote:

> On Tue, 8 Nov 2016 13:08:41 +0100 (CET)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>
>> [...]
>> I'm not sure we're talking about the same thing. I don't know what 'version
>> unit' you mean ?
>
> For example lazarus/lcl/lclversion.pas
>
> 
>> [...]
>> As far as I know, the version number of a lazarus packages lives outside the
>> sources, it resides just in the LPK.
>
> Yes.
>
>> I now use some XML routines to extract
>> this version number from the .lpk and write it in the abovementioned include 
>> file. This happens in our build system.
>
> The IDE could write the version to some file (or update an existing
> file). What would be a good place?

A unit in the package. If you need the version, you use the unit.
packagename_version.p(p|pas)


> For example when package A needs to know the version of a required
> package B the version must be stored either in a unit of A or B.
> Storing it in B avoids redundancy, but when B is read only it needs
> to be stored in A.

Well, I will always control every package, so for me this question is
academic. But it seems to me that if B doesn't provide the version, 
then the user is simply out of luck. If you really want to go that far,
you could split the option in the package options:

[x] Generate unit with version number
    [x] Generate version numbers for all used packages

Then

unit a_version;

interface
   AVersionStr  = '1.2.3';
   BversionStr  = '2.3.4';

implementation

end.

Or somesuch...

Michael.


More information about the Lazarus mailing list