aedi: print source version when building from git repository

This commit is contained in:
alexey.lysiuk 2023-03-18 12:17:13 +02:00
parent bd5bd08481
commit 4645a58fec
2 changed files with 14 additions and 0 deletions

View file

@ -153,6 +153,9 @@ class Builder(object):
self._create_prefix_directory() self._create_prefix_directory()
if version := state.source_version():
print(f'Building {version}')
if target.multi_platform and not state.xcode: if target.multi_platform and not state.xcode:
self._build_multiple_platforms(target) self._build_multiple_platforms(target)
else: else:

View file

@ -256,3 +256,14 @@ class BuildState:
if sdk_version := self.sdk_version(): if sdk_version := self.sdk_version():
if sdk_version < minimum_version: if sdk_version < minimum_version:
raise RuntimeError('Minimum SDK version requirement is not met') raise RuntimeError('Minimum SDK version requirement is not met')
def source_version(self):
version = ''
args = ('git', f'--git-dir={self.source}/.git', 'describe', '--tags')
git_describe = subprocess.run(args, env=self.environment, capture_output=True)
if git_describe.returncode == 0:
version = git_describe.stdout.decode('ascii')
return version