From 004f90f8fd8a8fb93d386d55364707ef1e517948 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 28 Jul 2020 10:33:52 -0700 Subject: [PATCH] remove iOS folder (#61561) --- packages/flutter_tools/lib/src/template.dart | 7 +++--- .../commands.shard/permeable/create_test.dart | 23 ++----------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/packages/flutter_tools/lib/src/template.dart b/packages/flutter_tools/lib/src/template.dart index 931a41e2b8..54d87fb898 100644 --- a/packages/flutter_tools/lib/src/template.dart +++ b/packages/flutter_tools/lib/src/template.dart @@ -129,9 +129,10 @@ class Template { return null; } - // TODO(cyanglaz): do not add iOS folder by default when 1.20.0 is released. - // Also need to update the flutter SDK min constraint in the pubspec.yaml to 1.20.0. - // https://github.com/flutter/flutter/issues/59787 + final bool ios = context['ios'] as bool; + if (relativeDestinationPath.contains('ios') && !ios) { + return null; + } // Only build a web project if explicitly asked. final bool web = context['web'] as bool; diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart index 8f39a74fa3..05d30519a2 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -1533,7 +1533,7 @@ void main() { // TODO(cyanglaz): no-op iOS folder should be removed after 1.20.0 release // https://github.com/flutter/flutter/issues/59787 - expect(projectDir.childDirectory('ios').existsSync(), true); + expect(projectDir.childDirectory('ios').existsSync(), false); expect(projectDir.childDirectory('android').existsSync(), false); expect(projectDir.childDirectory('web').existsSync(), false); expect(projectDir.childDirectory('linux').existsSync(), false); @@ -1542,7 +1542,7 @@ void main() { // TODO(cyanglaz): no-op iOS folder should be removed after 1.20.0 release // https://github.com/flutter/flutter/issues/59787 - expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), true); + expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), false); expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), false); expect(projectDir.childDirectory('example').childDirectory('web').existsSync(), false); expect(projectDir.childDirectory('example').childDirectory('linux').existsSync(), false); @@ -1557,25 +1557,6 @@ void main() { }); - // TODO(cyanglaz): no-op iOS folder should be removed after 1.20.0 release - // https://github.com/flutter/flutter/issues/59787 - testUsingContext('create an empty plugin contains a no-op ios folder, but no pubspec entry.', () async { - Cache.flutterRoot = '../..'; - when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision); - when(mockFlutterVersion.channel).thenReturn(frameworkChannel); - - final CreateCommand command = CreateCommand(); - final CommandRunner runner = createTestCommandRunner(command); - await runner.run(['create', '--no-pub', '--template=plugin', projectDir.path]); - - expect(projectDir.childDirectory('ios').existsSync(), true); - expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), true); - validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const [ - 'some_platform' - ], pluginClass: 'somePluginClass', - unexpectedPlatforms: ['ios']); - }); - testUsingContext('plugin supports ios if requested', () async { Cache.flutterRoot = '../..'; when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);