Mojo's Build Number Maven Plugin
  1. Mojo's Build Number Maven Plugin
  2. MBUILDNUM-93

Generate buildnumber as a commit sequence number for Git

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      New feature is offered to compute Subversion-style build numbers for Git repositories.

      Build number increasing sequence is desired e.g. for correct updates recognition of Netbeans modules.

      Proposed patch providing this functionality is attached.

      When new parameter gitCountCommits is set to true, patched info method in CreateMojo counts all existing commits in the repository and assigns the result as new build number. In addition, when useLastCommittedRevision is set to true, HEAD revision of the working directory is found and commit sequence number of it is found and assigned as build number instead.

      The patch works fine with my projects - when Subversion repository was converted to Git, plugin created identical build numbers for all modules.

        Issue Links

          Activity

          Hide
          Frantisek Mantlik added a comment -

          Updated patch uses git log instead of git whatchanged. This gives better results on some edge situations.

          Show
          Frantisek Mantlik added a comment - Updated patch uses git log instead of git whatchanged. This gives better results on some edge situations.
          Hide
          Tomáš Procházka added a comment -

          I vote for integrate this patch. I use this plugin together with com.google.code.maven-replacer-plugin to auto generate versionCode in Android manifest file and this allow use it also on GIT.

          Show
          Tomáš Procházka added a comment - I vote for integrate this patch. I use this plugin together with com.google.code.maven-replacer-plugin to auto generate versionCode in Android manifest file and this allow use it also on GIT.
          Hide
          Tomáš Procházka added a comment -

          Is any chance that this will be integrated? Or exist any other solution how to get unique incremental number from GIT for tagging build number?

          Show
          Tomáš Procházka added a comment - Is any chance that this will be integrated? Or exist any other solution how to get unique incremental number from GIT for tagging build number?
          Hide
          Tomáš Procházka added a comment -

          I investigated it more detailed and problem of this solution is that it completely replace original commit hash which identify build. I think that much better will be add additional variable and keep buildNumber intact.

          Show
          Tomáš Procházka added a comment - I investigated it more detailed and problem of this solution is that it completely replace original commit hash which identify build. I think that much better will be add additional variable and keep buildNumber intact.
          Hide
          Frantisek Mantlik added a comment -

          Maybe it would be better to keep buildnumber the sequence build number as proposed in the proposed patch and introduce an additional variable for Git commit hash?

          It should be noticed that the build sequence number replaces Git hash when gitCountCommits parameter is set to true (default is false, i.e. current behavior).

          In either case I would appreciate very much any implementation of commit sequence number to be incorporated into the official release.

          Show
          Frantisek Mantlik added a comment - Maybe it would be better to keep buildnumber the sequence build number as proposed in the proposed patch and introduce an additional variable for Git commit hash? It should be noticed that the build sequence number replaces Git hash when gitCountCommits parameter is set to true (default is false, i.e. current behavior). In either case I would appreciate very much any implementation of commit sequence number to be incorporated into the official release.
          Hide
          Jörg von Frantzius added a comment - - edited

          As discussed in duplicating issue MBUILDNUM-104 , it may make sense to combine the commit count with a short hash as e.g. git describe already does.

          Build numbers within the same branch would remain orderable, while build numbers from different branches would at least be guaranteed to be different.

          Another example of update recognition based on build number sequences is the Open Source Magnolia CMS, where it was possible to simply suffix a module version number with the SVN revision in order to get a module update recognized.

          Show
          Jörg von Frantzius added a comment - - edited As discussed in duplicating issue MBUILDNUM-104 , it may make sense to combine the commit count with a short hash as e.g. git describe already does. Build numbers within the same branch would remain orderable, while build numbers from different branches would at least be guaranteed to be different. Another example of update recognition based on build number sequences is the Open Source Magnolia CMS , where it was possible to simply suffix a module version number with the SVN revision in order to get a module update recognized.
          Hide
          Tomáš Procházka added a comment -

          I made this:
          https://github.com/tprochazka/buildnumber-maven-plugin-for-git
          If you want you can incorporate my changes to original plugin.

          Show
          Tomáš Procházka added a comment - I made this: https://github.com/tprochazka/buildnumber-maven-plugin-for-git If you want you can incorporate my changes to original plugin.
          Hide
          Jörg von Frantzius added a comment -

          We successfully tried out this plugin: https://github.com/code54/buildversion-plugin

          There is good documentation of its inner workings, and it can be configured with (Clojure:/)-Scripts to set additional custom properties.

          Show
          Jörg von Frantzius added a comment - We successfully tried out this plugin: https://github.com/code54/buildversion-plugin There is good documentation of its inner workings, and it can be configured with (Clojure:/)-Scripts to set additional custom properties.

            People

            • Assignee:
              Unassigned
              Reporter:
              Frantisek Mantlik
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: