Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Automatic increase build number
Forum Updated to NodeBB v4.3 + New Features

Automatic increase build number

Scheduled Pinned Locked Moved General and Desktop
10 Posts 6 Posters 7.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kitten
    wrote on last edited by
    #1

    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

    www.kitten.mihanblog.com

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kitten
      wrote on last edited by
      #2

      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

      www.kitten.mihanblog.com

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kitten
        wrote on last edited by
        #3

        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 for first'.
        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.@

        www.kitten.mihanblog.com

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kitten
            wrote on last edited by
            #5

            should i use PRE_TARGETDEPS?

            www.kitten.mihanblog.com

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kitten
              wrote on last edited by
              #6

              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@

              www.kitten.mihanblog.com

              1 Reply Last reply
              0
              • M Offline
                M Offline
                MichK
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  ReklatsMasters
                  wrote on last edited by
                  #8

                  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@

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    koahnig
                    wrote on last edited by
                    #9

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

                    Vote the answer(s) that helped you to solve your issue(s)

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      refaQtor
                      wrote on last edited by
                      #10

                      .

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved