Unverified Commit e85fe60d authored by Marcel Čampa's avatar Marcel Čampa Committed by GitHub

Command `flutter create` respects disabled iOS and Android (#78406)

parent 47db96af
......@@ -236,8 +236,8 @@ class CreateCommand extends CreateBase {
withPluginHook: generatePlugin,
androidLanguage: stringArg('android-language'),
iosLanguage: stringArg('ios-language'),
ios: platforms.contains('ios'),
android: platforms.contains('android'),
ios: featureFlags.isIOSEnabled && platforms.contains('ios'),
android: featureFlags.isAndroidEnabled && platforms.contains('android'),
web: featureFlags.isWebEnabled && platforms.contains('web'),
linux: featureFlags.isLinuxEnabled && platforms.contains('linux'),
macos: featureFlags.isMacOSEnabled && platforms.contains('macos'),
......
......@@ -100,12 +100,16 @@ void main() {
await commandRunner.run(<String>[
'config',
'--enable-android',
'--enable-ios',
'--enable-web',
'--enable-linux-desktop',
'--enable-windows-desktop',
'--enable-macos-desktop',
]);
expect(globals.config.getValue('enable-android'), true);
expect(globals.config.getValue('enable-ios'), true);
expect(globals.config.getValue('enable-web'), true);
expect(globals.config.getValue('enable-linux-desktop'), true);
expect(globals.config.getValue('enable-windows-desktop'), true);
......@@ -115,6 +119,8 @@ void main() {
'config', '--clear-features',
]);
expect(globals.config.getValue('enable-android'), null);
expect(globals.config.getValue('enable-ios'), null);
expect(globals.config.getValue('enable-web'), null);
expect(globals.config.getValue('enable-linux-desktop'), null);
expect(globals.config.getValue('enable-windows-desktop'), null);
......@@ -122,12 +128,16 @@ void main() {
await commandRunner.run(<String>[
'config',
'--no-enable-android',
'--no-enable-ios',
'--no-enable-web',
'--no-enable-linux-desktop',
'--no-enable-windows-desktop',
'--no-enable-macos-desktop',
]);
expect(globals.config.getValue('enable-android'), false);
expect(globals.config.getValue('enable-ios'), false);
expect(globals.config.getValue('enable-web'), false);
expect(globals.config.getValue('enable-linux-desktop'), false);
expect(globals.config.getValue('enable-windows-desktop'), false);
......
......@@ -693,6 +693,44 @@ void main() {
Logger: () => logger,
});
testUsingContext('app supports android and ios by default', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', projectDir.path]);
expect(projectDir.childDirectory('android'), exists);
expect(projectDir.childDirectory('ios'), exists);
}, overrides: <Type, Generator>{});
testUsingContext('app does not include android if disabled in config', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', projectDir.path]);
expect(projectDir.childDirectory('android'), isNot(exists));
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isAndroidEnabled: false),
});
testUsingContext('app does not include ios if disabled in config', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', projectDir.path]);
expect(projectDir.childDirectory('ios'), isNot(exists));
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isIOSEnabled: false),
});
testUsingContext('app does not include desktop or web by default', () async {
Cache.flutterRoot = '../..';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment