[build] Slim down official archive and support different archive types

This drops v8_hello_world, v8_parser_shell and v8_sample_process from the
official v8 archives.

This also adds a new option to differentiate library and executable
archives.

NOTRY=true
TBR=marja@chromium.org

Bug: v8:5918
Change-Id: I946708f2eeb030296c5ce284541ecf719522186c
Reviewed-on: https://chromium-review.googlesource.com/554753
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46312}
This commit is contained in:
Michael Achenbach 2017-06-29 10:37:05 +02:00 committed by Commit Bot
parent adf7f54e24
commit ccb5a1d342
2 changed files with 18 additions and 10 deletions

View File

@ -2675,9 +2675,6 @@ group("v8_clusterfuzz") {
group("v8_archive") {
deps = [
":d8",
":v8_hello_world",
":v8_parser_shell",
":v8_sample_process",
]
}

View File

@ -23,9 +23,6 @@ import sys
EXECUTABLE_FILES = [
'd8',
'v8_hello_world',
'v8_parser_shell',
'v8_sample_process',
]
SUPPLEMENTARY_FILES = [
@ -52,6 +49,9 @@ def main(argv):
parser.add_argument('-o', '--json-output', required=True,
help='Path to an output file. The files will '
'be stored in json list with absolute paths.')
parser.add_argument('-t', '--type',
choices=['all', 'exe', 'lib'], default='all',
help='Specifies the archive type.')
args = parser.parse_args()
if not os.path.isdir(args.dir):
@ -59,6 +59,18 @@ def main(argv):
args.dir = os.path.abspath(args.dir)
# Skip libraries for exe archive type.
if args.type == 'exe':
library_files = []
else:
library_files = LIBRARY_FILES[args.platform]
# Skip executables for lib archive type.
if args.type == 'lib':
executable_files = []
else:
executable_files = EXECUTABLE_FILES
list_of_files = []
def add_files_from_globs(globs):
list_of_files.extend(itertools.chain(*map(glob.iglob, globs)))
@ -66,18 +78,17 @@ def main(argv):
# Add toplevel executables, supplementary files and libraries.
extended_executable_files = [
f + '.exe' if args.platform == 'win' else f
for f in EXECUTABLE_FILES]
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]
library_files
)
# 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])
add_files_from_globs(os.path.join(root, g) for g in library_files)
with open(args.json_output, 'w') as f:
json.dump(list_of_files, f)