|
| 1 | +# Ocre Versioning |
| 2 | + |
| 3 | +## Source components |
| 4 | + |
| 5 | +There are several components of the Ocre version that gets compiled in the project. |
| 6 | + |
| 7 | +The file `src/ocre/version.h` includes the Ocre Library version string. |
| 8 | +While the file `commit_id.h` includes the commit ID of the Ocre Library. |
| 9 | +If this file is not present in the source tree, the file is generated during the build process and is stored in the build directory. |
| 10 | +If the file does not exist, and the source tree is not a valid git repository, the build will fail. |
| 11 | + |
| 12 | +Note that these are unrelated to the Zephyr version and the Zephyr application version mechanism (i.e. through the use of the VERSION file in the Zephyr application directory). |
| 13 | + |
| 14 | +## Version variables |
| 15 | + |
| 16 | +These files together form the Ocre version variables, which are compiled statically into the `struct ocre_config ocre_build_configuration` struct defined in `ocre/library.h`: |
| 17 | + |
| 18 | +```c |
| 19 | +struct ocre_config { |
| 20 | + const char *version; /**< Version of the Ocre Library */ |
| 21 | + const char *commit_id; /**< Commit ID of the build tree */ |
| 22 | + const char *build_info; /**< Host build information */ |
| 23 | + const char *build_date; /**< Build date */ |
| 24 | +}; |
| 25 | + |
| 26 | +extern const struct ocre_config ocre_build_configuration; |
| 27 | +``` |
| 28 | + |
| 29 | +The specific meaning of these variables is as follows: |
| 30 | + |
| 31 | +### version |
| 32 | + |
| 33 | +The version of the Ocre Library. In the form Major.Minor.Patch and is defined in the `version.h` file. |
| 34 | + |
| 35 | +It follows the semantic versioning format. |
| 36 | + |
| 37 | +Note the `version.h` file is not generated automatically. Instead it is maintained manually or automatically whenever we release a new version of the Ocre Runtime. |
| 38 | + |
| 39 | +### commit_id |
| 40 | + |
| 41 | +The commit ID of the build tree. |
| 42 | +Generated every time into `commit_id.h` if the source tree is a valid git repository, otherwise, set to whatever is defined in `commit_id.h`. |
| 43 | + |
| 44 | +The format is `commit-hash[-dirty]`. This is generated by the build system using `git describe --always --abbrev=0 --dirty`, so it means the current commit hash and if there are any uncommitted changes in the working tree (as specificied by the optional `-dirty` suffix). |
| 45 | + |
| 46 | +### build_info |
| 47 | + |
| 48 | +The host build information. Generated on every build system by the build system automatically. |
| 49 | + |
| 50 | +It has the format `user @ system`. Where `user` is the value of the `USER` environment variable and `system` is the output of `uname -a`. |
| 51 | + |
| 52 | +### build_date |
| 53 | + |
| 54 | +The build date. Generated on every build system by the build system automatically. |
| 55 | + |
| 56 | +It has the format `YYYY-MM-DD HH:MM:SS TZ` and is generated by `date +'%Y-%m-%d %H:%M:%S %Z'` |
| 57 | + |
| 58 | +For more information about the build system, see [Linux Build System](BuildSystemLinux.md) and [Zephyr Build System](BuildSystemZephyr.md) documentation. |
0 commit comments