From e3a42b258edaab6de2df29cc2a97d683d490f5de Mon Sep 17 00:00:00 2001 From: Peter Wen Date: Wed, 8 Apr 2020 21:39:26 +0000 Subject: [PATCH] More detailed build-step type summary for android Increase the number of long times by extension to report from 5 to 10 since java build steps produce a number of different extension types. It is difficult to distinguish between android vs non-android builds, so increase this default for all platforms. Prioritize .jar outputs for java targets and allow up to two levels of extensions to be recognized. e.g. file.interface.jar would have .interface.jar as its full extension. file.javac.jar would have .javac.jar as its full extension. Some of these build steps require .jar outputs, which is why these targets use a secondary extension to differentiate. Example output: https://crrev.com/c/2142395 Bug: chromium:1067273 Change-Id: Id5780980f60841c3384d91bf96121c6dec3e8bed Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2142163 Reviewed-by: Bruce Dawson Reviewed-by: Edward Lesmes Commit-Queue: Bruce Dawson Commit-Queue: Peter Wen Auto-Submit: Peter Wen --- post_build_ninja_summary.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/post_build_ninja_summary.py b/post_build_ninja_summary.py index 5fd01d8e31..25c479778c 100644 --- a/post_build_ninja_summary.py +++ b/post_build_ninja_summary.py @@ -63,7 +63,7 @@ import sys # The number of long build times to report: long_count = 10 # The number of long times by extension to report -long_ext_count = 5 +long_ext_count = 10 class Target: @@ -179,20 +179,30 @@ def GetExtension(target, extra_patterns): if output.endswith('type_mappings'): extension = 'type_mappings' break - extension = os.path.splitext(output)[1] + + # Capture two extensions if present. For example: file.javac.jar should be + # distinguished from file.interface.jar. + root, ext1 = os.path.splitext(output) + _, ext2 = os.path.splitext(root) + extension = ext2 + ext1 # Preserve the order in the file name. + if len(extension) == 0: extension = '(no extension found)' - if extension in ['.pdb', '.dll', '.exe']: + + if ext1 in ['.pdb', '.dll', '.exe']: extension = 'PEFile (linking)' # Make sure that .dll and .exe are grouped together and that the # .dll.lib files don't cause these to be listed as libraries break - if extension in ['.so', '.TOC']: + if ext1 in ['.so', '.TOC']: extension = '.so (linking)' # Attempt to identify linking, avoid identifying as '.TOC' break # Make sure .obj files don't get categorized as mojo files - if extension in ['.obj', '.o']: + if ext1 in ['.obj', '.o']: + break + # Jars are the canonical output of java targets. + if ext1 == '.jar': break # Normalize all mojo related outputs to 'mojo'. if output.count('.mojom') > 0: