Add deprecation warning for "flutter create --ios-language" (#155867)

The Objective-C  `flutter create --ios-language objc` template will be removed in https://github.com/flutter/flutter/issues/148586.

Add a deprecation warning when this flag is passed.  Add an additional warning when Objective-C is specified requesting the user's use-case.

Do not show the warning when creating the module, as Swift is not supported for it yet https://github.com/flutter/flutter/issues/23955

![Screenshot 2024-09-27 at 8 54 16 PM](https://github.com/user-attachments/assets/112be47f-a5bd-4f57-9a9d-c96c7bbc8ac3)

Part of https://github.com/flutter/flutter/issues/148586
This commit is contained in:
Jenn Magder
2024-10-02 09:13:25 -07:00
committed by GitHub
parent ff7e5f3d73
commit 22247cd55c
3 changed files with 40 additions and 2 deletions

View File

@@ -1686,6 +1686,36 @@ void main() {
expect(displayName, 'My Project');
});
testUsingContext('should not show --ios-language deprecation warning issue for Swift', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', '--ios-language=swift', projectDir.path]);
expect(logger.warningText, contains('The "ios-language" option is deprecated and will be removed in a future Flutter release.'));
expect(logger.warningText, isNot(contains('https://github.com/flutter/flutter/issues/148586')));
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(),
Logger: () => logger,
});
testUsingContext('should show --ios-language deprecation warning issue for Objective-C', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', '--ios-language=objc', projectDir.path]);
expect(logger.warningText, contains('The "ios-language" option is deprecated and will be removed in a future Flutter release.'));
expect(logger.warningText, contains('https://github.com/flutter/flutter/issues/148586'));
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(),
Logger: () => logger,
});
testUsingContext('has correct content and formatting with macOS app template', () async {
Cache.flutterRoot = '../..';