Disable CocoaPods input and output paths in Xcode build phase and adopt new Xcode build system (#33852)
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:
@@ -473,8 +473,8 @@ void main() {
|
||||
|
||||
await runner.run(<String>['create', '--template=module', '--no-pub', '--org', 'com.foo.bar', projectDir.path]);
|
||||
|
||||
void expectExists(String relPath) {
|
||||
expect(fs.isFileSync('${projectDir.path}/$relPath'), true);
|
||||
void expectExists(String relPath, [bool expectation = true]) {
|
||||
expect(fs.isFileSync('${projectDir.path}/$relPath'), expectation);
|
||||
}
|
||||
|
||||
expectExists('lib/main.dart');
|
||||
@@ -515,6 +515,9 @@ void main() {
|
||||
final File xcodeProjectFile = fs.file(fs.path.join(projectDir.path, xcodeProjectPath));
|
||||
final String xcodeProject = xcodeProjectFile.readAsStringSync();
|
||||
expect(xcodeProject, contains('PRODUCT_BUNDLE_IDENTIFIER = com.foo.bar.flutterProject'));
|
||||
// Xcode build system
|
||||
final String xcodeWorkspaceSettingsPath = fs.path.join('.ios', 'Runner.xcworkspace', 'xcshareddata', 'WorkspaceSettings.xcsettings');
|
||||
expectExists(xcodeWorkspaceSettingsPath, false);
|
||||
|
||||
final String versionPath = fs.path.join('.metadata');
|
||||
expectExists(versionPath);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart' show ProcessException, ProcessResult;
|
||||
import 'package:flutter_tools/src/ios/mac.dart';
|
||||
@@ -29,73 +28,6 @@ class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterprete
|
||||
class MockIosProject extends Mock implements IosProject {}
|
||||
|
||||
void main() {
|
||||
group('PropertyList', () {
|
||||
MockProcessManager mockProcessManager;
|
||||
MemoryFileSystem fs;
|
||||
Directory workspaceDirectory;
|
||||
File workspaceSettingsFile;
|
||||
|
||||
setUp(() {
|
||||
mockProcessManager = MockProcessManager();
|
||||
fs = MemoryFileSystem();
|
||||
workspaceDirectory = fs.directory('Runner.xcworkspace');
|
||||
workspaceSettingsFile = workspaceDirectory.childDirectory('xcshareddata').childFile('WorkspaceSettings.xcsettings');
|
||||
});
|
||||
|
||||
testUsingContext('does nothing if workspace directory does not exist', () async {
|
||||
await setXcodeWorkspaceBuildSystem(workspaceDirectory: workspaceDirectory, workspaceSettings: workspaceSettingsFile, modern: false);
|
||||
verifyNever(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Print BuildSystemType', workspaceSettingsFile.path]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
|
||||
testUsingContext('creates dict-based plist if settings file does not exist', () async {
|
||||
workspaceSettingsFile.parent.createSync(recursive: true);
|
||||
when(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Print BuildSystemType', workspaceSettingsFile.path]))
|
||||
.thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 1, '', '')));
|
||||
await setXcodeWorkspaceBuildSystem(workspaceDirectory: workspaceDirectory, workspaceSettings: workspaceSettingsFile, modern: false);
|
||||
verify(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Clear dict', workspaceSettingsFile.path]));
|
||||
verify(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Add BuildSystemType string Original', workspaceSettingsFile.path]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
|
||||
testUsingContext('writes legacy build mode settings if requested and not present', () async {
|
||||
workspaceSettingsFile.createSync(recursive: true);
|
||||
when(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Print BuildSystemType', workspaceSettingsFile.path]))
|
||||
.thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 1, '', '')));
|
||||
await setXcodeWorkspaceBuildSystem(workspaceDirectory: workspaceDirectory, workspaceSettings: workspaceSettingsFile, modern: false);
|
||||
verify(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Add BuildSystemType string Original', workspaceSettingsFile.path]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
|
||||
testUsingContext('updates legacy build mode setting if requested and existing setting is present', () async {
|
||||
workspaceSettingsFile.createSync(recursive: true);
|
||||
when(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Print BuildSystemType', workspaceSettingsFile.path]))
|
||||
.thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 0, 'FancyNewOne', '')));
|
||||
await setXcodeWorkspaceBuildSystem(workspaceDirectory: workspaceDirectory, workspaceSettings: workspaceSettingsFile, modern: false);
|
||||
verify(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Set BuildSystemType Original', workspaceSettingsFile.path]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
|
||||
testUsingContext('deletes legacy build mode setting if modern build mode requested', () async {
|
||||
workspaceSettingsFile.createSync(recursive: true);
|
||||
when(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Print BuildSystemType', workspaceSettingsFile.path]))
|
||||
.thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 0, 'Original', '')));
|
||||
await setXcodeWorkspaceBuildSystem(workspaceDirectory: workspaceDirectory, workspaceSettings: workspaceSettingsFile, modern: true);
|
||||
verify(mockProcessManager.run(<String>[PlistBuddy.path, '-c', 'Delete BuildSystemType', workspaceSettingsFile.path]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
});
|
||||
|
||||
group('IMobileDevice', () {
|
||||
final FakePlatform osx = FakePlatform.fromPlatform(const LocalPlatform())
|
||||
..operatingSystem = 'macos';
|
||||
|
||||
@@ -60,7 +60,7 @@ void main() {
|
||||
projectUnderTest = FlutterProject.fromDirectory(fs.directory('project'));
|
||||
projectUnderTest.ios.xcodeProject.createSync(recursive: true);
|
||||
cocoaPodsUnderTest = CocoaPods();
|
||||
pretendPodVersionIs('1.5.0');
|
||||
pretendPodVersionIs('1.6.0');
|
||||
fs.file(fs.path.join(
|
||||
Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-ios-objc',
|
||||
))
|
||||
@@ -123,28 +123,21 @@ void main() {
|
||||
});
|
||||
|
||||
testUsingContext('detects below minimum version', () async {
|
||||
pretendPodVersionIs('0.39.8');
|
||||
pretendPodVersionIs('1.5.0');
|
||||
expect(await cocoaPodsUnderTest.evaluateCocoaPodsInstallation, CocoaPodsStatus.belowMinimumVersion);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
|
||||
testUsingContext('detects below recommended version', () async {
|
||||
pretendPodVersionIs('1.4.99');
|
||||
expect(await cocoaPodsUnderTest.evaluateCocoaPodsInstallation, CocoaPodsStatus.belowRecommendedVersion);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
|
||||
testUsingContext('detects at recommended version', () async {
|
||||
pretendPodVersionIs('1.5.0');
|
||||
pretendPodVersionIs('1.6.0');
|
||||
expect(await cocoaPodsUnderTest.evaluateCocoaPodsInstallation, CocoaPodsStatus.recommended);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
|
||||
testUsingContext('detects above recommended version', () async {
|
||||
pretendPodVersionIs('1.5.1');
|
||||
pretendPodVersionIs('1.6.1');
|
||||
expect(await cocoaPodsUnderTest.evaluateCocoaPodsInstallation, CocoaPodsStatus.recommended);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
|
||||
Reference in New Issue
Block a user