beast-dev / beast-mcmc

Bayesian Evolutionary Analysis Sampling Trees
http://beast.community
GNU Lesser General Public License v2.1
192 stars 73 forks source link

Automate versioning for build process #1131

Closed jtmccr1 closed 7 months ago

jtmccr1 commented 2 years ago

During development I often jump between branches and jar files. This pull request aims to make that process more robust by automatically storing the last tag (including version), current commit, and status (dirty or clean) in the jar file. This is done by running a few git commands during the ant build and then inserting their output into a version.txt file that is included in the jar. BeastVersion parses this file and provides access to the relevant data.

The catch is that this parses the version from the tag name, so tags need to follow a conventional format. All of the tags back version 1.8.2 follow the format v([\d.]+)[^\d.].* where the group captures the version number. If this is too restrictive we could keep the current hard coded version numbering in BeastVersion and use this behavior to report only the commit and status.

It looks like this might not play nicely (yet) with the continuous integration system.

Is this useful to anyone else?

jtmccr1 commented 2 years ago

I got rid of the tag behavior- that was too much. Now it just reports the commit the jar file was built from and whether or not the working tree is dirty. This solves the problem of having to hardcode in the commit hash which can only be done after the commit has been made. It does not affect how the versioning is handled.