]> khamidou — GitHub mirrors - electron.git/commitdiff
Separate symbols generation from building
authorCheng Zhao <zcbenz@gmail.com>
Wed, 8 Apr 2015 14:12:47 +0000 (22:12 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 8 Apr 2015 14:12:47 +0000 (22:12 +0800)
atom.gyp
script/create-dist.py
script/dump-symbols.py [new file with mode: 0755]
tools/posix/generate_breakpad_symbols.py

index 029b8131819f324aeed55df46512bce7e1e5b0ec..6a81a9b2f541fb04efe762fbf67aafc2af89970e 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
         }
       ],
     },  # target atom_coffee2c
-    {
-      'target_name': '<(project_name)_dump_symbols',
-      'type': 'none',
-      'dependencies': [
-        '<(project_name)',
-      ],
-      'conditions': [
-        ['OS=="mac"', {
-          'dependencies': [
-            'vendor/breakpad/breakpad.gyp:dump_syms',
-          ],
-          'actions': [
-            {
-              'action_name': 'Dump Symbols',
-              'inputs': [
-                '<(PRODUCT_DIR)/<(product_name).app/Contents/MacOS/<(product_name)',
-              ],
-              'outputs': [
-                '<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
-              ],
-              'action': [
-                'python',
-                'tools/posix/generate_breakpad_symbols.py',
-                '--build-dir=<(PRODUCT_DIR)',
-                '--binary=<(PRODUCT_DIR)/<(product_name).app/Contents/MacOS/<(product_name)',
-                '--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
-                '--libchromiumcontent-dir=<(libchromiumcontent_dir)',
-                '--clear',
-                '--jobs=16',
-              ],
-            },
-          ],
-        }],  # OS=="mac"
-        ['OS=="win"', {
-          'actions': [
-            {
-              'action_name': 'Dump Symbols',
-              'inputs': [
-                '<(PRODUCT_DIR)/<(project_name).exe',
-              ],
-              'outputs': [
-                '<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
-              ],
-              'action': [
-                'python',
-                'tools/win/generate_breakpad_symbols.py',
-                '--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
-                '--jobs=16',
-                '<(PRODUCT_DIR)',
-                '<(libchromiumcontent_dir)',
-              ],
-            },
-          ],
-        }],  # OS=="win"
-        ['OS=="linux"', {
-          'dependencies': [
-            'vendor/breakpad/breakpad.gyp:dump_syms',
-          ],
-          'actions': [
-            {
-              'action_name': 'Dump Symbols',
-              'inputs': [
-                '<(PRODUCT_DIR)/<(project_name)',
-              ],
-              'outputs': [
-                '<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
-              ],
-              'action': [
-                'python',
-                'tools/posix/generate_breakpad_symbols.py',
-                '--build-dir=<(PRODUCT_DIR)',
-                '--binary=<(PRODUCT_DIR)/<(project_name)',
-                '--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
-                '--libchromiumcontent-dir=<(libchromiumcontent_dir)',
-                '--clear',
-                '--jobs=16',
-              ],
-            },
-            {
-              'action_name': 'Strip Binary',
-              'inputs': [
-                '<(PRODUCT_DIR)/libffmpegsumo.so',
-                '<(PRODUCT_DIR)/<(project_name)',
-                # Add the syms folder as input would force this action to run
-                # after the 'Dump Symbols' action. And since it is a folder,
-                # it would be ignored by the 'strip' command.
-                '<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
-              ],
-              'outputs': [
-                # Gyp action requires a output file, add a fake one here.
-                '<(PRODUCT_DIR)/dummy_file',
-              ],
-              'action': [
-                'tools/posix/strip.sh',
-                '<@(_inputs)',
-              ],
-            },
-          ],
-        }],  # OS=="linux"
-      ],
-    },  # target <(project_name>_dump_symbols
   ],
   'conditions': [
     ['OS=="mac"', {
index a66795f42696c95602297a20bbb641e95755e247..59e4a28a3a2eaf2af17e41a2147cd46b4e7bace0 100755 (executable)
@@ -21,12 +21,6 @@ OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
 CHROMIUM_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor',
                             'download', 'libchromiumcontent', 'static_library')
 
-SYMBOL_NAME = {
-  'darwin': 'libchromiumcontent.dylib.dSYM',
-  'linux': 'libchromiumcontent.so.dbg',
-  'win32': 'chromiumcontent.dll.pdb',
-}[TARGET_PLATFORM]
-
 TARGET_BINARIES = {
   'darwin': [
   ],
@@ -157,16 +151,9 @@ def create_version():
 
 
 def create_symbols():
-  directory = 'Atom-Shell.breakpad.syms'
-  rm_rf(os.path.join(OUT_DIR, directory))
-
-  build = os.path.join(SOURCE_ROOT, 'script', 'build.py')
-  subprocess.check_output([sys.executable, build, '-c', 'Release',
-                           '-t', 'atom_dump_symbols'])
-
-  shutil.copytree(os.path.join(OUT_DIR, directory),
-                  os.path.join(DIST_DIR, directory),
-                  symlinks=True)
+  destination = os.path.join(DIST_DIR, 'Atom-Shell.breakpad.syms')
+  dump_symbols = os.path.join(SOURCE_ROOT, 'script', 'dump-symbols.py')
+  execute([sys.executable, dump_symbols, destination])
 
 
 def create_dist_zip():
diff --git a/script/dump-symbols.py b/script/dump-symbols.py
new file mode 100755 (executable)
index 0000000..e8df27f
--- /dev/null
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+import os
+import sys
+
+from lib.config import TARGET_PLATFORM
+from lib.util import execute, rm_rf
+
+
+SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
+DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
+OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
+CHROMIUM_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor',
+                            'download', 'libchromiumcontent', 'static_library')
+
+
+def main(destination):
+  rm_rf(destination)
+  (project_name, product_name) = get_names_from_gyp()
+
+  if TARGET_PLATFORM in ['darwin', 'linux']:
+    # Generate the dump_syms tool.
+    build = os.path.join(SOURCE_ROOT, 'script', 'build.py')
+    execute([sys.executable, build, '-c', 'R', '-t', 'dump_syms'])
+
+    generate_breakpad_symbols = os.path.join(SOURCE_ROOT, 'tools', 'posix',
+                                             'generate_breakpad_symbols.py')
+    if TARGET_PLATFORM == 'darwin':
+      start = os.path.join(OUT_DIR, '{0}.app'.format(product_name), 'Contents',
+                           'MacOS', product_name)
+    else:
+      start = os.path.join(OUT_DIR, project_name)
+    args = [
+      '--build-dir={0}'.format(OUT_DIR),
+      '--binary={0}'.format(start),
+      '--symbols-dir={0}'.format(destination),
+      '--libchromiumcontent-dir={0}'.format(CHROMIUM_DIR),
+      '--clear',
+      '--jobs=16',
+    ]
+  else:
+    generate_breakpad_symbols = os.path.join(SOURCE_ROOT, 'tools', 'win',
+                                             'generate_breakpad_symbols.py')
+    args = [
+      '--symbols-dir={0}'.format(destination),
+      '--jobs=16',
+      OUT_DIR,
+      CHROMIUM_DIR,
+    ]
+
+  execute([sys.executable, generate_breakpad_symbols] + args)
+
+
+def get_names_from_gyp():
+  gyp = os.path.join(SOURCE_ROOT, 'atom.gyp')
+  with open(gyp) as f:
+    o = eval(f.read());
+    return (o['variables']['project_name%'], o['variables']['product_name%'])
+
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv[1]))
index 6b6c75158604037147121aa329836e5648b71365..88cae88fe8ce4811a2959852d44c2257c0255594 100755 (executable)
@@ -61,7 +61,7 @@ def FindBundlePart(full_path):
 
 def GetDSYMBundle(options, binary_path):
   """Finds the .dSYM bundle to the binary."""
-  if binary_path[0] == '/' or binary_path == '':
+  if not binary_path.endswith(' Framework'):
     return binary_path
 
   filename = FindBundlePart(binary_path)