Add trichrome support to resource_sizes.gni

Support recently added to resource_sizes.py in
6d51b2eeccee83f704ed67848ab1347b62ab61d8

Bug: 1059928
Change-Id: I2bdcdd4a1c4f3b4ad3517443363b3a40383dc6bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2111787
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#752035}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: eafa4774889a5ac2c7eacd85d06c1ba8c18368cd
This commit is contained in:
Andrew Grieve 2020-03-20 15:48:17 +00:00 коммит произвёл Commit Bot
Родитель 7e32f3d235
Коммит 7f23cdf774
1 изменённых файлов: 41 добавлений и 17 удалений

Просмотреть файл

@ -12,36 +12,60 @@ import("//build/config/android/internal_rules.gni")
# Variables:
# apk_name: The name of the apk, without the extension.
# file_path: The path to the apk or .minimal.apks.
# trichrome_chrome_path: The path to chrome apk or .minimal.apks.
# trichrome_webview_path: The path to webview apk or .minimal.apks.
# trichrome_library_path: The path to library apk or .minimal.apks.
template("android_resource_sizes_test") {
generate_android_wrapper(target_name) {
forward_variables_from(invoker, [ "data_deps" ])
executable = "//build/android/resource_sizes.py"
wrapper_script = "$root_out_dir/bin/${target_name}"
assert(defined(invoker.apk_name) != defined(invoker.file_path),
"Exactly one of apk_name or file_path should be provided.")
data_deps = [ "//build/android:resource_sizes_py" ]
if (defined(invoker.data_deps)) {
data_deps += invoker.data_deps
}
data = []
if (defined(invoker.apk_name)) {
_file_path = "$root_out_dir/apks/${invoker.apk_name}.apk"
data += [ "$root_out_dir/arsc/apks/${invoker.apk_name}.ap_" ]
} else if (defined(invoker.file_path)) {
_file_path = invoker.file_path
}
_rebased_file_path = rebase_path(_file_path, root_build_dir)
data += [ _file_path ]
deps = [ "//build/android:resource_sizes_py" ]
executable_args = [
"--output-format",
"histograms",
"@WrappedPath(${_rebased_file_path})",
"--chromium-output-directory",
"@WrappedPath(.)",
]
data = []
if (defined(invoker.trichrome_chrome_path)) {
data += [
invoker.trichrome_chrome_path,
invoker.trichrome_webview_path,
invoker.trichrome_library_path,
]
_rebased_chrome =
rebase_path(invoker.trichrome_chrome_path, root_build_dir)
_rebased_webview =
rebase_path(invoker.trichrome_webview_path, root_build_dir)
_rebased_library =
rebase_path(invoker.trichrome_library_path, root_build_dir)
# apk_name used only as test suite name. Not a path in this case.
executable_args += [
"--trichrome-chrome",
"@WrappedPath(${_rebased_chrome})",
"--trichrome-webview",
"@WrappedPath(${_rebased_webview})",
"--trichrome-library",
"@WrappedPath(${_rebased_library})",
"${invoker.apk_name}",
]
} else {
if (defined(invoker.apk_name)) {
_file_path = "$root_out_dir/apks/${invoker.apk_name}.apk"
data += [ "$root_out_dir/arsc/apks/${invoker.apk_name}.ap_" ]
} else if (defined(invoker.file_path)) {
_file_path = invoker.file_path
}
data += [ _file_path ]
_rebased_file_path = rebase_path(_file_path, root_build_dir)
executable_args += [ "@WrappedPath(${_rebased_file_path})" ]
}
}
}