From 0f636a45c2e0cbfc988f5949d30cf902f10c5426 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 27 Aug 2015 10:55:34 -0700 Subject: [PATCH] Explicitly generate dSYM file so that OpenGL traces and Intruments profiles can find symbols automatically --- .../ios/XcodeHarness/{main.m => FakeMain.m} | 0 .../Harness.xcodeproj/project.pbxproj | 46 ++++++++++--------- .../src/flutter/build/config/ios/ios_app.py | 24 ++++++++++ engine/src/flutter/build/config/ios/rules.gni | 33 +++++++++++-- 4 files changed, 79 insertions(+), 24 deletions(-) rename engine/src/flutter/build/config/ios/XcodeHarness/{main.m => FakeMain.m} (100%) diff --git a/engine/src/flutter/build/config/ios/XcodeHarness/main.m b/engine/src/flutter/build/config/ios/XcodeHarness/FakeMain.m similarity index 100% rename from engine/src/flutter/build/config/ios/XcodeHarness/main.m rename to engine/src/flutter/build/config/ios/XcodeHarness/FakeMain.m diff --git a/engine/src/flutter/build/config/ios/XcodeHarness/Harness.xcodeproj/project.pbxproj b/engine/src/flutter/build/config/ios/XcodeHarness/Harness.xcodeproj/project.pbxproj index 33c21867061..4f94a0b0ca6 100644 --- a/engine/src/flutter/build/config/ios/XcodeHarness/Harness.xcodeproj/project.pbxproj +++ b/engine/src/flutter/build/config/ios/XcodeHarness/Harness.xcodeproj/project.pbxproj @@ -7,11 +7,11 @@ objects = { /* Begin PBXBuildFile section */ - 9E16D11C1B8684E900402ACB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E16D11B1B8684E900402ACB /* main.m */; }; + 9E16D11C1B8684E900402ACB /* FakeMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E16D11B1B8684E900402ACB /* FakeMain.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 9E16D11B1B8684E900402ACB /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 9E16D11B1B8684E900402ACB /* FakeMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FakeMain.m; sourceTree = ""; }; 9E842F101B866F0F00C84ECC /* Harness.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Harness.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -29,7 +29,7 @@ 9E16D11D1B8684F000402ACB /* Source */ = { isa = PBXGroup; children = ( - 9E16D11B1B8684E900402ACB /* main.m */, + 9E16D11B1B8684E900402ACB /* FakeMain.m */, ); name = Source; sourceTree = ""; @@ -59,8 +59,8 @@ buildPhases = ( 9E842EDC1B864EA100C84ECC /* Sources */, 9E842EDD1B864EA100C84ECC /* Frameworks */, - 9EA9970A1B867E74007B8C62 /* Copy GN Built Contents */, - 9E842EDE1B864EA100C84ECC /* Resources */, + 9EA9970A1B867E74007B8C62 /* Copy Application + Debugging Symbols */, + 9E3A4F5C1B8F82BE00095803 /* Nuke Fake Binary */, ); buildRules = ( ); @@ -103,30 +103,34 @@ }; /* End PBXProject section */ -/* Begin PBXResourcesBuildPhase section */ - 9E842EDE1B864EA100C84ECC /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - /* Begin PBXShellScriptBuildPhase section */ - 9EA9970A1B867E74007B8C62 /* Copy GN Built Contents */ = { + 9E3A4F5C1B8F82BE00095803 /* Nuke Fake Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy GN Built Contents"; + name = "Nuke Fake Binary"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cp -R ${SOURCE_ROOT}/Sideload/ ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app"; + shellScript = "rm ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Harness"; + }; + 9EA9970A1B867E74007B8C62 /* Copy Application + Debugging Symbols */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Application + Debugging Symbols"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cp -R ${SOURCE_ROOT}/Application/ ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app\ncp -R ${SOURCE_ROOT}/Harness.app.dSYM ${BUILT_PRODUCTS_DIR}"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -136,7 +140,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9E16D11C1B8684E900402ACB /* main.m in Sources */, + 9E16D11C1B8684E900402ACB /* FakeMain.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -229,7 +233,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = "$(SRCROOT)/Sideload/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Application/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -239,7 +243,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = "$(SRCROOT)/Sideload/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Application/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; }; diff --git a/engine/src/flutter/build/config/ios/ios_app.py b/engine/src/flutter/build/config/ios/ios_app.py index 0045c360de9..b8bf5443ae0 100644 --- a/engine/src/flutter/build/config/ios/ios_app.py +++ b/engine/src/flutter/build/config/ios/ios_app.py @@ -56,6 +56,16 @@ def PerformCodeSigning(args): args.application_path, ]) +def GenerateDSYM(args): + return subprocess.check_call([ + '/usr/bin/env', + 'xcrun', + 'dsymutil', + '-o', + args.output, + args.executable_path + ]) + def GenerateProjectStructure(args): application_path = os.path.join( args.dir, args.name + ".app" ) @@ -102,6 +112,20 @@ def Main(): required=True, help='The path to the entitlements .xcent') + # dSYM Generation + + dsym_generation_parser = subparsers.add_parser('dsym', + help='Generate a .dSYM file for an executable') + + dsym_generation_parser.set_defaults(func=GenerateDSYM) + + dsym_generation_parser.add_argument('-e', dest='executable_path', + required=True, + help='The executable path') + dsym_generation_parser.add_argument('-o', dest='output', + required=True, + help='The output file name') + # Engage! args = parser.parse_args() diff --git a/engine/src/flutter/build/config/ios/rules.gni b/engine/src/flutter/build/config/ios/rules.gni index 92e4b0b96ab..2a17c74e599 100644 --- a/engine/src/flutter/build/config/ios/rules.gni +++ b/engine/src/flutter/build/config/ios/rules.gni @@ -59,13 +59,38 @@ template("xcode_harness_ios") { ] } + dsym_gen_target_name = app_name + "_dsym" + action(dsym_gen_target_name) { + sources = [ + "$root_build_dir/$app_name" + ] + + script = ios_app_script + + outputs = [ + "$root_build_dir/$xcode_project_gen_target_name/Harness.app.dSYM" + ] + + args = [ + "dsym", + "-e", + rebase_path("$root_build_dir/$app_name", root_build_dir), + "-o", + rebase_path("$root_build_dir/$xcode_project_gen_target_name/Harness.app.dSYM", root_build_dir), + ] + + deps = invoker.deps + [ + ":$xcode_project_gen_target_name", + ] + } + bundle_copy_gen_target_name = app_name + "_bundle_copy" copy(bundle_copy_gen_target_name) { sources = [ invoker.app_bundle ] outputs = [ - "$root_build_dir/$xcode_project_gen_target_name/Sideload", + "$root_build_dir/$xcode_project_gen_target_name/Application", ] deps = invoker.deps + [ @@ -75,7 +100,8 @@ template("xcode_harness_ios") { group(target_name) { deps = [ - ":$bundle_copy_gen_target_name" + ":$dsym_gen_target_name", + ":$bundle_copy_gen_target_name", ] } } @@ -200,8 +226,9 @@ template("ios_app") { xcode_harness_ios(xcode_harness_gen_target_name) { app_bundle = "$root_build_dir/$app_name.app" deps = [ + ":$bin_gen_target_name", ":$struct_gen_target_name", - ":$copy_gen_target_name" + ":$copy_gen_target_name", ] }