2022-04-12 11:21:55 +00:00
|
|
|
#!/usr/bin/env python3
|
2018-09-28 14:10:42 +00:00
|
|
|
|
2018-10-13 02:02:52 +00:00
|
|
|
import argparse
|
2018-09-27 05:38:06 +00:00
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from lib.config import PLATFORM, get_target_arch
|
|
|
|
from lib.util import scoped_cwd, get_electron_version, make_zip, \
|
2021-04-26 20:00:50 +00:00
|
|
|
get_electron_branding, get_out_dir, execute
|
2018-09-27 05:38:06 +00:00
|
|
|
|
|
|
|
ELECTRON_VERSION = get_electron_version()
|
2018-09-28 06:48:09 +00:00
|
|
|
PROJECT_NAME = get_electron_branding()['project_name']
|
2018-09-27 05:38:06 +00:00
|
|
|
OUT_DIR = get_out_dir()
|
|
|
|
|
|
|
|
def main():
|
2018-10-10 00:04:55 +00:00
|
|
|
print('Zipping Symbols')
|
2018-09-27 05:38:06 +00:00
|
|
|
|
2018-10-13 02:02:52 +00:00
|
|
|
args = parse_args()
|
2018-09-27 05:38:06 +00:00
|
|
|
dist_name = 'symbols.zip'
|
2018-10-13 02:02:52 +00:00
|
|
|
zip_file = os.path.join(args.build_dir, dist_name)
|
2018-09-27 05:38:06 +00:00
|
|
|
licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']
|
|
|
|
|
2018-10-13 02:02:52 +00:00
|
|
|
with scoped_cwd(args.build_dir):
|
2018-11-14 20:47:01 +00:00
|
|
|
dirs = ['breakpad_symbols']
|
2018-10-10 00:04:55 +00:00
|
|
|
print('Making symbol zip: ' + zip_file)
|
2018-09-27 05:38:06 +00:00
|
|
|
make_zip(zip_file, licenses, dirs)
|
|
|
|
|
|
|
|
if PLATFORM == 'darwin':
|
|
|
|
dsym_name = 'dsym.zip'
|
2018-10-13 02:02:52 +00:00
|
|
|
with scoped_cwd(args.build_dir):
|
2018-09-27 05:38:06 +00:00
|
|
|
dsyms = glob.glob('*.dSYM')
|
2022-03-07 23:47:58 +00:00
|
|
|
snapshot_dsyms = ['v8_context_snapshot_generator.dSYM']
|
|
|
|
for dsym in snapshot_dsyms:
|
|
|
|
if (dsym in dsyms):
|
|
|
|
dsyms.remove(dsym)
|
2018-10-13 02:02:52 +00:00
|
|
|
dsym_zip_file = os.path.join(args.build_dir, dsym_name)
|
2018-10-10 00:04:55 +00:00
|
|
|
print('Making dsym zip: ' + dsym_zip_file)
|
|
|
|
make_zip(dsym_zip_file, licenses, dsyms)
|
2022-03-07 23:47:58 +00:00
|
|
|
dsym_snapshot_name = 'dsym-snapshot.zip'
|
|
|
|
dsym_snapshot_zip_file = os.path.join(args.build_dir, dsym_snapshot_name)
|
|
|
|
print('Making dsym snapshot zip: ' + dsym_snapshot_zip_file)
|
|
|
|
make_zip(dsym_snapshot_zip_file, licenses, snapshot_dsyms)
|
2021-04-26 18:04:44 +00:00
|
|
|
if len(dsyms) > 0 and 'DELETE_DSYMS_AFTER_ZIP' in os.environ:
|
|
|
|
execute(['rm', '-rf'] + dsyms)
|
2018-09-27 05:38:06 +00:00
|
|
|
elif PLATFORM == 'win32':
|
|
|
|
pdb_name = 'pdb.zip'
|
2018-10-13 02:02:52 +00:00
|
|
|
with scoped_cwd(args.build_dir):
|
2018-09-27 05:38:06 +00:00
|
|
|
pdbs = glob.glob('*.pdb')
|
2018-10-13 02:02:52 +00:00
|
|
|
pdb_zip_file = os.path.join(args.build_dir, pdb_name)
|
2018-10-10 00:04:55 +00:00
|
|
|
print('Making pdb zip: ' + pdb_zip_file)
|
|
|
|
make_zip(pdb_zip_file, pdbs + licenses, [])
|
2019-11-21 01:21:44 +00:00
|
|
|
elif PLATFORM == 'linux':
|
|
|
|
debug_name = 'debug.zip'
|
|
|
|
with scoped_cwd(args.build_dir):
|
|
|
|
dirs = ['debug']
|
|
|
|
debug_zip_file = os.path.join(args.build_dir, debug_name)
|
|
|
|
print('Making debug zip: ' + debug_zip_file)
|
|
|
|
make_zip(debug_zip_file, licenses, dirs)
|
2018-09-27 05:38:06 +00:00
|
|
|
|
2018-10-13 02:02:52 +00:00
|
|
|
def parse_args():
|
|
|
|
parser = argparse.ArgumentParser(description='Zip symbols')
|
|
|
|
parser.add_argument('-b', '--build-dir',
|
|
|
|
help='Path to an Electron build folder.',
|
|
|
|
default=OUT_DIR,
|
|
|
|
required=False)
|
|
|
|
return parser.parse_args()
|
|
|
|
|
2018-09-27 05:38:06 +00:00
|
|
|
if __name__ == '__main__':
|
2018-10-13 02:02:52 +00:00
|
|
|
sys.exit(main())
|