mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Pause UIScene migration (#170457)
UIScene migration is not yet enforced by Apple so we have some more time to handle this. Let's pause on auto-migrating projects. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This commit is contained in:
parent
0cea36129f
commit
820ff598ce
@ -42,7 +42,6 @@ import 'migrations/project_build_location_migration.dart';
|
||||
import 'migrations/remove_bitcode_migration.dart';
|
||||
import 'migrations/remove_framework_link_and_embedding_migration.dart';
|
||||
import 'migrations/uiapplicationmain_deprecation_migration.dart';
|
||||
import 'migrations/uiscenedelegate_migration.dart';
|
||||
import 'migrations/xcode_build_system_migration.dart';
|
||||
import 'xcode_build_settings.dart';
|
||||
import 'xcodeproj.dart';
|
||||
@ -153,7 +152,6 @@ Future<XcodeBuildResult> buildXcodeProject({
|
||||
IOSDeploymentTargetMigration(app.project, globals.logger),
|
||||
XcodeProjectObjectVersionMigration(app.project, globals.logger),
|
||||
HostAppInfoPlistMigration(app.project, globals.logger),
|
||||
UISceneDelegateMigration(app.project, globals.logger),
|
||||
XcodeScriptBuildPhaseMigration(app.project, globals.logger),
|
||||
RemoveBitcodeMigration(app.project, globals.logger),
|
||||
XcodeThinBinaryBuildPhaseInputPathsMigration(app.project, globals.logger),
|
||||
|
||||
@ -1,94 +0,0 @@
|
||||
// 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 'package:meta/meta.dart' show visibleForTesting;
|
||||
import 'package:xml/xml.dart';
|
||||
|
||||
import '../../base/file_system.dart';
|
||||
import '../../base/project_migrator.dart';
|
||||
import '../../xcode_project.dart';
|
||||
|
||||
const String _manifestKey = 'UIApplicationSceneManifest';
|
||||
const String _storyboardKey = 'UIMainStoryboardFile';
|
||||
|
||||
String _addition(String storyboard) => '''
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
<key>UISceneConfigurations</key>
|
||||
<dict>
|
||||
<key>UIWindowSceneSessionRoleApplication</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UISceneClassName</key>
|
||||
<string>UIWindowScene</string>
|
||||
<key>UISceneDelegateClassName</key>
|
||||
<string>FlutterSceneDelegate</string>
|
||||
<key>UISceneConfigurationName</key>
|
||||
<string>flutter</string>
|
||||
<key>UISceneStoryboardFile</key>
|
||||
<string>$storyboard</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
''';
|
||||
|
||||
/// Update Info.plist.
|
||||
class UISceneDelegateMigration extends ProjectMigrator {
|
||||
UISceneDelegateMigration(IosProject project, super.logger)
|
||||
: _infoPlist = project.defaultHostInfoPlist;
|
||||
|
||||
final File _infoPlist;
|
||||
|
||||
@override
|
||||
Future<void> migrate() async {
|
||||
if (!_infoPlist.existsSync()) {
|
||||
logger.printTrace('Info.plist not found, skipping host app Info.plist migration.');
|
||||
return;
|
||||
}
|
||||
|
||||
processFileLines(_infoPlist);
|
||||
}
|
||||
|
||||
@visibleForTesting
|
||||
static Map<String, XmlElement> extractPlistDict(XmlElement dict) {
|
||||
final Map<String, XmlElement> keyValues = <String, XmlElement>{};
|
||||
String? key;
|
||||
for (final XmlElement child in dict.childElements) {
|
||||
if (key != null) {
|
||||
keyValues[key] = child;
|
||||
key = null;
|
||||
} else {
|
||||
key = child.innerText;
|
||||
}
|
||||
}
|
||||
return keyValues;
|
||||
}
|
||||
|
||||
@override
|
||||
String migrateFileContents(String fileContents) {
|
||||
try {
|
||||
final XmlDocument read = XmlDocument.parse(fileContents);
|
||||
final XmlElement readPlist = read.childElements.first;
|
||||
final XmlElement readDict = readPlist.childElements.first;
|
||||
final Map<String, XmlElement> keyValues = extractPlistDict(readDict);
|
||||
|
||||
if (!keyValues.containsKey(_manifestKey)) {
|
||||
if (keyValues.containsKey(_storyboardKey)) {
|
||||
final String storyboard = keyValues[_storyboardKey]!.innerText;
|
||||
final String xmlAddition = _addition(storyboard);
|
||||
final XmlDocumentFragment fragment = XmlDocumentFragment.parse(xmlAddition);
|
||||
for (final XmlNode node in fragment.children) {
|
||||
readDict.children.add(node.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
return '${read.toXmlString(pretty: true)}\n';
|
||||
} on Exception catch (_) {
|
||||
return fileContents;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user