Create symbols zip file when creating distribution.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 18 Nov 2013 03:41:44 +0000 (11:41 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 18 Nov 2013 03:41:44 +0000 (11:41 +0800)
atom.gyp
script/create-dist.py
script/lib/util.py

index 83b3627..5627554 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
                 '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',
               ],
index c2724d9..550f781 100755 (executable)
@@ -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')
index 7c890bf..8eefed3 100644 (file)
@@ -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: