app: Add example of VERSION file tracking git index file#92
Conversation
henrikbrixandersen
left a comment
There was a problem hiding this comment.
Neat. I wonder if this could somehow be added as a hook in the main Zephyr repo?
It was added with one originally but Torsten did not like introducing a git dependency on application repos: zephyrproject-rtos/zephyr#98210 (comment) |
tejlmand
left a comment
There was a problem hiding this comment.
Thanks, some small observations
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| ERROR_STRIP_TRAILING_WHITESPACE | ||
| ERROR_VARIABLE stderr | ||
| RESULT_VARIABLE return_code) |
There was a problem hiding this comment.
minor nit.
| RESULT_VARIABLE return_code) | |
| RESULT_VARIABLE return_code | |
| ) |
| # without a dependency, this will be the case with freestanding applications. | ||
| if(NOT return_code) | ||
| if(NOT "${stderr}" STREQUAL "") | ||
| message(WARNING "APPLICATION_BUILD_VERSION: git rev-parse warned: ${stderr}") |
There was a problem hiding this comment.
Using upper case and _ makes APPLICATION_BUILD_VERSION looks like it's referring to a CMake var, which doesn't seem the case, so can be a bit misleading / confusing.
What's the reason for APPLICATION_BUILD_VERSION: first, or could there be another option ?
There was a problem hiding this comment.
Was based on the zephyr one, have changed it to be lower case and no longer make it look like a variable
Adds an example of how to add the git index file (if this is inside of a git repo) to the dependencies of the application version file, which allows the git commit of the application version to be updated as new commits are added Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
fabiobaltieri
left a comment
There was a problem hiding this comment.
oh that's cool... just wondering, is this something that you could move in the main repository in a cmake function and then have the app instantiate that by calling it in the app cmakelist? Then one would not have to copypaste this snippet around
|
Ok I've just seen the comments above, nevermind. |
Adds an example of how to add the git index file (if this is inside of a git repo) to the dependencies of the application version file, which allows the git commit of the application version to be updated as new commits are added