[SailfishDevel] Sharing version number (and other constants?) between .yaml/spec, .pro and .cpp/.qml

Putze Sven sailfish.os at hardcodes.de
Sat Dec 7 10:52:52 UTC 2013


Hi,

I've used something like

VERSION = 0.1.0
HC_GITHASH  = $$system(git show HEAD|grep "^commit"|cut -c 8-)
# c style DEFINEs to access the git hash and program version
DEFINES += HC_PROGRAMVERSION=\\\"$$VERSION\\\"
DEFINES += HC_GITHASH=\\\"$$HC_GITHASH\\\"

in the .PRO file. This provides access in the .PRO file itself and in any .h or .cpp file. From there should be a way to .qml (via Q_PROPERTY). Not sure about the .yaml file.

BR.
Sven

On 07.12.2013, at 00:26, Artem Marchenko <artem.marchenko at gmail.com> wrote:

> P.S.
> Oh well, super ideal version would pull tag from git into both .pro and .yaml, but I guess that is impossible without the custom scripts.
> 
> 
> On Sat, Dec 7, 2013 at 1:25 AM, Artem Marchenko <artem.marchenko at gmail.com> wrote:
> Just what I was looking for. Thanks, Robin!
> 
> Cheers,
> Artem.
> 
> 
> On Sat, Dec 7, 2013 at 12:50 AM, Robin Burchell <robin.burchell at jolla.com> wrote:
> https://github.com/nemomobile/mlite/blob/master/rpm/mlite-qt5.yaml#L20
> gives you
> https://github.com/nemomobile/mlite/blob/master/rpm/mlite-qt5.spec#L60
> 
> if you want to go all out gung-ho with automation, you can also do something like https://github.com/nemomobile/mlite/blob/master/src/src.pro#L3 in your project file for local builds.
> 
> On 06 Dec 2013, at 23:45, Artem Marchenko <artem.marchenko at gmail.com> wrote:
> 
>> Hi All
>> 
>> Does anybody know a way to share constants between .yaml and any other project file (preferably .pro, but any other way would do as well)?
>> 
>> I sort of got tired to duplicate version numbers in .yaml and app's about dialog :)
>> Writing app description in one place only would've been good too.
>> 
>> Best regards,
>> Artem.
>> 
>> -- 
>> Artem Marchenko
>> http://agilesoftwaredevelopment.com
>> http://twitter.com/AgileArtem
>> _______________________________________________
>> SailfishOS.org Devel mailing list
> 
> 
> _______________________________________________
> SailfishOS.org Devel mailing list
> 
> 
> 
> -- 
> Artem Marchenko
> http://agilesoftwaredevelopment.com
> http://twitter.com/AgileArtem
> 
> 
> 
> -- 
> Artem Marchenko
> http://agilesoftwaredevelopment.com
> http://twitter.com/AgileArtem
> _______________________________________________
> SailfishOS.org Devel mailing list



More information about the Devel mailing list