Skip to content

Commit

Permalink
Skip iOS project migration when script is already embedding frameworks (
Browse files Browse the repository at this point in the history
  • Loading branch information
jmagman authored Mar 5, 2020
1 parent dc33334 commit db94472
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db94472

Please sign in to comment.