Skip to content

Commit

Permalink
Append short commit hash in development profile
Browse files Browse the repository at this point in the history
This explicitly checks the command before assigning to the
`version` variable.

This also addresses the following warning during building:

```
WARNING: You should add the boolean check kwarg to the run_command call.
It currently defaults to false,
but it will default to true in future releases of meson.
See also: mesonbuild/meson#9300
```
  • Loading branch information
TheEvilSkeleton authored and diegogangl committed Mar 15, 2024
1 parent 083353f commit 5b1a586
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions GTG/core/meson.build
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Find the version number and put it in info.py.
# Use git --describe if available.
# Append short commit hash and put it in
# info.py when using development profile.
# Use git rev-parse --short HEAD if available.

git = find_program('git', required : false, disabler : true)
git_description = run_command(git, 'describe', '--dirty')

if not git.found() or git_description.returncode() != 0
version = meson.project_version()
if git.found() and get_option('profile') == 'development'
version = meson.project_version() + '-' + run_command(
['git', 'rev-parse', '--short', 'HEAD'],
check: true
).stdout().strip()
else
version = git_description.stdout().strip()
version = meson.project_version()
endif

info_config = configuration_data()
Expand Down

0 comments on commit 5b1a586

Please sign in to comment.