Automatic increase build number



  • hi i use "this":https://gitorious.org/giesbert-s-software/autoincreasebuildnr to increase my build number
    and i write this in my pro file:
    @BuildNo = "D:/Qt/qtcreator-2.4.0/projects/QJalaliCalendar/src/AutoIncreaseBuildNr.exe D:/Qt/qtcreator-2.4.0/projects/QJalaliCalendar/src/version.h"@
    also i added autoincreasebuildnrs.exe and version.h in this address but it does'nt do anything what should i do?
    i use qtcreator and mingw on windows



  • i changed my pro file to
    @# Create our custom svnbuild target.
    win32:svnbuild.commands = AutoIncreaseBuildNrs.exe ..\QJalaliCalendar\src\version.h
    QMAKE_EXTRA_TARGETS += svnbuild

    Hook our svnbuild target in between qmake's Makefile update and the actual project target.

    svnbuildhook.depends = svnbuild
    CONFIG(debug,debug|release):svnbuildhook.target = Makefile.Debug
    CONFIG(release,debug|release):svnbuildhook.target = Makefile.Release
    QMAKE_EXTRA_TARGETS += svnbuildhook@
    but now it plus 2 except 1 for example it goes from 31 to 33



  • i am sorry and this is my compile output
    i think it is run twice i don't know why can you help me?
    @12:10:18: Running build steps for project QJalaliCalendar...
    12:10:18: Configuration unchanged, skipping qmake step.
    12:10:18: Starting: "D:\Qt\qtcreator-2.4.0\mingw\bin\mingw32-make.exe"
    AutoIncreaseBuildNrs.exe ..\QJalaliCalendar\src\version.h
    Old version was 67 and is now incremented by 1.
    version file written
    D:/Qt/qtcreator-2.4.0/mingw/bin/mingw32-make.exe -f Makefile.Release
    mingw32-make.exe[1]: Entering directory D:/Qt/qtcreator-2.4.0/projects/QJalaliCalendar-build-desktop-Qt_4_8_0__4_8_0__Release' AutoIncreaseBuildNrs.exe ..\QJalaliCalendar\src\version.h Old version was 68 and is now incremented by 1. version file written mingw32-make.exe[1]: Nothing to be done forfirst'.
    mingw32-make.exe[1]: Leaving directory `D:/Qt/qtcreator-2.4.0/projects/QJalaliCalendar-build-desktop-Qt_4_8_0__4_8_0__Release'
    12:10:18: The process "D:\Qt\qtcreator-2.4.0\mingw\bin\mingw32-make.exe" exited normally.@



  • Yes, there is more than one pass. There is a way to keep them apart, but I don't remember, sorry. You should study the qmake reference to find out.



  • should i use PRE_TARGETDEPS?



  • i found problem:d
    i should use sth like this
    @svnbuild.target = customtarget
    win32:svnbuild.commands = ..\tools\build\updateBuildNumber.bat ..\svnbuild.hxx
    else:svnbuild.commands = ../tools/build/updateBuildNumber.sh ../svnbuild.hx
    QMAKE_EXTRA_TARGETS += svnbuild
    PRE_TARGETDEPS += customtarget@



  • Once information which I found on "this":http://qtcreator.blogspot.com/2009/10/generating-automatic-version-numbers.html site were very useful to me.



  • I use this with git:

    .pro

    @GIT_VERSION = $$system($$quote(git describe))
    GIT_TIMESTAMP = $$system($$quote(git log -n 1 --format=format:"%at"))

    QMAKE_SUBSTITUTES += $$PWD/version.h.in@

    version.h.in (tag fomat: v1.2.3)

    @#define APP_MAJOR $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.)$", "\1")
    #define APP_MINOR $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.
    )$", "\2")
    #define APP_PATCH $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.)$", "\3")
    #define APP_BUILD $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.
    )$", "\4")
    #define APP_VERSION $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.)$", ""\1.\2.\3.\4"")
    #define APP_VERSION_RC $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.
    )$", "\1,\2,\3,\4")
    #define APP_REVISION $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.)$", ""\5"")
    #define APP_NAME $$replace(TARGET, "^(.
    )$", ""\1"")
    #define APP_TIME $$GIT_TIMESTAMP@

    example output file:

    @#define APP_MAJOR 1
    #define APP_MINOR 5
    #define APP_PATCH 0
    #define APP_BUILD 17
    #define APP_VERSION "1.5.0.17"
    #define APP_VERSION_RC 1,5,0,17
    #define APP_REVISION "gb147884"
    #define APP_NAME "BalanceCheck"
    #define APP_TIME 1368377158@


  • Moderators

    [quote author="ReklatsMasters" date="1368386823"]I use this with git:

    .pro

    @GIT_VERSION = $$system($$quote(git describe))
    GIT_TIMESTAMP = $$system($$quote(git log -n 1 --format=format:"%at"))

    QMAKE_SUBSTITUTES += $$PWD/version.h.in@

    version.h.in (tag fomat: v1.2.3)

    @#define APP_MAJOR $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.)$", "\1")
    #define APP_MINOR $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.
    )$", "\2")
    #define APP_PATCH $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.)$", "\3")
    #define APP_BUILD $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.
    )$", "\4")
    #define APP_VERSION $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.)$", ""\1.\2.\3.\4"")
    #define APP_VERSION_RC $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.
    )$", "\1,\2,\3,\4")
    #define APP_REVISION $$replace(GIT_VERSION, "^v(\d+)\.(\d+)\.(\d+)-(\d+)-(.)$", ""\5"")
    #define APP_NAME $$replace(TARGET, "^(.
    )$", ""\1"")
    #define APP_TIME $$GIT_TIMESTAMP@

    example output file:

    @#define APP_MAJOR 1
    #define APP_MINOR 5
    #define APP_PATCH 0
    #define APP_BUILD 17
    #define APP_VERSION "1.5.0.17"
    #define APP_VERSION_RC 1,5,0,17
    #define APP_REVISION "gb147884"
    #define APP_NAME "BalanceCheck"
    #define APP_TIME 1368377158@[/quote]

    Thanks for this excellent feedback. You made my day with it.

    The only drawback is that there is not much to be found on QMAKE_SUBSTITUTES , but I make a solution.



  • .


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.