Add commit number
This commit is contained in:
parent
f82cdfb539
commit
d06678b2b0
|
@ -58,6 +58,8 @@ EmulatorWindow::EmulatorWindow(Emulator* emulator)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
L" (" + xe::to_wstring(XE_BUILD_BRANCH) + L"/" +
|
L" (" + xe::to_wstring(XE_BUILD_BRANCH) + L"/" +
|
||||||
|
L"0.0.0." +
|
||||||
|
xe::to_wstring(XE_BUILD_COMMIT_NUMBER) + L"/" +
|
||||||
xe::to_wstring(XE_BUILD_COMMIT_SHORT) + L"/" +
|
xe::to_wstring(XE_BUILD_COMMIT_SHORT) + L"/" +
|
||||||
xe::to_wstring(XE_BUILD_DATE) + L")";
|
xe::to_wstring(XE_BUILD_DATE) + L")";
|
||||||
}
|
}
|
||||||
|
|
15
xenia-build
15
xenia-build
|
@ -229,6 +229,14 @@ def get_git_head_info():
|
||||||
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
(stdout, stderr) = p.communicate()
|
(stdout, stderr) = p.communicate()
|
||||||
branch_name = stdout.decode('ascii').strip() or 'detached'
|
branch_name = stdout.decode('ascii').strip() or 'detached'
|
||||||
|
p = subprocess.Popen([
|
||||||
|
'git',
|
||||||
|
'rev-list',
|
||||||
|
'HEAD',
|
||||||
|
'--count',
|
||||||
|
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
(stdout, stderr) = p.communicate()
|
||||||
|
commit_number = stdout.decode('ascii').strip() or '0000'
|
||||||
p = subprocess.Popen([
|
p = subprocess.Popen([
|
||||||
'git',
|
'git',
|
||||||
'rev-parse',
|
'rev-parse',
|
||||||
|
@ -244,22 +252,23 @@ def get_git_head_info():
|
||||||
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
(stdout, stderr) = p.communicate()
|
(stdout, stderr) = p.communicate()
|
||||||
commit_short = stdout.decode('ascii').strip() or 'unknown'
|
commit_short = stdout.decode('ascii').strip() or 'unknown'
|
||||||
return branch_name, commit, commit_short
|
return branch_name, commit_number, commit, commit_short
|
||||||
|
|
||||||
|
|
||||||
def generate_version_h():
|
def generate_version_h():
|
||||||
"""Generates a build/version.h file that contains current git info.
|
"""Generates a build/version.h file that contains current git info.
|
||||||
"""
|
"""
|
||||||
(branch_name, commit, commit_short) = get_git_head_info()
|
(branch_name, commit_number, commit, commit_short) = get_git_head_info()
|
||||||
contents = '''// Autogenerated by `xb premake`.
|
contents = '''// Autogenerated by `xb premake`.
|
||||||
#ifndef GENERATED_VERSION_H_
|
#ifndef GENERATED_VERSION_H_
|
||||||
#define GENERATED_VERSION_H_
|
#define GENERATED_VERSION_H_
|
||||||
#define XE_BUILD_BRANCH "%s"
|
#define XE_BUILD_BRANCH "%s"
|
||||||
|
#define XE_BUILD_COMMIT_NUMBER "%s"
|
||||||
#define XE_BUILD_COMMIT "%s"
|
#define XE_BUILD_COMMIT "%s"
|
||||||
#define XE_BUILD_COMMIT_SHORT "%s"
|
#define XE_BUILD_COMMIT_SHORT "%s"
|
||||||
#define XE_BUILD_DATE __DATE__
|
#define XE_BUILD_DATE __DATE__
|
||||||
#endif // GENERATED_VERSION_H_
|
#endif // GENERATED_VERSION_H_
|
||||||
''' % (branch_name, commit, commit_short)
|
''' % (branch_name, commit_number, commit, commit_short)
|
||||||
with open('build/version.h', 'w') as f:
|
with open('build/version.h', 'w') as f:
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue