diff --git a/dev/devicelab/bin/tasks/module_test_ios.dart b/dev/devicelab/bin/tasks/module_test_ios.dart index f5787548202..0a976228ef1 100644 --- a/dev/devicelab/bin/tasks/module_test_ios.dart +++ b/dev/devicelab/bin/tasks/module_test_ios.dart @@ -59,6 +59,13 @@ Future main() async { ); } + if (await _hasDebugSymbols(ephemeralReleaseHostApp)) { + return TaskResult.failure( + "Ephemeral host app ${ephemeralReleaseHostApp.path}'s App.framework's " + "debug symbols weren't stripped in release mode" + ); + } + section('Clean build'); await inDirectory(projectDir, () async { @@ -92,6 +99,12 @@ Future main() async { ); } + if (!await _hasDebugSymbols(ephemeralProfileHostApp)) { + return TaskResult.failure( + "Ephemeral host app ${ephemeralProfileHostApp.path}'s App.framework does not contain debug symbols" + ); + } + section('Clean build'); await inDirectory(projectDir, () async { @@ -290,3 +303,26 @@ Future _isAppAotBuild(Directory app) async { return symbolTable.contains('kDartIsolateSnapshotInstructions'); } + +Future _hasDebugSymbols(Directory app) async { + final String binary = path.join( + app.path, + 'Frameworks', + 'App.framework', + 'App' + ); + + final String symbolTable = await eval( + 'dsymutil', + [ + '--dump-debug-map', + binary, + ], + // The output is huge. + printStdout: false, + ); + + // Search for some random Flutter framework Dart function which should always + // be in App.framework. + return symbolTable.contains('BuildOwner_reassemble'); +} diff --git a/packages/flutter_tools/bin/xcode_backend.sh b/packages/flutter_tools/bin/xcode_backend.sh index 6cc77de8717..876dd750f92 100755 --- a/packages/flutter_tools/bin/xcode_backend.sh +++ b/packages/flutter_tools/bin/xcode_backend.sh @@ -201,27 +201,29 @@ BuildApp() { RunCommand cp -r -- "${app_framework}" "${derived_dir}" - 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" + 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 - EchoError "Failed to strip ${derived_dir}/App.framework/App." - exit -1 + StreamOutput " ├─Stripping debug symbols..." + RunCommand xcrun strip -x -S "${derived_dir}/App.framework/App" + if [[ $? -ne 0 ]]; then + EchoError "Failed to strip ${derived_dir}/App.framework/App." + exit -1 + fi + StreamOutput "done" fi - StreamOutput "done" else RunCommand mkdir -p -- "${derived_dir}/App.framework"