diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart index a29762b9ae..f9906a027b 100644 --- a/packages/flutter_tools/lib/src/base/build.dart +++ b/packages/flutter_tools/lib/src/base/build.dart @@ -257,9 +257,12 @@ class AOTSnapshotter { printError('Failed to link AOT snapshot. Linker terminated with exit code ${compileResult.exitCode}'); return linkResult; } + // See https://github.com/flutter/flutter/issues/22560 + // These have to be placed in a .noindex folder to prevent Xcode from + // using Spotlight to find them and potentially attach the wrong ones. final RunResult dsymResult = await xcode.dsymutil([ appLib, - '-o', fs.path.join(outputPath, 'App.framework.dSYM'), + '-o', fs.path.join(outputPath, 'App.framework.dSYM.noindex'), ]); if (dsymResult.exitCode != 0) { printError('Failed to extract dSYM out of dynamic lib'); diff --git a/packages/flutter_tools/lib/src/commands/build_aot.dart b/packages/flutter_tools/lib/src/commands/build_aot.dart index 8def2aee69..6a1ac13b9b 100644 --- a/packages/flutter_tools/lib/src/commands/build_aot.dart +++ b/packages/flutter_tools/lib/src/commands/build_aot.dart @@ -149,12 +149,12 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen '-create', '-output', fs.path.join(outputPath, 'App.framework', 'App'), ]); - final Iterable dSYMs = iosBuilds.values.map((String outputDir) => fs.path.join(outputDir, 'App.framework.dSYM')); - fs.directory(fs.path.join(outputPath, 'App.framework.dSYM', 'Contents', 'Resources', 'DWARF'))..createSync(recursive: true); + final Iterable dSYMs = iosBuilds.values.map((String outputDir) => fs.path.join(outputDir, 'App.framework.dSYM.noindex')); + fs.directory(fs.path.join(outputPath, 'App.framework.dSYM.noindex', 'Contents', 'Resources', 'DWARF'))..createSync(recursive: true); await runCheckedAsync([ 'lipo', '-create', - '-output', fs.path.join(outputPath, 'App.framework.dSYM', 'Contents', 'Resources', 'DWARF', 'App'), + '-output', fs.path.join(outputPath, 'App.framework.dSYM.noindex', 'Contents', 'Resources', 'DWARF', 'App'), ...dSYMs.map((String path) => fs.path.join(path, 'Contents', 'Resources', 'DWARF', 'App')) ]); } else { diff --git a/packages/flutter_tools/test/general.shard/base/build_test.dart b/packages/flutter_tools/test/general.shard/base/build_test.dart index bfbda3968c..3f387b2bc2 100644 --- a/packages/flutter_tools/test/general.shard/base/build_test.dart +++ b/packages/flutter_tools/test/general.shard/base/build_test.dart @@ -210,7 +210,11 @@ void main() { verify(xcode.cc(argThat(contains('-fembed-bitcode')))).called(1); verify(xcode.clang(argThat(contains('-fembed-bitcode')))).called(1); - verify(xcode.dsymutil(any)).called(1); + verify(xcode.dsymutil([ + 'build/foo/App.framework/App', + '-o', + 'build/foo/App.framework.dSYM.noindex', + ])).called(1); final File assemblyFile = fs.file(assembly); final File assemblyBitcodeFile = fs.file('$assembly.bitcode');