From e4b4087fdbcfec65bb2e293e8615ffaf1209e117 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 18 Nov 2013 11:41:44 +0800 Subject: [PATCH] Create symbols zip file when creating distribution. --- atom.gyp | 2 +- script/create-dist.py | 30 ++++++++++++++++++++++++++++-- script/lib/util.py | 4 ++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/atom.gyp b/atom.gyp index 83b3627072..56275544bf 100644 --- a/atom.gyp +++ b/atom.gyp @@ -415,7 +415,7 @@ 'tools/mac/generate_breakpad_symbols.py', '--build-dir=<(PRODUCT_DIR)', '--binary=<(PRODUCT_DIR)/<(product_name).app/Contents/MacOS/<(product_name)', - '--symbols-dir=<(PRODUCT_DIR)/<(product_name).breakpad.syms', + '--symbols-dir=<(PRODUCT_DIR)/atom-shell.breakpad.syms', '--clear', '--jobs=16', ], diff --git a/script/create-dist.py b/script/create-dist.py index c2724d9f50..550f781c07 100755 --- a/script/create-dist.py +++ b/script/create-dist.py @@ -69,11 +69,13 @@ def main(): os.makedirs(DIST_DIR) force_build() + create_symbols() copy_binaries() copy_headers() copy_license() create_version() - create_zip() + create_dist_zip() + create_symbols_zip() create_header_tarball() @@ -131,7 +133,20 @@ def create_version(): version_file.write(ATOM_SHELL_VRESION) -def create_zip(): +def create_symbols(): + out_dir = os.path.join(SOURCE_ROOT, 'out', 'Release') + + build = os.path.join(SOURCE_ROOT, 'script', 'build.py') + subprocess.check_output([sys.executable, build, '-c', 'Release', + '-t', 'atom_dump_symbols']) + + directory = 'atom-shell.breakpad.syms' + shutil.copytree(os.path.join(out_dir, directory), + os.path.join(DIST_DIR, directory), + symlinks=True) + + +def create_dist_zip(): dist_name = 'atom-shell-{0}-{1}.zip'.format(ATOM_SHELL_VRESION, TARGET_PLATFORM) zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) @@ -142,6 +157,17 @@ def create_zip(): make_zip(zip_file, files, dirs) +def create_symbols_zip(): + dist_name = 'atom-shell-{0}-{1}-symbols.zip'.format(ATOM_SHELL_VRESION, + TARGET_PLATFORM) + zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name) + + with scoped_cwd(DIST_DIR): + files = ['LICENSE', 'version'] + dirs = ['atom-shell.breakpad.syms'] + make_zip(zip_file, files, dirs) + + def create_header_tarball(): with scoped_cwd(DIST_DIR): tarball = tarfile.open(name=DIST_HEADERS_DIR + '.tar.gz', mode='w:gz') diff --git a/script/lib/util.py b/script/lib/util.py index 7c890bf87c..8eefed3f9f 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -59,7 +59,7 @@ def extract_tarball(tarball_path, member, destination): def extract_zip(zip_path, destination): if sys.platform == 'darwin': # Use unzip command on Mac to keep symbol links in zip file work. - subprocess.check_call(['unzip', zip_path, '-d', destination]) + subprocess.check_output(['unzip', zip_path, '-d', destination]) else: with zipfile.ZipFile(zip_path) as z: z.extractall(destination) @@ -68,7 +68,7 @@ def make_zip(zip_file_path, files, dirs): safe_unlink(zip_file_path) if sys.platform == 'darwin': files += dirs - subprocess.check_call(['zip', '-r', '-y', zip_file_path] + files) + subprocess.check_output(['zip', '-r', '-y', zip_file_path] + files) else: zip_file = zipfile.ZipFile(zip_file_path, "w", zipfile.ZIP_DEFLATED) for filename in files: