diff --git a/packages/flutter_tools/lib/src/ios/migrations/remove_framework_link_and_embedding_migration.dart b/packages/flutter_tools/lib/src/ios/migrations/remove_framework_link_and_embedding_migration.dart index efc21ca0776..528239f3af3 100644 --- a/packages/flutter_tools/lib/src/ios/migrations/remove_framework_link_and_embedding_migration.dart +++ b/packages/flutter_tools/lib/src/ios/migrations/remove_framework_link_and_embedding_migration.dart @@ -87,7 +87,7 @@ class RemoveFrameworkLinkAndEmbeddingMigration extends IOSMigrator { // Embed and thin frameworks in a script instead of using Xcode's link / embed build phases. const String thinBinaryScript = 'xcode_backend.sh\\" thin'; - if (line.contains(thinBinaryScript)) { + if (line.contains(thinBinaryScript) && !line.contains(' embed')) { return line.replaceFirst(thinBinaryScript, 'xcode_backend.sh\\" embed_and_thin'); } diff --git a/packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart b/packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart index b39b1eb01a9..6fc79e64db1 100644 --- a/packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart @@ -72,6 +72,22 @@ void main () { expect(testLogger.statusText, isEmpty); }); + testWithoutContext('skips migrating script with embed', () { + const String contents = ''' +shellScript = "/bin/sh \"\$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\" embed\\n/bin/sh \"\$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\" thin\n"; + '''; + xcodeProjectInfoFile.writeAsStringSync(contents); + + final RemoveFrameworkLinkAndEmbeddingMigration iosProjectMigration = RemoveFrameworkLinkAndEmbeddingMigration( + mockIosProject, + testLogger, + mockXcode, + ); + expect(iosProjectMigration.migrate(), isTrue); + expect(xcodeProjectInfoFile.readAsStringSync(), contents); + expect(testLogger.statusText, isEmpty); + }); + testWithoutContext('Xcode project is migrated', () { xcodeProjectInfoFile.writeAsStringSync(''' prefix 3B80C3941E831B6300D905FE