From c535258aab09f9809bf6e8a42d3913147e9a92fa Mon Sep 17 00:00:00 2001 From: Michael Achenbach Date: Fri, 23 Jun 2017 11:12:09 +0200 Subject: [PATCH] [build] Fix filter script for official build This also adds libraries recursively under the obj dir. Dropping v8_shell from globs since it's not included in the targets. NOTRY=true Bug: v8:5918 Change-Id: Ibfadb60dd7b347cf4a742f07e8b110c70e67cb06 Reviewed-on: https://chromium-review.googlesource.com/544308 Commit-Queue: Michael Achenbach Reviewed-by: Daniel Vogelheim Cr-Commit-Position: refs/heads/master@{#46161} --- tools/release/filter_build_files.py | 38 ++++++++++++++++++----------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/tools/release/filter_build_files.py b/tools/release/filter_build_files.py index 09344c64df..05d85cda25 100755 --- a/tools/release/filter_build_files.py +++ b/tools/release/filter_build_files.py @@ -21,12 +21,11 @@ import os import re import sys -EXECUTABLES = [ +EXECUTABLE_FILES = [ 'd8', 'v8_hello_world', 'v8_parser_shell', 'v8_sample_process', - 'v8_shell', ] SUPPLEMENTARY_FILES = [ @@ -36,10 +35,10 @@ SUPPLEMENTARY_FILES = [ 'v8_build_config.json', ] -LIBS = { - 'linux': ['*.a', '*.so', 'obj/*.a', 'obj/*.so'], - 'mac': ['*.a', '*.so', 'obj/*.a', 'obj/*.so'], - 'win': ['*.lib', '*.dll', 'obj\\*.a', 'obj\\*.so'], +LIBRARY_FILES = { + 'linux': ['*.a', '*.so'], + 'mac': ['*.a', '*.so'], + 'win': ['*.lib', '*.dll'], } @@ -60,17 +59,28 @@ def main(argv): args.dir = os.path.abspath(args.dir) - extended_executables = [ - f + '.exe' if args.platform == 'win' else f - for f in EXECUTABLES] + list_of_files = [] + def add_files_from_globs(globs): + list_of_files.extend(itertools.chain(*map(glob.iglob, globs))) - all_globs = [ - os.path.join(args.dir, f) - for f in extended_executables + SUPPLEMENTARY_FILES + LIBS[args.platform] - ] + # Add toplevel executables, supplementary files and libraries. + extended_executable_files = [ + f + '.exe' if args.platform == 'win' else f + for f in EXECUTABLE_FILES] + add_files_from_globs( + os.path.join(args.dir, f) + for f in extended_executable_files + + SUPPLEMENTARY_FILES + + LIBRARY_FILES[args.platform] + ) + + # Add libraries recursively from obj directory. + for root, _, __ in os.walk(os.path.join(args.dir, 'obj'), followlinks=True): + add_files_from_globs( + os.path.join(root, g) for g in LIBRARY_FILES[args.platform]) with open(args.json_output, 'w') as f: - json.dump(list(itertools.chain(*map(glob.iglob, all_globs))), f) + json.dump(list_of_files, f) return 0