Disable CocoaPods input and output paths in Xcode build phase and adopt new Xcode build system (#33684)
Updates the Podfile template to use the CocoaPod disable_input_output_paths installation option which prevents the [CP] Embed Pods Frameworks build phase from outputting the Flutter.framework files.
This commit is contained in:
@@ -92,7 +92,6 @@ Future<T> runInContext<T>(
|
||||
Logger: () => platform.isWindows ? WindowsStdoutLogger() : StdoutLogger(),
|
||||
MacOSWorkflow: () => const MacOSWorkflow(),
|
||||
OperatingSystemUtils: () => OperatingSystemUtils(),
|
||||
PlistBuddy: () => const PlistBuddy(),
|
||||
SimControl: () => SimControl(),
|
||||
Stdio: () => const Stdio(),
|
||||
SystemClock: () => const SystemClock(),
|
||||
|
||||
@@ -28,55 +28,6 @@ import 'code_signing.dart';
|
||||
import 'xcodeproj.dart';
|
||||
|
||||
IMobileDevice get iMobileDevice => context.get<IMobileDevice>();
|
||||
PlistBuddy get plistBuddy => context.get<PlistBuddy>();
|
||||
|
||||
class PlistBuddy {
|
||||
const PlistBuddy();
|
||||
|
||||
static const String path = '/usr/libexec/PlistBuddy';
|
||||
|
||||
Future<ProcessResult> run(List<String> args) => processManager.run(<String>[path]..addAll(args));
|
||||
}
|
||||
|
||||
/// A property list is a key-value representation commonly used for
|
||||
/// configuration on macOS/iOS systems.
|
||||
class PropertyList {
|
||||
const PropertyList(this.plistPath);
|
||||
|
||||
final String plistPath;
|
||||
|
||||
/// Prints the specified key, or returns null if not present.
|
||||
Future<String> read(String key) async {
|
||||
final ProcessResult result = await _runCommand('Print $key');
|
||||
if (result.exitCode == 0)
|
||||
return result.stdout.trim();
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Adds [key]. Has no effect if the key already exists.
|
||||
Future<void> addString(String key, String value) async {
|
||||
await _runCommand('Add $key string $value');
|
||||
}
|
||||
|
||||
/// Updates [key] with the new [value]. Has no effect if the key does not exist.
|
||||
Future<void> update(String key, String value) async {
|
||||
await _runCommand('Set $key $value');
|
||||
}
|
||||
|
||||
/// Deletes [key].
|
||||
Future<void> delete(String key) async {
|
||||
await _runCommand('Delete $key');
|
||||
}
|
||||
|
||||
/// Deletes the content of the property list and creates a new root of the specified type.
|
||||
Future<void> clearToDict() async {
|
||||
await _runCommand('Clear dict');
|
||||
}
|
||||
|
||||
Future<ProcessResult> _runCommand(String command) async {
|
||||
return await plistBuddy.run(<String>['-c', command, plistPath]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Specialized exception for expected situations where the ideviceinfo
|
||||
/// tool responds with exit code 255 / 'No device found' message
|
||||
@@ -149,47 +100,6 @@ class IMobileDevice {
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the Xcode system.
|
||||
///
|
||||
/// Xcode 10 added a new (default) build system with better performance and
|
||||
/// stricter checks. Flutter apps without plugins build fine under the new
|
||||
/// system, but it causes build breakages in projects with CocoaPods enabled.
|
||||
/// This affects Flutter apps with plugins.
|
||||
///
|
||||
/// Once Flutter has been updated to be fully compliant with the new build
|
||||
/// system, this can be removed.
|
||||
//
|
||||
// TODO(cbracken): remove when https://github.com/flutter/flutter/issues/20685 is fixed.
|
||||
Future<void> setXcodeWorkspaceBuildSystem({
|
||||
@required Directory workspaceDirectory,
|
||||
@required File workspaceSettings,
|
||||
@required bool modern,
|
||||
}) async {
|
||||
// If this isn't a workspace, we're not using CocoaPods and can use the new
|
||||
// build system.
|
||||
if (!workspaceDirectory.existsSync())
|
||||
return;
|
||||
|
||||
final PropertyList plist = PropertyList(workspaceSettings.path);
|
||||
if (!workspaceSettings.existsSync()) {
|
||||
workspaceSettings.parent.createSync(recursive: true);
|
||||
await plist.clearToDict();
|
||||
}
|
||||
|
||||
const String kBuildSystemType = 'BuildSystemType';
|
||||
if (modern) {
|
||||
printTrace('Using new Xcode build system.');
|
||||
await plist.delete(kBuildSystemType);
|
||||
} else {
|
||||
printTrace('Using legacy Xcode build system.');
|
||||
if (await plist.read(kBuildSystemType) == null) {
|
||||
await plist.addString(kBuildSystemType, 'Original');
|
||||
} else {
|
||||
await plist.update(kBuildSystemType, 'Original');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<XcodeBuildResult> buildXcodeProject({
|
||||
BuildableIOSApp app,
|
||||
BuildInfo buildInfo,
|
||||
@@ -205,12 +115,6 @@ Future<XcodeBuildResult> buildXcodeProject({
|
||||
if (!_checkXcodeVersion())
|
||||
return XcodeBuildResult(success: false);
|
||||
|
||||
// TODO(cbracken): remove when https://github.com/flutter/flutter/issues/20685 is fixed.
|
||||
await setXcodeWorkspaceBuildSystem(
|
||||
workspaceDirectory: app.project.xcodeWorkspace,
|
||||
workspaceSettings: app.project.xcodeWorkspaceSharedSettings,
|
||||
modern: false,
|
||||
);
|
||||
|
||||
final XcodeProjectInfo projectInfo = await xcodeProjectInterpreter.getInfo(app.project.hostAppRoot.path);
|
||||
if (!projectInfo.targets.contains('Runner')) {
|
||||
|
||||
@@ -57,8 +57,8 @@ enum CocoaPodsStatus {
|
||||
class CocoaPods {
|
||||
Future<String> _versionText;
|
||||
|
||||
String get cocoaPodsMinimumVersion => '1.0.0';
|
||||
String get cocoaPodsRecommendedVersion => '1.5.0';
|
||||
String get cocoaPodsMinimumVersion => '1.6.0';
|
||||
String get cocoaPodsRecommendedVersion => '1.6.0';
|
||||
|
||||
Future<String> get cocoaPodsVersionText {
|
||||
_versionText ??= runAsync(<String>['pod', '--version']).then<String>((RunResult result) {
|
||||
|
||||
Reference in New Issue
Block a user