Finish integrating HelloServices model on iOS (#4820)
This patch changes the default `flutter create` command to generate a
HelloServices-style app on iOS. As a consequence, the Atom integration now
fully works with HelloServices.
diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart
index ae3d5df..07f6ccb 100644
--- a/packages/flutter_tools/lib/src/application_package.dart
+++ b/packages/flutter_tools/lib/src/application_package.dart
@@ -96,13 +96,13 @@
if (getCurrentHostPlatform() != HostPlatform.darwin_x64)
return null;
- String plistPath = path.join('ios', 'Info.plist');
+ String plistPath = path.join('ios', 'Runner', 'Info.plist');
String value = getValueFromFile(plistPath, kCFBundleIdentifierKey);
if (value == null)
return null;
return new IOSApp(
- projectDir: path.join('ios', '.generated'),
+ projectDir: path.join('ios'),
projectBundleId: value
);
}
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index 163b05f..962ced7 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -105,16 +105,7 @@
bool codesign: true
}) async {
String flutterProjectPath = Directory.current.path;
-
- if (xcodeProjectRequiresUpdate(mode, target)) {
- printTrace('Initializing the Xcode project.');
- if ((await setupXcodeProjectHarness(flutterProjectPath, mode, target)) != 0) {
- printError('Could not initialize the Xcode project.');
- return new XcodeBuildResult(false);
- }
- } else {
- updateXcodeGeneratedProperties(flutterProjectPath, mode, target);
- }
+ updateXcodeGeneratedProperties(flutterProjectPath, mode, target);
if (!_checkXcodeVersion())
return new XcodeBuildResult(false);
@@ -130,7 +121,6 @@
'xcodebuild',
'clean',
'build',
- '-target', 'Runner',
'-configuration', 'Release',
'ONLY_ACTIVE_ARCH=YES',
];
diff --git a/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart b/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
index 6cf48bf..210dbf8 100644
--- a/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
+++ b/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
@@ -2,16 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'dart:async';
import 'dart:io';
import 'package:path/path.dart' as path;
-import '../base/file_system.dart' show copyFolderSync;
import '../build_info.dart';
import '../cache.dart';
import '../globals.dart';
-import '../version.dart';
void updateXcodeGeneratedProperties(String projectPath, BuildMode mode, String target) {
StringBuffer localsBuffer = new StringBuffer();
@@ -37,54 +34,7 @@
if (tools.isLocalEngine)
localsBuffer.writeln('LOCAL_ENGINE=${tools.engineBuildPath}');
- File localsFile = new File(path.join(projectPath, 'ios', '.generated', 'Flutter', 'Generated.xcconfig'));
+ File localsFile = new File(path.join(projectPath, 'ios', 'Flutter', 'Generated.xcconfig'));
localsFile.createSync(recursive: true);
localsFile.writeAsStringSync(localsBuffer.toString());
}
-
-bool xcodeProjectRequiresUpdate(BuildMode mode, String target) {
- File revisionFile = new File(path.join(Directory.current.path, 'ios', '.generated', 'REVISION'));
-
- // If the revision stamp does not exist, the Xcode project definitely requires
- // an update
- if (!revisionFile.existsSync()) {
- printTrace("A revision stamp does not exist. The Xcode project has never been initialized.");
- return true;
- }
-
- if (revisionFile.readAsStringSync() != _getCurrentXcodeRevisionString(mode, target)) {
- printTrace("The revision stamp and the Flutter engine revision differ or the build mode has changed.");
- printTrace("Project needs to be updated.");
- return true;
- }
-
- printTrace("Xcode project is up to date.");
- return false;
-}
-
-Future<int> setupXcodeProjectHarness(String flutterProjectPath, BuildMode mode, String target) async {
- // Step 1: Copy templates into user project directory
- String iosFilesPath = path.join(flutterProjectPath, 'ios');
- String xcodeProjectPath = path.join(iosFilesPath, '.generated');
- String templatesPath = path.join(Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'build-ios');
- copyFolderSync(templatesPath, xcodeProjectPath);
-
- // Step 2: Populate the Generated.xcconfig with project specific paths
- updateXcodeGeneratedProperties(flutterProjectPath, mode, target);
-
- // Step 3: Write the REVISION file
- File revisionFile = new File(path.join(xcodeProjectPath, 'REVISION'));
- revisionFile.createSync();
- revisionFile.writeAsStringSync(_getCurrentXcodeRevisionString(mode, target));
-
- // Step 4: Tell the user the location of the generated project.
- printStatus('Xcode project created in $iosFilesPath/.');
-
- return 0;
-}
-
-String _getCurrentXcodeRevisionString(BuildMode mode, String target) => (new StringBuffer()
- ..write('${FlutterVersion.getVersion().frameworkRevision}')
- ..write('-${tools.isLocalEngine ? tools.engineBuildPath : getModeName(mode)}')
- ..write('::$target')
- ).toString();
diff --git a/packages/flutter_tools/lib/src/run.dart b/packages/flutter_tools/lib/src/run.dart
index efa7ce2..c5805cf 100644
--- a/packages/flutter_tools/lib/src/run.dart
+++ b/packages/flutter_tools/lib/src/run.dart
@@ -413,7 +413,7 @@
case TargetPlatform.android_x64:
return 'Is your project missing an android/AndroidManifest.xml?\nConsider running "flutter create ." to create one.';
case TargetPlatform.ios:
- return 'Is your project missing an ios/Info.plist?\nConsider running "flutter create ." to create one.';
+ return 'Is your project missing an ios/Runner/Info.plist?\nConsider running "flutter create ." to create one.';
default:
return null;
}