[Lazarus] embed git version info
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Thu Mar 28 10:19:06 CET 2013
Graeme Geldenhuys wrote:
> On 2013-03-27 17:59, Sven Barth wrote:
>>> const
>>> cGitRevision = '{$revision.inc}';
>> This won't work, because the string takes precedance over the directive.
>
> Probably why my original version build script generates the whole line
> with identifier.
>
> What about the following...
>
> const
> cGitRevision = '''' + {$revision.inc} + '''';
>
> Or are expressions not allowed in constant declarations either? Anyway,
> I think we gave enough hints for the original poster to find a suitable
> solution. I was never pro to spoon-feeding programmers. ;-)
Another approach- which I use for svn- is to generate the version string
with quotes. At the point of use you can simply have something like
(*$IFDEF USE_SVN *)
(*$IFDEF UNIX *)
rev= (*$I project_svnrevision.inc *) ;
(*$ELSE *)
rev= 'unimplemented';
(*$ENDIF *)
This can be a bit tricky, since it needs something like tr on all
platforms and Lazarus has problems with \ in the ExecuteBefore...Command
Value setting. I'm sure somebody wants to tell us that MSEide handles
them without complaint.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the Lazarus
mailing list