HEMTT icon indicating copy to clipboard operation
HEMTT copied to clipboard

Build Feature - Version Increment

Open jonpas opened this issue 6 years ago • 3 comments

release MINOR/MAJOR/PATCH with build always increased (if it exists).

Could also do release --inc minor/major/patch.

  • [ ] Templating in version

jonpas avatar Feb 19 '19 22:02 jonpas

For smaller projects I often just use the day's date as a version signifier - could HEMTT support that? E.g, 2019.02.17.

bovine3dom avatar Feb 27 '19 08:02 bovine3dom

Once templating is done, you should be able to do that

BrettMayson avatar Feb 27 '19 08:02 BrettMayson

@bovine3dom this is how it would look like with date templating, just need to support version templating.

version = "{{date \"%Y\"}}.{{date \"%m\"}}.{{date \"%d\"}}"

This request is probably best implement with a version utility which can:

  • Update versions in specified files
  • Increment version and apply it back to project
  • Be used in scripts (to be ran manually or by external script before releases - not all release builds):
[scripts.version]
show_output = true
steps = [
    "@version -i build",
    "git commit -am \"Prepare release {{version}}\""
]
  • Usage example:
$ hemtt version -i minor  # Increment minor number
$ hemtt run version  	  # Run helper script (build number + git commit)

This is of course entirely up to the project and how they handle or wish to handle releases. But I think we shouldn't do any invasive git operations automatically in HEMTT, scripts provide a perfect way to accomplish that. I came up with this examples from how we would want to do it in ACE3/CBA (how it is done) and ACRE2 (how Jenkins would do it through external script).


Idea on version file list configuration (files that contain version that needs updating):

# Specify files where version needs updating, without source (script_version.hpp)
version_files = [
    "mod.cpp",
    "README.md"
]

Ideas on version utility usage:

$ hemtt version # Argument --update -u maybe?
$ hemtt version --increment major
$ hemtt version --inc minor	# Maybe not?
$ hemtt version -i patch
$ hemtt version -i build
  • version would update all files specified in version_files config using p.version as source
    • Regex matching
      • x.y.z and x.y.z.w fits HEMTT version specification very well, could just match on that like we do in ACE3's and CBA's make.py
  • version -i would just update p.version and run version routine (above)
    • In case where template is specified for version, it would use that (eg. date)
      • Problem: How do we specify that in script_version.hpp? Does HEMTT config overwrite that and we automatically add script_version.hpp into version_files with special handling (different definition)?

This is all largely taken from ACE3/CBA/ACRE2's make.py where I implemented a very similar system.


Ideally, we could also support:

$ hemtt version -i minor
$ hemtt run release
[scripts.release]
show_output = true
steps = [
    "@version -i build", # Would automatically use date specifier as above
    "git commit -am \"Prepare release {{version}}\"",
    "build --release -f", # After version commit, we want headerext to be up-to-date
 	"git push" # Push preperation commit
]

For that, we need to allow running HEMTT commands inside scripts - though warning, could end up in a loop if not used correctly.

jonpas avatar Jun 20 '19 12:06 jonpas

This is now possible with hooks, I don't think a specific command is needed

BrettMayson avatar May 15 '23 23:05 BrettMayson