HEMTT
HEMTT copied to clipboard
Build Feature - Version Increment
release MINOR/MAJOR/PATCH
with build always increased (if it exists).
Could also do release --inc minor/major/patch
.
- [ ] Templating in
version
For smaller projects I often just use the day's date as a version signifier - could HEMTT support that? E.g, 2019.02.17.
Once templating is done, you should be able to do that
@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 inversion_files
config usingp.version
as source- Regex matching
-
x.y.z
andx.y.z.w
fits HEMTT version specification very well, could just match on that like we do in ACE3's and CBA'smake.py
-
- Regex matching
-
version -i
would just updatep.version
and runversion
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 addscript_version.hpp
intoversion_files
with special handling (different definition)?
-
Problem: How do we specify that in
- In case where template is specified for version, it would use that (eg.
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.
This is now possible with hooks, I don't think a specific command is needed