Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
fdd023fa
Unverified
Commit
fdd023fa
authored
Mar 10, 2020
by
Jenn Magder
Committed by
GitHub
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate older Xcode projects off the legacy build system (#52288)
parent
60d0fef1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
137 additions
and
10 deletions
+137
-10
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+3
-1
ios_migrator.dart
...es/flutter_tools/lib/src/ios/migrations/ios_migrator.dart
+4
-1
remove_framework_link_and_embedding_migration.dart
...ations/remove_framework_link_and_embedding_migration.dart
+3
-8
xcode_build_system_migration.dart
.../lib/src/ios/migrations/xcode_build_system_migration.dart
+48
-0
ios_project_migration_test.dart
...ls/test/general.shard/ios/ios_project_migration_test.dart
+79
-0
No files found.
packages/flutter_tools/lib/src/ios/mac.dart
View file @
fdd023fa
...
...
@@ -24,6 +24,7 @@ import '../reporting/reporting.dart';
import
'code_signing.dart'
;
import
'migrations/ios_migrator.dart'
;
import
'migrations/remove_framework_link_and_embedding_migration.dart'
;
import
'migrations/xcode_build_system_migration.dart'
;
import
'xcodeproj.dart'
;
class
IMobileDevice
{
...
...
@@ -90,7 +91,8 @@ Future<XcodeBuildResult> buildXcodeProject({
}
final
List
<
IOSMigrator
>
migrators
=
<
IOSMigrator
>[
RemoveFrameworkLinkAndEmbeddingMigration
(
app
.
project
,
globals
.
logger
,
globals
.
xcode
,
globals
.
flutterUsage
)
RemoveFrameworkLinkAndEmbeddingMigration
(
app
.
project
,
globals
.
logger
,
globals
.
xcode
,
globals
.
flutterUsage
),
XcodeBuildSystemMigration
(
app
.
project
,
globals
.
logger
),
];
final
IOSMigration
migration
=
IOSMigration
(
migrators
);
...
...
packages/flutter_tools/lib/src/ios/migrations/ios_migrator.dart
View file @
fdd023fa
...
...
@@ -20,7 +20,10 @@ abstract class IOSMigrator {
bool
migrate
();
/// Return null if the line should be deleted.
String
migrateLine
(
String
line
);
@protected
String
migrateLine
(
String
line
)
{
return
line
;
}
@protected
void
processFileLines
(
File
file
)
{
...
...
packages/flutter_tools/lib/src/ios/migrations/remove_framework_link_and_embedding_migration.dart
View file @
fdd023fa
...
...
@@ -10,9 +10,9 @@ import '../../project.dart';
import
'../../reporting/reporting.dart'
;
import
'ios_migrator.dart'
;
//
/
Xcode 11.4 requires linked and embedded frameworks to contain all targeted architectures before build phases are run.
//
/
This caused issues switching between a real device and simulator due to architecture mismatch.
//
/
Remove the linking and embedding logic from the Xcode project to give the tool more control over these.
// Xcode 11.4 requires linked and embedded frameworks to contain all targeted architectures before build phases are run.
// This caused issues switching between a real device and simulator due to architecture mismatch.
// Remove the linking and embedding logic from the Xcode project to give the tool more control over these.
class
RemoveFrameworkLinkAndEmbeddingMigration
extends
IOSMigrator
{
RemoveFrameworkLinkAndEmbeddingMigration
(
IosProject
project
,
...
...
@@ -28,13 +28,8 @@ class RemoveFrameworkLinkAndEmbeddingMigration extends IOSMigrator {
final
Xcode
_xcode
;
final
Usage
_usage
;
/// Inspect [project] for necessary migrations and rewrite files as needed.
@override
bool
migrate
()
{
return
_migrateXcodeProjectInfoFile
();
}
bool
_migrateXcodeProjectInfoFile
()
{
if
(!
_xcodeProjectInfoFile
.
existsSync
())
{
logger
.
printTrace
(
'Xcode project not found, skipping migration'
);
return
true
;
...
...
packages/flutter_tools/lib/src/ios/migrations/xcode_build_system_migration.dart
0 → 100644
View file @
fdd023fa
// 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
'../../base/file_system.dart'
;
import
'../../base/logger.dart'
;
import
'../../project.dart'
;
import
'ios_migrator.dart'
;
// Xcode legacy build system no longer supported by Xcode.
// Set in https://github.com/flutter/flutter/pull/21901/.
// Removed in https://github.com/flutter/flutter/pull/33684.
class
XcodeBuildSystemMigration
extends
IOSMigrator
{
XcodeBuildSystemMigration
(
IosProject
project
,
Logger
logger
,
)
:
_xcodeWorkspaceSharedSettings
=
project
.
xcodeWorkspaceSharedSettings
,
super
(
logger
);
final
File
_xcodeWorkspaceSharedSettings
;
@override
bool
migrate
()
{
if
(!
_xcodeWorkspaceSharedSettings
.
existsSync
())
{
logger
.
printTrace
(
'Xcode workspace settings not found, skipping migration'
);
return
true
;
}
final
String
contents
=
_xcodeWorkspaceSharedSettings
.
readAsStringSync
();
// Only delete this file when it matches the original Flutter template.
const
String
legacyBuildSettingsWorkspace
=
'''
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>'''
;
// contains instead of equals to ignore newline file ending variance.
if
(
contents
.
contains
(
legacyBuildSettingsWorkspace
))
{
logger
.
printStatus
(
'Legacy build system detected, removing
${_xcodeWorkspaceSharedSettings.path}
'
);
_xcodeWorkspaceSharedSettings
.
deleteSync
();
}
return
true
;
}
}
packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart
View file @
fdd023fa
...
...
@@ -12,6 +12,7 @@ import 'package:platform/platform.dart';
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/terminal.dart'
;
import
'package:flutter_tools/src/ios/migrations/remove_framework_link_and_embedding_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/xcode_build_system_migration.dart'
;
import
'package:flutter_tools/src/macos/xcode.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
...
...
@@ -257,6 +258,84 @@ keep this 2
verify
(
mockUsage
.
sendEvent
(
'ios-migration'
,
'remove-frameworks'
,
label:
'failure'
,
value:
null
));
});
});
group
(
'new Xcode build system'
,
()
{
MemoryFileSystem
memoryFileSystem
;
BufferLogger
testLogger
;
MockIosProject
mockIosProject
;
File
xcodeWorkspaceSharedSettings
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
();
xcodeWorkspaceSharedSettings
=
memoryFileSystem
.
file
(
'WorkspaceSettings.xcsettings'
);
testLogger
=
BufferLogger
(
terminal:
AnsiTerminal
(
stdio:
null
,
platform:
const
LocalPlatform
(),
),
outputPreferences:
OutputPreferences
.
test
(),
);
mockIosProject
=
MockIosProject
();
when
(
mockIosProject
.
xcodeWorkspaceSharedSettings
).
thenReturn
(
xcodeWorkspaceSharedSettings
);
});
testWithoutContext
(
'skipped if files are missing'
,
()
{
final
XcodeBuildSystemMigration
iosProjectMigration
=
XcodeBuildSystemMigration
(
mockIosProject
,
testLogger
,
);
expect
(
iosProjectMigration
.
migrate
(),
isTrue
);
expect
(
xcodeWorkspaceSharedSettings
.
existsSync
(),
isFalse
);
expect
(
testLogger
.
traceText
,
contains
(
'Xcode workspace settings not found, skipping migration'
));
expect
(
testLogger
.
statusText
,
isEmpty
);
});
testWithoutContext
(
'skipped if nothing to upgrade'
,
()
{
const
String
contents
=
'''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string></string>
</dict>
</plist>'''
;
xcodeWorkspaceSharedSettings
.
writeAsStringSync
(
contents
);
final
XcodeBuildSystemMigration
iosProjectMigration
=
XcodeBuildSystemMigration
(
mockIosProject
,
testLogger
,
);
expect
(
iosProjectMigration
.
migrate
(),
isTrue
);
expect
(
xcodeWorkspaceSharedSettings
.
existsSync
(),
isTrue
);
expect
(
testLogger
.
statusText
,
isEmpty
);
});
testWithoutContext
(
'Xcode project is migrated'
,
()
{
const
String
contents
=
'''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>'''
;
xcodeWorkspaceSharedSettings
.
writeAsStringSync
(
contents
);
final
XcodeBuildSystemMigration
iosProjectMigration
=
XcodeBuildSystemMigration
(
mockIosProject
,
testLogger
,
);
expect
(
iosProjectMigration
.
migrate
(),
isTrue
);
expect
(
xcodeWorkspaceSharedSettings
.
existsSync
(),
isFalse
);
expect
(
testLogger
.
statusText
,
contains
(
'Legacy build system detected, removing'
));
});
});
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment