make sure it also works when there are no git tags

This commit is contained in:
Konstantin Käfer
2014-12-08 16:47:24 +01:00
parent e11c073e51
commit 0a84deef91
2 changed files with 8 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
'<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp',
'<(SHARED_INTERMEDIATE_DIR)/src/mbgl/util/mbgl_version.cpp',
],
'action': ['<@(python)', 'scripts/build-version.py', '<(SHARED_INTERMEDIATE_DIR)', '<!@(git describe --tags --abbrev=0)', '<!@(git rev-parse --short HEAD)'],
'action': ['<@(python)', 'scripts/build-version.py', '<(SHARED_INTERMEDIATE_DIR)', '<!@(git describe --tags --always --abbrev=8)', '<!@(git rev-parse --short=8 HEAD)'],
}
],
'direct_dependent_settings': {

View File

@@ -4,7 +4,13 @@ import sys, os, errno
output_dir = sys.argv[1]
tag = map(int, sys.argv[2].split('.'))
# When they're identical, the git describe can't find a tag and reports the rev instead.
if sys.argv[2] == sys.argv[3]:
tag = [0, 0, 0]
else:
tag = map(int, sys.argv[2].split('.'))
rev = sys.argv[3]