From e186e50d0b6e3ca4b76eb94d87c982b92173c528 Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Mon, 12 Feb 2018 15:41:11 -0800 Subject: [PATCH] Update post_build_ninja_summary.py for Linux post_build_ninja_summary.py gives a summary of a ninja build. It can be run standalone or it can be run automatically by autoninja. This CL updates the Python script and the autoninja bash script to make this work on Linux. This includes removing a zero-value assert, and ensuring that .so files get categorized as such. Change-Id: I2d59ab129f5ce70117beeb119719f8432bfbab7c Reviewed-on: https://chromium-review.googlesource.com/915053 Reviewed-by: Dirk Pranke Commit-Queue: Bruce Dawson --- autoninja | 6 +++++- post_build_ninja_summary.py | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/autoninja b/autoninja index 059ec73030..9e64c30bcd 100755 --- a/autoninja +++ b/autoninja @@ -9,4 +9,8 @@ # Also print it to reassure that the right settings are being used. command=$(python $(dirname -- "$0")/autoninja.py "$@") echo $command -exec $command +$command +if [ $? -eq 0 ] && [ "$NINJA_SUMMARIZE_BUILD" == "1" ]; then + python $(dirname -- "$0")/post_build_ninja_summary.py $@ +fi + diff --git a/post_build_ninja_summary.py b/post_build_ninja_summary.py index ecd973ccdd..4fc7344804 100644 --- a/post_build_ninja_summary.py +++ b/post_build_ninja_summary.py @@ -7,7 +7,11 @@ This script is designed to be automatically run after each ninja build in order to summarize the build's performance. Making build performance information more visible should make it easier to notice anomalies and opportunities. To use -this script just set NINJA_SUMMARIZE_BUILD=1 and run autoninja.bat. +this script on Windows just set NINJA_SUMMARIZE_BUILD=1 and run autoninja.bat. + +On Linux you can get autoninja to invoke this script using this syntax: + +$ NINJA_SUMMARIZE_BUILD=1 autoninja -C out/Default/ chrome You can also call this script directly using ninja's syntax to specify the output directory of interest: @@ -159,13 +163,15 @@ def GetExtension(target): extension = os.path.splitext(output)[1] if len(extension) == 0: extension = '(no extension found)' - # AHEM____.TTF fails this check. - assert(extension == extension.lower() or extension == '.TTF') if extension 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']: + extension = '.so (linking)' + # Attempt to identify linking, avoid identifying as '.TOC' + break return extension