Commit 7bed2a5b by Jamie Madill Committed by Commit Bot

Capture commit position into Android Manifest.

Bug: b/168736059 Change-Id: I2ec1e284f0c51269a60f3b0e51036523258b501e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2425198 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent 65311748
...@@ -1163,6 +1163,14 @@ if (build_with_chromium && !is_component_build && is_android && ...@@ -1163,6 +1163,14 @@ if (build_with_chromium && !is_component_build && is_android &&
angle_apk("angle_chromium_apk") { angle_apk("angle_chromium_apk") {
package_name = "org.chromium.angle" package_name = "org.chromium.angle"
apk_name = "AngleLibraries" apk_name = "AngleLibraries"
version_name = "ANGLE Developer Build"
if (angle_enable_commit_id) {
version_code =
exec_script("src/commit_id.py", [ "position" ], "trim string")
} else {
version_code = "0"
}
} }
group("angle_apks") { group("angle_apks") {
......
...@@ -38,6 +38,8 @@ if (enable_java_templates) { ...@@ -38,6 +38,8 @@ if (enable_java_templates) {
forward_variables_from(invoker, "*") forward_variables_from(invoker, "*")
android_manifest = manifest_path android_manifest = manifest_path
android_manifest_dep = ":$manifest_target_name" android_manifest_dep = ":$manifest_target_name"
version_code = invoker.version_code
version_name = invoker.version_name
min_sdk_version = 26 min_sdk_version = 26
target_sdk_version = 28 target_sdk_version = 28
deps = [ ":${invoker.package_name}_assets" ] deps = [ ":${invoker.package_name}_assets" ]
......
...@@ -12,6 +12,7 @@ import os ...@@ -12,6 +12,7 @@ import os
usage = """\ usage = """\
Usage: commit_id.py check - check if git is present Usage: commit_id.py check - check if git is present
commit_id.py position - print commit position
commit_id.py gen <file_to_write> - generate commit.h""" commit_id.py gen <file_to_write> - generate commit.h"""
...@@ -19,6 +20,10 @@ def grab_output(command, cwd): ...@@ -19,6 +20,10 @@ def grab_output(command, cwd):
return sp.Popen(command, stdout=sp.PIPE, shell=True, cwd=cwd).communicate()[0].strip() return sp.Popen(command, stdout=sp.PIPE, shell=True, cwd=cwd).communicate()[0].strip()
def get_commit_position(cwd):
return grab_output('git rev-list HEAD --count', cwd)
if len(sys.argv) < 2: if len(sys.argv) < 2:
sys.exit(usage) sys.exit(usage)
...@@ -35,6 +40,12 @@ if operation == 'check': ...@@ -35,6 +40,12 @@ if operation == 'check':
else: else:
print("0") print("0")
sys.exit(0) sys.exit(0)
elif operation == 'position':
if git_dir_exists:
print(get_commit_position(cwd))
else:
print("0")
sys.exit(0)
if len(sys.argv) < 3 or operation != 'gen': if len(sys.argv) < 3 or operation != 'gen':
sys.exit(usage) sys.exit(usage)
...@@ -50,7 +61,7 @@ if git_dir_exists: ...@@ -50,7 +61,7 @@ if git_dir_exists:
try: try:
commit_id = grab_output('git rev-parse --short=%d HEAD' % commit_id_size, cwd) commit_id = grab_output('git rev-parse --short=%d HEAD' % commit_id_size, cwd)
commit_date = grab_output('git show -s --format=%ci HEAD', cwd) commit_date = grab_output('git show -s --format=%ci HEAD', cwd)
commit_position = grab_output('git rev-list HEAD --count', cwd) commit_position = get_commit_position(cwd)
enable_binary_loading = True enable_binary_loading = True
except: except:
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment