Commit 4674f955 authored by Peter Wen's avatar Peter Wen Committed by Chromium LUCI CQ

Android: Remove md5_check for compile_resources.py

The invocation to md5_check was complex and it is easy to miss an arg.
Since compile_resources is using transitive assetres deps instead of
depending on the actual java targets, it is no longer on the critical
path and no longer needs md5_check. See below for benchmark stats.

Before (r845557):
gn args: target_os="android" use_goma=true android_fast_local_dev=true
gn gen: 7.0s
chrome_java_nosig: 34.3s avg (34.6s, 33.7s, 34.7s, 34.1s)
chrome_java_sig: 35.4s avg (35.1s, 35.4s, 35.0s, 36.2s)
chrome_java_res: 38.6s avg (38.7s, 38.6s, 38.5s, 38.7s)
base_java_nosig: 42.9s avg (42.7s, 42.9s, 43.1s, 43.1s)
base_java_sig: 106.5s avg (107.0s, 106.8s, 105.8s, 106.5s)

After:
gn args: target_os="android" use_goma=true android_fast_local_dev=true
gn gen: 6.7s
chrome_java_nosig: 33.6s avg (33.3s, 33.9s)
chrome_java_sig: 34.8s avg (34.1s, 35.5s)
chrome_java_res: 38.9s avg (38.5s, 39.3s)
base_java_nosig: 43.3s avg (43.0s, 43.6s)
base_java_sig: 106.7s avg (106.0s, 107.5s)

Bug: 1066943
Change-Id: I538a2c15ee07cf0beec23b2e0885c84b964273c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2643120
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: default avatarMohamed Heikal <mheikal@chromium.org>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#846131}
parent 61d27c82
......@@ -1065,7 +1065,17 @@ def _CreateNormalizedManifestForVerification(options):
return manifest_utils.NormalizeManifest(f.read())
def _OnStaleMd5(options):
def main(args):
build_utils.InitLogging('RESOURCE_DEBUG')
args = build_utils.ExpandFileArgs(args)
options = _ParseArgs(args)
if options.expected_file:
actual_data = _CreateNormalizedManifestForVerification(options)
diff_utils.CheckExpectations(actual_data, options)
if options.only_verify_expectations:
return
path = options.arsc_path or options.proto_path
debug_temp_resources_dir = os.environ.get('TEMP_RESOURCES_DIR')
if debug_temp_resources_dir:
......@@ -1152,89 +1162,11 @@ def _OnStaleMd5(options):
logging.debug('Copying outputs')
_WriteOutputs(options, build)
def main(args):
build_utils.InitLogging('RESOURCE_DEBUG')
args = build_utils.ExpandFileArgs(args)
options = _ParseArgs(args)
if options.expected_file:
actual_data = _CreateNormalizedManifestForVerification(options)
diff_utils.CheckExpectations(actual_data, options)
if options.only_verify_expectations:
return
depfile_deps = (options.dependencies_res_zips +
options.dependencies_res_zip_overlays +
options.extra_main_r_text_files + options.include_resources)
possible_input_paths = depfile_deps + options.resources_config_paths + [
options.aapt2_path,
options.android_manifest,
options.expected_file,
options.expected_file_base,
options.shared_resources_allowlist,
options.use_resource_ids_path,
options.webp_binary,
]
input_paths = [p for p in possible_input_paths if p]
input_strings = [
options.app_as_shared_lib,
options.arsc_package_name,
options.debuggable,
options.extra_res_packages,
options.failure_file,
options.include_resources,
options.locale_allowlist,
options.manifest_package,
options.max_sdk_version,
options.min_sdk_version,
options.no_xml_namespaces,
options.package_id,
options.package_name,
options.png_to_webp,
options.rename_manifest_package,
options.resource_exclusion_exceptions,
options.resource_exclusion_regex,
options.r_java_root_package_name,
options.shared_resources,
options.shared_resources_allowlist_locales,
options.short_resource_paths,
options.strip_resource_names,
options.support_zh_hk,
options.target_sdk_version,
options.values_filter_rules,
options.version_code,
options.version_name,
options.webp_cache_dir,
]
output_paths = [options.srcjar_out]
possible_output_paths = [
options.actual_file,
options.arsc_path,
options.emit_ids_out,
options.info_path,
options.optimized_arsc_path,
options.optimized_proto_path,
options.proguard_file,
options.proguard_file_main_dex,
options.proto_path,
options.resources_path_map_out_path,
options.r_text_out,
]
output_paths += [p for p in possible_output_paths if p]
# Since we overspecify deps, this target depends on java deps that are not
# going to change its output. This target is also slow (6-12 seconds) and
# blocking the critical path. We want changes to java_library targets to not
# trigger re-compilation of resources, thus we need to use md5_check.
md5_check.CallAndWriteDepfileIfStale(
lambda: _OnStaleMd5(options),
options,
input_paths=input_paths,
input_strings=input_strings,
output_paths=output_paths,
depfile_deps=depfile_deps)
if options.depfile:
depfile_deps = (options.dependencies_res_zips +
options.dependencies_res_zip_overlays +
options.extra_main_r_text_files + options.include_resources)
build_utils.WriteDepfile(options.depfile, options.srcjar_out, depfile_deps)
if __name__ == '__main__':
......
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