From fdb0225f8c81fd8ee4712e70943422852b25cc2c Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Mon, 27 Jan 2020 18:37:21 -0800 Subject: [PATCH] Revert "[flutter_tools] move dsym generation logic into dart build process (#49491)" (#49592) This reverts commit 2a91a7501cbc6d8461a4c48a19d5b98f116a192c. --- packages/flutter_tools/bin/xcode_backend.sh | 14 ++++++ packages/flutter_tools/lib/src/aot.dart | 2 +- .../lib/src/build_system/targets/ios.dart | 44 ------------------- .../flutter_tools/lib/src/macos/xcode.dart | 7 --- .../build_system/targets/ios_test.dart | 40 ----------------- 5 files changed, 15 insertions(+), 92 deletions(-) delete mode 100644 packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart diff --git a/packages/flutter_tools/bin/xcode_backend.sh b/packages/flutter_tools/bin/xcode_backend.sh index 8028f563f1..7f5bb868bb 100755 --- a/packages/flutter_tools/bin/xcode_backend.sh +++ b/packages/flutter_tools/bin/xcode_backend.sh @@ -202,6 +202,20 @@ BuildApp() { RunCommand cp -r -- "${app_framework}" "${derived_dir}" if [[ "${build_mode}" == "release" ]]; then + StreamOutput " ├─Generating dSYM file..." + # Xcode calls `symbols` during app store upload, which uses Spotlight to + # find dSYM files for embedded frameworks. When it finds the dSYM file for + # `App.framework` it throws an error, which aborts the app store upload. + # To avoid this, we place the dSYM files in a folder ending with ".noindex", + # which hides it from Spotlight, https://github.com/flutter/flutter/issues/22560. + RunCommand mkdir -p -- "${build_dir}/dSYMs.noindex" + RunCommand xcrun dsymutil -o "${build_dir}/dSYMs.noindex/App.framework.dSYM" "${app_framework}/App" + if [[ $? -ne 0 ]]; then + EchoError "Failed to generate debug symbols (dSYM) file for ${app_framework}/App." + exit -1 + fi + StreamOutput "done" + StreamOutput " ├─Stripping debug symbols..." RunCommand xcrun strip -x -S "${derived_dir}/App.framework/App" if [[ $? -ne 0 ]]; then diff --git a/packages/flutter_tools/lib/src/aot.dart b/packages/flutter_tools/lib/src/aot.dart index 9dd6fb2ad1..750d20d25e 100644 --- a/packages/flutter_tools/lib/src/aot.dart +++ b/packages/flutter_tools/lib/src/aot.dart @@ -214,7 +214,7 @@ class AotBuilder { final FlutterProject flutterProject = FlutterProject.current(); final Target target = buildMode == BuildMode.profile ? const AotAssemblyProfile() - : const GenerateDebugSymbols(); + : const AotAssemblyRelease(); final BuildResult result = await buildSystem.build(target, Environment( projectDir: flutterProject.directory, diff --git a/packages/flutter_tools/lib/src/build_system/targets/ios.dart b/packages/flutter_tools/lib/src/build_system/targets/ios.dart index c8a71b72c8..9b1ede5207 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/ios.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/ios.dart @@ -145,50 +145,6 @@ class AotAssemblyProfile extends AotAssemblyBase { ]; } -/// Handle strip and dysm generate for iOS release. -/// -/// Xcode calls `symbols` during app store upload, which uses Spotlight to -/// find dSYM files for embedded frameworks. When it finds the dSYM file for -/// `App.framework` it throws an error, which aborts the app store upload. -/// To avoid this, we place the dSYM files in a folder ending with ".noindex", -/// which hides it from Spotlight, https://github.com/flutter/flutter/issues/22560. -class GenerateDebugSymbols extends Target { - const GenerateDebugSymbols(); - - @override - String get name => 'generate_debug_symbols'; - - @override - List get dependencies => const [ - AotAssemblyRelease() - ]; - - @override - List get inputs => const [ - Source.pattern('{OUTPUT_DIR}/App.framework/App'), - ]; - - @override - List get outputs => const [ - Source.pattern('{OUTPUT_DIR}/dSYMs.noindex/App.framework.dSYM'), - ]; - - @override - Future build(Environment environment) async { - final Directory appFramework = environment.outputDir.childDirectory('App.framework'); - final Directory noIndex = environment.outputDir.childDirectory('dSYMs.noindex') - ..createSync(); - final RunResult result = await globals.xcode.dsymutil([ - '-o', - noIndex.childFile('App.framework.dSYM').path, - appFramework.childFile('App').path, - ]); - if (result.exitCode != 0) { - throwToolExit('Failed to generate debug symbols (dSYM) file for ${appFramework.path}/App.'); - } - } -} - /// Create an App.framework for debug iOS targets. /// /// This framework needs to exist for the Xcode project to link/bundle, diff --git a/packages/flutter_tools/lib/src/macos/xcode.dart b/packages/flutter_tools/lib/src/macos/xcode.dart index af368650c9..326a06f571 100644 --- a/packages/flutter_tools/lib/src/macos/xcode.dart +++ b/packages/flutter_tools/lib/src/macos/xcode.dart @@ -153,13 +153,6 @@ class Xcode { ); } - Future dsymutil(List args) { - return _processUtils.run( - ['xcrun', 'dsymutil', ...args], - throwOnError: true, - ); - } - Future clang(List args) { return _processUtils.run( ['xcrun', 'clang', ...args], diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart deleted file mode 100644 index 0f2d500167..0000000000 --- a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/build_system/targets/ios.dart'; -import 'package:flutter_tools/src/globals.dart' as globals; -import 'package:platform/platform.dart'; - -import 'package:process/process.dart'; - -import '../../../src/common.dart'; -import '../../../src/context.dart'; -import '../../../src/testbed.dart'; - -void main() { - Testbed testbed; - - setUp(() { - testbed = Testbed(); - }); - - test('GenerateDebugSymbols uses the proper arguments', () => testbed.run(() async { - final Environment environment = Environment.test( - globals.fs.currentDirectory, - ); - await const GenerateDebugSymbols().build(environment); - }, overrides: { - Platform: () => FakePlatform(operatingSystem: 'macos'), - ProcessManager: () => FakeProcessManager.list([ - const FakeCommand(command: [ - 'xcrun', - 'dsymutil', - '-o', - '/dSYMs.noindex/App.framework.dSYM', - '/App.framework/App', - ]) - ]), - })); -}