Loading tools/warn/html_writer.py +4 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ from __future__ import print_function import csv import datetime import html import sys Loading Loading @@ -258,7 +259,7 @@ def emit_stats_by_project(writer, warn_patterns, project_names): def dump_stats(writer, warn_patterns): """Dump some stats about total number of warnings and such.""" """Dump some stats about total number of warnings and date.""" known = 0 skipped = 0 Loading @@ -279,6 +280,8 @@ def dump_stats(writer, warn_patterns): if total < 1000: extra_msg = ' (low count may indicate incremental build)' writer('Total number of warnings: <b>' + str(total) + '</b>' + extra_msg) date_time_str = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S') writer('<p>(generated on ' + date_time_str + ')') # New base table of warnings, [severity, warn_id, project, warning_message] Loading tools/warn/warn_common.py +23 −25 Original line number Diff line number Diff line Loading @@ -64,6 +64,10 @@ from . import other_warn_patterns as other_patterns from . import tidy_warn_patterns as tidy_patterns # Location of this file is used to guess the root of Android source tree. THIS_FILE_PATH = 'build/make/tools/warn/warn_common.py' def parse_args(use_google3): """Define and parse the args. Return the parse_args() result.""" parser = argparse.ArgumentParser( Loading Loading @@ -217,20 +221,22 @@ def generate_chrome_cs_link(warning_line, flags): return link def find_warn_py_and_android_root(path): """Return android source root path if warn.py is found.""" def find_this_file_and_android_root(path): """Return android source root path if this file is found.""" parts = path.split('/') for idx in reversed(range(2, len(parts))): root_path = '/'.join(parts[:idx]) # Android root directory should contain this script. if os.path.exists(root_path + '/build/make/tools/warn.py'): if os.path.exists(root_path + '/' + THIS_FILE_PATH): return root_path return '' def find_android_root_top_dirs(root_dir): """Return a list of directories under the root_dir, if it exists.""" if not os.path.isdir(root_dir): # Root directory should contain at least build/make and build/soong. if (not os.path.isdir(root_dir + '/build/make') or not os.path.isdir(root_dir + '/build/soong')): return None return list(filter(lambda d: os.path.isdir(root_dir + '/' + d), os.listdir(root_dir))) Loading @@ -257,7 +263,7 @@ def find_android_root(buildlog): # the source tree root. if count < 100: path = os.path.normpath(re.sub(':.*$', '', line)) android_root = find_warn_py_and_android_root(path) android_root = find_this_file_and_android_root(path) if android_root: return android_root, find_android_root_top_dirs(android_root) # Do not use common prefix of a small number of paths. Loading @@ -272,10 +278,11 @@ def find_android_root(buildlog): return android_root, find_android_root_top_dirs(android_root) # When the build.log file is moved to a different machine where # android_root is not found, use the location of this script # to find the android source tree root and its sub directories. # This __file__ is /..../build/make/tools/warn/warn_common.py script_root = __file__.replace('/build/make/tools/warn/warn_common.py', '') # to find the android source tree sub directories. if __file__.endswith('/' + THIS_FILE_PATH): script_root = __file__.replace('/' + THIS_FILE_PATH, '') return android_root, find_android_root_top_dirs(script_root) return android_root, None def remove_android_root_prefix(path, android_root): Loading Loading @@ -367,7 +374,6 @@ def parse_input_file_android(infile, flags): target_product = 'unknown' target_variant = 'unknown' build_id = 'unknown' use_rbe = False android_root, root_top_dirs = find_android_root(infile) infile.seek(0) Loading Loading @@ -443,8 +449,7 @@ def parse_input_file_android(infile, flags): continue checked_warning_lines[line] = True # Clean up extra prefix if RBE is used. if use_rbe: # Clean up extra prefix that could be introduced when RBE was used. if '/b/f/w/' in line: result = bfw_warning_pattern.search(line) else: Loading Loading @@ -479,13 +484,6 @@ def parse_input_file_android(infile, flags): if result is not None: build_id = result.group(0) continue result = re.search('(?<=^TOP=).*', line) if result is not None: android_root = result.group(1) continue if re.search('USE_RBE=', line) is not None: use_rbe = True continue if android_root: new_unique_warnings = dict() Loading Loading
tools/warn/html_writer.py +4 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ from __future__ import print_function import csv import datetime import html import sys Loading Loading @@ -258,7 +259,7 @@ def emit_stats_by_project(writer, warn_patterns, project_names): def dump_stats(writer, warn_patterns): """Dump some stats about total number of warnings and such.""" """Dump some stats about total number of warnings and date.""" known = 0 skipped = 0 Loading @@ -279,6 +280,8 @@ def dump_stats(writer, warn_patterns): if total < 1000: extra_msg = ' (low count may indicate incremental build)' writer('Total number of warnings: <b>' + str(total) + '</b>' + extra_msg) date_time_str = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S') writer('<p>(generated on ' + date_time_str + ')') # New base table of warnings, [severity, warn_id, project, warning_message] Loading
tools/warn/warn_common.py +23 −25 Original line number Diff line number Diff line Loading @@ -64,6 +64,10 @@ from . import other_warn_patterns as other_patterns from . import tidy_warn_patterns as tidy_patterns # Location of this file is used to guess the root of Android source tree. THIS_FILE_PATH = 'build/make/tools/warn/warn_common.py' def parse_args(use_google3): """Define and parse the args. Return the parse_args() result.""" parser = argparse.ArgumentParser( Loading Loading @@ -217,20 +221,22 @@ def generate_chrome_cs_link(warning_line, flags): return link def find_warn_py_and_android_root(path): """Return android source root path if warn.py is found.""" def find_this_file_and_android_root(path): """Return android source root path if this file is found.""" parts = path.split('/') for idx in reversed(range(2, len(parts))): root_path = '/'.join(parts[:idx]) # Android root directory should contain this script. if os.path.exists(root_path + '/build/make/tools/warn.py'): if os.path.exists(root_path + '/' + THIS_FILE_PATH): return root_path return '' def find_android_root_top_dirs(root_dir): """Return a list of directories under the root_dir, if it exists.""" if not os.path.isdir(root_dir): # Root directory should contain at least build/make and build/soong. if (not os.path.isdir(root_dir + '/build/make') or not os.path.isdir(root_dir + '/build/soong')): return None return list(filter(lambda d: os.path.isdir(root_dir + '/' + d), os.listdir(root_dir))) Loading @@ -257,7 +263,7 @@ def find_android_root(buildlog): # the source tree root. if count < 100: path = os.path.normpath(re.sub(':.*$', '', line)) android_root = find_warn_py_and_android_root(path) android_root = find_this_file_and_android_root(path) if android_root: return android_root, find_android_root_top_dirs(android_root) # Do not use common prefix of a small number of paths. Loading @@ -272,10 +278,11 @@ def find_android_root(buildlog): return android_root, find_android_root_top_dirs(android_root) # When the build.log file is moved to a different machine where # android_root is not found, use the location of this script # to find the android source tree root and its sub directories. # This __file__ is /..../build/make/tools/warn/warn_common.py script_root = __file__.replace('/build/make/tools/warn/warn_common.py', '') # to find the android source tree sub directories. if __file__.endswith('/' + THIS_FILE_PATH): script_root = __file__.replace('/' + THIS_FILE_PATH, '') return android_root, find_android_root_top_dirs(script_root) return android_root, None def remove_android_root_prefix(path, android_root): Loading Loading @@ -367,7 +374,6 @@ def parse_input_file_android(infile, flags): target_product = 'unknown' target_variant = 'unknown' build_id = 'unknown' use_rbe = False android_root, root_top_dirs = find_android_root(infile) infile.seek(0) Loading Loading @@ -443,8 +449,7 @@ def parse_input_file_android(infile, flags): continue checked_warning_lines[line] = True # Clean up extra prefix if RBE is used. if use_rbe: # Clean up extra prefix that could be introduced when RBE was used. if '/b/f/w/' in line: result = bfw_warning_pattern.search(line) else: Loading Loading @@ -479,13 +484,6 @@ def parse_input_file_android(infile, flags): if result is not None: build_id = result.group(0) continue result = re.search('(?<=^TOP=).*', line) if result is not None: android_root = result.group(1) continue if re.search('USE_RBE=', line) is not None: use_rbe = True continue if android_root: new_unique_warnings = dict() Loading