Let (almost) all flutter create CocoaPods references be dynamically generated later (#9791) * Remove all initial cocoapod traces from flutter create except Podfile * Make updateXcodeGeneratedProperties parameters named * review notes
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart index c9f1de3..5d7e7a2 100644 --- a/packages/flutter_tools/lib/src/commands/create.dart +++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -141,7 +141,12 @@ printStatus('Wrote $generatedCount files.'); printStatus(''); - updateXcodeGeneratedProperties(appPath, BuildMode.debug, flx.defaultMainPath); + updateXcodeGeneratedProperties( + projectPath: appPath, + mode: BuildMode.debug, + target: flx.defaultMainPath, + hasPlugins: generatePlugin, + ); if (argResults['pub']) { await pubGet(directory: appPath);
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart index 5262b25..413b33a 100644 --- a/packages/flutter_tools/lib/src/ios/mac.dart +++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -137,9 +137,6 @@ bool buildForDevice, bool codesign: true }) async { - final String flutterProjectPath = fs.currentDirectory.path; - updateXcodeGeneratedProperties(flutterProjectPath, mode, target); - if (!_checkXcodeVersion()) return new XcodeBuildResult(success: false); @@ -157,6 +154,13 @@ if (hasFlutterPlugins) await _runPodInstall(appDirectory, flutterFrameworkDir(mode)); + updateXcodeGeneratedProperties( + projectPath: fs.currentDirectory.path, + mode: mode, + target: target, + hasPlugins: hasFlutterPlugins + ); + final List<String> commands = <String>[ '/usr/bin/env', 'xcrun',
diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart index 73f0afa..aa77254 100644 --- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart +++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
@@ -2,6 +2,8 @@ // 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'; + import '../artifacts.dart'; import '../base/file_system.dart'; import '../base/process.dart'; @@ -16,7 +18,12 @@ return fs.path.normalize(fs.path.dirname(artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, mode))); } -void updateXcodeGeneratedProperties(String projectPath, BuildMode mode, String target) { +void updateXcodeGeneratedProperties({ + @required String projectPath, + @required BuildMode mode, + @required String target, + @required bool hasPlugins, +}) { final StringBuffer localsBuffer = new StringBuffer(); localsBuffer.writeln('// This is a generated file; do not edit or check into version control.'); @@ -45,6 +52,10 @@ localsBuffer.writeln('LOCAL_ENGINE=${localEngineArtifacts.engineOutPath}'); } + // Add dependency to CocoaPods' generated project only if plugns are used. + if (hasPlugins) + localsBuffer.writeln('#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"'); + final File localsFile = fs.file(fs.path.join(projectPath, 'ios', 'Flutter', 'Generated.xcconfig')); localsFile.createSync(recursive: true); localsFile.writeAsStringSync(localsBuffer.toString());