Reland "[build] Add filter script for official build"
This is a reland of 54b42a55e7
Original change's description:
> [build] Add filter script for official build
>
> This adds a V8-side script to list the files contained in an official archive.
>
> This'll accompany the infra-side archive recipe:
> https://chromium-review.googlesource.com/c/544298/
>
> Keeping this script on the V8-side will make it easy to change the
> archived build product.
>
> NOTRY=true
>
> Bug: v8:5918
> Change-Id: I9fcb2eae183a26e7ce11c839d95a583a049cbe75
> Reviewed-on: https://chromium-review.googlesource.com/544877
> Commit-Queue: Michael Achenbach <machenbach@chromium.org>
> Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#46135}
TBR=vogelheim@chromium.org
NOTRY=true
Bug: v8:5918
Change-Id: I87b58c78a2cbd97f4da37ac93fe1e8ee77bf5ca0
Reviewed-on: https://chromium-review.googlesource.com/544979
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46138}
This commit is contained in:
parent
d599de6565
commit
e3e0b6f46b
9
BUILD.gn
9
BUILD.gn
@ -2774,6 +2774,15 @@ group("v8_clusterfuzz") {
|
||||
}
|
||||
}
|
||||
|
||||
group("v8_archive") {
|
||||
deps = [
|
||||
":d8",
|
||||
":v8_hello_world",
|
||||
":v8_parser_shell",
|
||||
":v8_sample_process",
|
||||
]
|
||||
}
|
||||
|
||||
group("v8_fuzzers") {
|
||||
testonly = true
|
||||
deps = [
|
||||
|
79
tools/release/filter_build_files.py
Executable file
79
tools/release/filter_build_files.py
Executable file
@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2017 the V8 project authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Enumerates relevant build files for each platform.
|
||||
|
||||
This can be used to filter the build directory before making an official
|
||||
archive. The archive should only contain files required for running or
|
||||
static linking, e.g. executables, startup files, libraries.
|
||||
|
||||
The script is limited to release builds and assumes GN.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import itertools
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
EXECUTABLES = [
|
||||
'd8',
|
||||
'v8_hello_world',
|
||||
'v8_parser_shell',
|
||||
'v8_sample_process',
|
||||
'v8_shell',
|
||||
]
|
||||
|
||||
SUPPLEMENTARY_FILES = [
|
||||
'icudtl.dat',
|
||||
'natives_blob.bin',
|
||||
'snapshot_blob.bin',
|
||||
'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'],
|
||||
}
|
||||
|
||||
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
|
||||
parser.add_argument('-d', '--dir', required=True,
|
||||
help='Path to the build directory.')
|
||||
parser.add_argument('-p', '--platform', required=True,
|
||||
help='Target platform name: win|mac|linux.')
|
||||
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.')
|
||||
args = parser.parse_args()
|
||||
|
||||
if not os.path.isdir(args.dir):
|
||||
parser.error('%s is not an existing directory.' % args.dir)
|
||||
|
||||
args.dir = os.path.abspath(args.dir)
|
||||
|
||||
extended_executables = [
|
||||
f + '.exe' if args.platform == 'win' else f
|
||||
for f in EXECUTABLES]
|
||||
|
||||
all_globs = [
|
||||
os.path.join(args.dir, f)
|
||||
for f in extended_executables + SUPPLEMENTARY_FILES + LIBS[args.platform]
|
||||
]
|
||||
|
||||
with open(args.json_output, 'w') as f:
|
||||
json.dump(list(itertools.chain(*map(glob.iglob, all_globs))), f)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
Loading…
Reference in New Issue
Block a user