2017-07-13 01:35:08 +00:00
|
|
|
// Copyright 2017 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
import 'package:file/file.dart';
|
|
|
|
import 'package:file/memory.dart';
|
2018-02-16 09:17:28 +00:00
|
|
|
import 'package:flutter_tools/src/base/common.dart';
|
2017-07-13 01:35:08 +00:00
|
|
|
import 'package:flutter_tools/src/base/io.dart';
|
2018-02-15 21:55:36 +00:00
|
|
|
import 'package:flutter_tools/src/cache.dart';
|
2018-02-16 09:17:28 +00:00
|
|
|
import 'package:flutter_tools/src/ios/cocoapods.dart';
|
|
|
|
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
2017-07-13 01:35:08 +00:00
|
|
|
import 'package:mockito/mockito.dart';
|
|
|
|
import 'package:process/process.dart';
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
|
|
|
|
import '../src/context.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
FileSystem fs;
|
|
|
|
ProcessManager mockProcessManager;
|
2018-02-16 09:17:28 +00:00
|
|
|
MockXcodeProjectInterpreter mockXcodeProjectInterpreter;
|
2017-07-13 01:35:08 +00:00
|
|
|
Directory projectUnderTest;
|
|
|
|
CocoaPods cocoaPodsUnderTest;
|
|
|
|
|
|
|
|
setUp(() {
|
|
|
|
Cache.flutterRoot = 'flutter';
|
|
|
|
fs = new MemoryFileSystem();
|
|
|
|
mockProcessManager = new MockProcessManager();
|
2018-02-16 09:17:28 +00:00
|
|
|
mockXcodeProjectInterpreter = new MockXcodeProjectInterpreter();
|
2017-07-13 01:35:08 +00:00
|
|
|
projectUnderTest = fs.directory(fs.path.join('project', 'ios'))..createSync(recursive: true);
|
2018-02-16 09:17:28 +00:00
|
|
|
|
2017-07-13 01:35:08 +00:00
|
|
|
fs.file(fs.path.join(
|
|
|
|
Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-objc'
|
|
|
|
))
|
|
|
|
..createSync(recursive: true)
|
|
|
|
..writeAsStringSync('Objective-C podfile template');
|
|
|
|
fs.file(fs.path.join(
|
|
|
|
Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-swift'
|
|
|
|
))
|
|
|
|
..createSync(recursive: true)
|
|
|
|
..writeAsStringSync('Swift podfile template');
|
|
|
|
cocoaPodsUnderTest = const TestCocoaPods();
|
|
|
|
|
|
|
|
when(mockProcessManager.run(
|
|
|
|
<String>['pod', 'install', '--verbose'],
|
|
|
|
workingDirectory: 'project/ios',
|
2017-12-27 10:51:44 +00:00
|
|
|
environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true'},
|
2017-07-13 01:35:08 +00:00
|
|
|
)).thenReturn(exitsHappy);
|
|
|
|
});
|
|
|
|
|
2018-02-16 09:17:28 +00:00
|
|
|
group('Setup Podfile', () {
|
|
|
|
File podfile;
|
|
|
|
File debugConfigFile;
|
|
|
|
File releaseConfigFile;
|
|
|
|
|
|
|
|
setUp(() {
|
|
|
|
debugConfigFile = fs.file(fs.path.join('project', 'ios', 'Flutter', 'Debug.xcconfig'));
|
|
|
|
releaseConfigFile = fs.file(fs.path.join('project', 'ios', 'Flutter', 'Release.xcconfig'));
|
|
|
|
podfile = fs.file(fs.path.join('project', 'ios', 'Podfile'));
|
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('creates objective-c Podfile when not present', () {
|
|
|
|
cocoaPodsUnderTest.setupPodfile('project');
|
|
|
|
|
|
|
|
expect(podfile.readAsStringSync(), 'Objective-C podfile template');
|
|
|
|
}, overrides: <Type, Generator>{
|
2018-02-15 21:17:12 +00:00
|
|
|
FileSystem: () => fs,
|
2018-02-16 09:17:28 +00:00
|
|
|
});
|
2018-02-15 21:17:12 +00:00
|
|
|
|
2018-02-16 09:17:28 +00:00
|
|
|
testUsingContext('creates swift Podfile if swift', () {
|
2018-03-07 07:41:23 +00:00
|
|
|
when(mockXcodeProjectInterpreter.isInstalled).thenReturn(true);
|
2018-02-16 09:17:28 +00:00
|
|
|
when(mockXcodeProjectInterpreter.getBuildSettings(any, any)).thenReturn(<String, String>{
|
|
|
|
'SWIFT_VERSION': '4.0',
|
|
|
|
});
|
|
|
|
|
|
|
|
cocoaPodsUnderTest.setupPodfile('project');
|
|
|
|
|
|
|
|
expect(podfile.readAsStringSync(), 'Swift podfile template');
|
|
|
|
}, overrides: <Type, Generator>{
|
2018-02-15 21:17:12 +00:00
|
|
|
FileSystem: () => fs,
|
2018-02-16 09:17:28 +00:00
|
|
|
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
|
|
|
|
});
|
2018-02-15 21:17:12 +00:00
|
|
|
|
2018-02-16 09:17:28 +00:00
|
|
|
testUsingContext('does not recreate Podfile when already present', () {
|
|
|
|
podfile..createSync()..writeAsStringSync('Existing Podfile');
|
|
|
|
|
|
|
|
cocoaPodsUnderTest.setupPodfile('project');
|
|
|
|
|
|
|
|
expect(podfile.readAsStringSync(), 'Existing Podfile');
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
FileSystem: () => fs,
|
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('does not create Podfile when we cannot interpret Xcode projects', () {
|
2018-03-07 07:41:23 +00:00
|
|
|
when(mockXcodeProjectInterpreter.isInstalled).thenReturn(false);
|
2018-02-16 09:17:28 +00:00
|
|
|
|
|
|
|
cocoaPodsUnderTest.setupPodfile('project');
|
|
|
|
|
|
|
|
expect(podfile.existsSync(), false);
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
FileSystem: () => fs,
|
|
|
|
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
|
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('includes Pod config in xcconfig files, if not present', () {
|
|
|
|
podfile..createSync()..writeAsStringSync('Existing Podfile');
|
|
|
|
debugConfigFile..createSync(recursive: true)..writeAsStringSync('Existing debug config');
|
|
|
|
releaseConfigFile..createSync(recursive: true)..writeAsStringSync('Existing release config');
|
|
|
|
|
|
|
|
cocoaPodsUnderTest.setupPodfile('project');
|
|
|
|
|
|
|
|
final String debugContents = debugConfigFile.readAsStringSync();
|
|
|
|
expect(debugContents, contains(
|
|
|
|
'#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"\n'));
|
|
|
|
expect(debugContents, contains('Existing debug config'));
|
|
|
|
final String releaseContents = releaseConfigFile.readAsStringSync();
|
|
|
|
expect(releaseContents, contains(
|
|
|
|
'#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"\n'));
|
|
|
|
expect(releaseContents, contains('Existing release config'));
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
FileSystem: () => fs,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
group('Process pods', () {
|
|
|
|
testUsingContext('prints error, if CocoaPods is not installed', () async {
|
|
|
|
projectUnderTest.childFile('Podfile').createSync();
|
|
|
|
cocoaPodsUnderTest = const TestCocoaPods(false);
|
2017-07-13 01:35:08 +00:00
|
|
|
await cocoaPodsUnderTest.processPods(
|
2018-02-17 00:05:16 +00:00
|
|
|
appIosDirectory: projectUnderTest,
|
2017-12-27 10:51:44 +00:00
|
|
|
iosEngineDir: 'engine/path',
|
2017-12-27 15:30:31 +00:00
|
|
|
);
|
2018-02-16 09:17:28 +00:00
|
|
|
verifyNever(mockProcessManager.run(
|
|
|
|
typed<List<String>>(any),
|
|
|
|
workingDirectory: any,
|
|
|
|
environment: typed<Map<String, String>>(any, named: 'environment'),
|
2017-07-13 01:35:08 +00:00
|
|
|
));
|
2018-02-16 09:17:28 +00:00
|
|
|
expect(testLogger.errorText, contains('not installed'));
|
|
|
|
expect(testLogger.errorText, contains('Skipping pod install'));
|
|
|
|
}, overrides: <Type, Generator>{
|
2017-07-13 01:35:08 +00:00
|
|
|
FileSystem: () => fs,
|
|
|
|
ProcessManager: () => mockProcessManager,
|
2018-02-16 09:17:28 +00:00
|
|
|
});
|
2017-07-13 01:35:08 +00:00
|
|
|
|
2018-02-16 09:17:28 +00:00
|
|
|
testUsingContext('throws, if Podfile is missing.', () async {
|
|
|
|
cocoaPodsUnderTest = const TestCocoaPods(true);
|
2017-07-13 01:35:08 +00:00
|
|
|
try {
|
|
|
|
await cocoaPodsUnderTest.processPods(
|
2018-02-17 00:05:16 +00:00
|
|
|
appIosDirectory: projectUnderTest,
|
2017-12-27 10:51:44 +00:00
|
|
|
iosEngineDir: 'engine/path',
|
2017-07-13 01:35:08 +00:00
|
|
|
);
|
2018-02-16 09:17:28 +00:00
|
|
|
fail('ToolExit expected');
|
|
|
|
} catch(e) {
|
|
|
|
expect(e, const isInstanceOf<ToolExit>());
|
2017-07-13 01:35:08 +00:00
|
|
|
verifyNever(mockProcessManager.run(
|
2018-02-16 09:17:28 +00:00
|
|
|
typed<List<String>>(any),
|
|
|
|
workingDirectory: any,
|
|
|
|
environment: typed<Map<String, String>>(any, named: 'environment'),
|
2017-07-13 01:35:08 +00:00
|
|
|
));
|
|
|
|
}
|
2018-02-16 09:17:28 +00:00
|
|
|
}, overrides: <Type, Generator>{
|
2017-07-13 01:35:08 +00:00
|
|
|
FileSystem: () => fs,
|
|
|
|
ProcessManager: () => mockProcessManager,
|
2018-02-16 09:17:28 +00:00
|
|
|
});
|
2017-11-10 20:41:58 +00:00
|
|
|
|
2018-02-16 09:17:28 +00:00
|
|
|
testUsingContext('throws, if specs repo is outdated.', () async {
|
2017-11-10 20:41:58 +00:00
|
|
|
fs.file(fs.path.join('project', 'ios', 'Podfile'))
|
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing Podfile');
|
|
|
|
|
|
|
|
when(mockProcessManager.run(
|
|
|
|
<String>['pod', 'install', '--verbose'],
|
|
|
|
workingDirectory: 'project/ios',
|
2018-02-16 09:17:28 +00:00
|
|
|
environment: <String, String>{
|
|
|
|
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
|
|
'COCOAPODS_DISABLE_STATS': 'true',
|
|
|
|
},
|
2017-11-10 20:41:58 +00:00
|
|
|
)).thenReturn(new ProcessResult(
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
'''
|
|
|
|
[!] Unable to satisfy the following requirements:
|
|
|
|
|
|
|
|
- `Firebase/Auth` required by `Podfile`
|
|
|
|
- `Firebase/Auth (= 4.0.0)` required by `Podfile.lock`
|
|
|
|
|
|
|
|
None of your spec sources contain a spec satisfying the dependencies: `Firebase/Auth, Firebase/Auth (= 4.0.0)`.
|
|
|
|
|
|
|
|
You have either:
|
|
|
|
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
|
|
|
|
* mistyped the name or version.
|
|
|
|
* not added the source repo that hosts the Podspec to your Podfile.
|
|
|
|
|
|
|
|
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.''',
|
|
|
|
'',
|
|
|
|
));
|
|
|
|
try {
|
|
|
|
await cocoaPodsUnderTest.processPods(
|
2018-02-17 00:05:16 +00:00
|
|
|
appIosDirectory: projectUnderTest,
|
2017-12-27 10:51:44 +00:00
|
|
|
iosEngineDir: 'engine/path',
|
2018-02-16 09:17:28 +00:00
|
|
|
);
|
|
|
|
fail('ToolExit expected');
|
|
|
|
} catch (e) {
|
|
|
|
expect(e, const isInstanceOf<ToolExit>());
|
|
|
|
expect(
|
|
|
|
testLogger.errorText,
|
|
|
|
contains("CocoaPods's specs repository is too out-of-date to satisfy dependencies"),
|
|
|
|
);
|
2017-11-10 20:41:58 +00:00
|
|
|
}
|
2018-02-16 09:17:28 +00:00
|
|
|
}, overrides: <Type, Generator>{
|
2017-11-10 20:41:58 +00:00
|
|
|
FileSystem: () => fs,
|
|
|
|
ProcessManager: () => mockProcessManager,
|
2018-02-16 09:17:28 +00:00
|
|
|
});
|
2017-12-27 15:30:31 +00:00
|
|
|
|
2018-02-16 09:17:28 +00:00
|
|
|
testUsingContext('run pod install, if Podfile.lock is missing', () async {
|
|
|
|
projectUnderTest.childFile('Podfile')
|
2017-12-27 15:30:31 +00:00
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing Podfile');
|
2018-02-16 09:17:28 +00:00
|
|
|
projectUnderTest.childFile('Pods/Manifest.lock')
|
2017-12-27 15:30:31 +00:00
|
|
|
..createSync(recursive: true)
|
2018-02-16 09:17:28 +00:00
|
|
|
..writeAsString('Existing lock file.');
|
2017-12-27 15:30:31 +00:00
|
|
|
await cocoaPodsUnderTest.processPods(
|
2018-02-17 00:05:16 +00:00
|
|
|
appIosDirectory: projectUnderTest,
|
2018-02-16 09:17:28 +00:00
|
|
|
iosEngineDir: 'engine/path',
|
|
|
|
flutterPodChanged: false,
|
2017-12-27 15:30:31 +00:00
|
|
|
);
|
2018-02-15 21:17:12 +00:00
|
|
|
verify(mockProcessManager.run(
|
2017-12-27 15:30:31 +00:00
|
|
|
<String>['pod', 'install', '--verbose'],
|
|
|
|
workingDirectory: 'project/ios',
|
2018-02-15 21:55:36 +00:00
|
|
|
environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true'},
|
2017-12-27 15:30:31 +00:00
|
|
|
));
|
2018-02-16 09:17:28 +00:00
|
|
|
}, overrides: <Type, Generator>{
|
2017-12-27 15:30:31 +00:00
|
|
|
FileSystem: () => fs,
|
|
|
|
ProcessManager: () => mockProcessManager,
|
2018-02-16 09:17:28 +00:00
|
|
|
});
|
2018-02-15 21:17:12 +00:00
|
|
|
|
2018-02-16 09:17:28 +00:00
|
|
|
testUsingContext('runs pod install, if Manifest.lock is missing', () async {
|
|
|
|
projectUnderTest.childFile('Podfile')
|
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing Podfile');
|
|
|
|
projectUnderTest.childFile('Podfile.lock')
|
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing lock file.');
|
|
|
|
await cocoaPodsUnderTest.processPods(
|
2018-02-17 00:05:16 +00:00
|
|
|
appIosDirectory: projectUnderTest,
|
2018-02-16 09:17:28 +00:00
|
|
|
iosEngineDir: 'engine/path',
|
|
|
|
flutterPodChanged: false,
|
|
|
|
);
|
|
|
|
verify(mockProcessManager.run(
|
|
|
|
<String>['pod', 'install', '--verbose'],
|
|
|
|
workingDirectory: 'project/ios',
|
|
|
|
environment: <String, String>{
|
|
|
|
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
|
|
'COCOAPODS_DISABLE_STATS': 'true',
|
|
|
|
},
|
|
|
|
));
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
FileSystem: () => fs,
|
|
|
|
ProcessManager: () => mockProcessManager,
|
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('runs pod install, if Manifest.lock different from Podspec.lock', () async {
|
|
|
|
projectUnderTest.childFile('Podfile')
|
2018-02-15 21:17:12 +00:00
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing Podfile');
|
2018-02-16 09:17:28 +00:00
|
|
|
projectUnderTest.childFile('Podfile.lock')
|
2018-02-15 21:17:12 +00:00
|
|
|
..createSync()
|
2018-02-16 09:17:28 +00:00
|
|
|
..writeAsString('Existing lock file.');
|
|
|
|
projectUnderTest.childFile('Pods/Manifest.lock')
|
2018-02-15 21:17:12 +00:00
|
|
|
..createSync(recursive: true)
|
2018-02-16 09:17:28 +00:00
|
|
|
..writeAsString('Different lock file.');
|
2018-02-15 21:17:12 +00:00
|
|
|
await cocoaPodsUnderTest.processPods(
|
2018-02-17 00:05:16 +00:00
|
|
|
appIosDirectory: projectUnderTest,
|
2018-02-16 09:17:28 +00:00
|
|
|
iosEngineDir: 'engine/path',
|
|
|
|
flutterPodChanged: false,
|
2018-02-15 21:17:12 +00:00
|
|
|
);
|
2018-02-16 09:17:28 +00:00
|
|
|
verify(mockProcessManager.run(
|
2018-02-15 21:17:12 +00:00
|
|
|
<String>['pod', 'install', '--verbose'],
|
|
|
|
workingDirectory: 'project/ios',
|
2018-02-16 09:17:28 +00:00
|
|
|
environment: <String, String>{
|
|
|
|
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
|
|
'COCOAPODS_DISABLE_STATS': 'true',
|
|
|
|
},
|
2018-02-15 21:17:12 +00:00
|
|
|
));
|
2018-02-16 09:17:28 +00:00
|
|
|
}, overrides: <Type, Generator>{
|
2018-02-15 21:17:12 +00:00
|
|
|
FileSystem: () => fs,
|
|
|
|
ProcessManager: () => mockProcessManager,
|
2018-02-16 09:17:28 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('runs pod install, if flutter framework changed', () async {
|
|
|
|
projectUnderTest.childFile('Podfile')
|
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing Podfile');
|
|
|
|
projectUnderTest.childFile('Podfile.lock')
|
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing lock file.');
|
|
|
|
projectUnderTest.childFile('Pods/Manifest.lock')
|
|
|
|
..createSync(recursive: true)
|
|
|
|
..writeAsString('Existing lock file.');
|
|
|
|
await cocoaPodsUnderTest.processPods(
|
2018-02-17 00:05:16 +00:00
|
|
|
appIosDirectory: projectUnderTest,
|
2018-02-16 09:17:28 +00:00
|
|
|
iosEngineDir: 'engine/path',
|
|
|
|
flutterPodChanged: true,
|
|
|
|
);
|
|
|
|
verify(mockProcessManager.run(
|
|
|
|
<String>['pod', 'install', '--verbose'],
|
|
|
|
workingDirectory: 'project/ios',
|
|
|
|
environment: <String, String>{
|
|
|
|
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
|
|
'COCOAPODS_DISABLE_STATS': 'true',
|
|
|
|
},
|
|
|
|
));
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
FileSystem: () => fs,
|
|
|
|
ProcessManager: () => mockProcessManager,
|
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('skips pod install, if nothing changed', () async {
|
|
|
|
projectUnderTest.childFile('Podfile')
|
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing Podfile');
|
|
|
|
projectUnderTest.childFile('Podfile.lock')
|
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing lock file.');
|
|
|
|
projectUnderTest.childFile('Pods/Manifest.lock')
|
|
|
|
..createSync(recursive: true)
|
|
|
|
..writeAsString('Existing lock file.');
|
|
|
|
await cocoaPodsUnderTest.processPods(
|
2018-02-17 00:05:16 +00:00
|
|
|
appIosDirectory: projectUnderTest,
|
2018-02-16 09:17:28 +00:00
|
|
|
iosEngineDir: 'engine/path',
|
|
|
|
flutterPodChanged: false,
|
|
|
|
);
|
|
|
|
verifyNever(mockProcessManager.run(
|
|
|
|
typed<List<String>>(any),
|
|
|
|
workingDirectory: any,
|
|
|
|
environment: typed<Map<String, String>>(any, named: 'environment'),
|
|
|
|
));
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
FileSystem: () => fs,
|
|
|
|
ProcessManager: () => mockProcessManager,
|
|
|
|
});
|
2018-02-17 00:05:16 +00:00
|
|
|
|
|
|
|
testUsingContext('a failed pod install deletes Pods/Manifest.lock', () async {
|
|
|
|
projectUnderTest.childFile('Podfile')
|
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing Podfile');
|
|
|
|
projectUnderTest.childFile('Podfile.lock')
|
|
|
|
..createSync()
|
|
|
|
..writeAsString('Existing lock file.');
|
|
|
|
projectUnderTest.childFile('Pods/Manifest.lock')
|
|
|
|
..createSync(recursive: true)
|
|
|
|
..writeAsString('Existing lock file.');
|
|
|
|
|
|
|
|
when(mockProcessManager.run(
|
|
|
|
<String>['pod', 'install', '--verbose'],
|
|
|
|
workingDirectory: 'project/ios',
|
|
|
|
environment: <String, String>{
|
|
|
|
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
|
|
'COCOAPODS_DISABLE_STATS': 'true',
|
|
|
|
},
|
|
|
|
)).thenReturn(new ProcessResult(1, 1, 'fails for some reason', ''));
|
|
|
|
|
|
|
|
try {
|
|
|
|
await cocoaPodsUnderTest.processPods(
|
|
|
|
appIosDirectory: projectUnderTest,
|
|
|
|
iosEngineDir: 'engine/path',
|
|
|
|
flutterPodChanged: true,
|
|
|
|
);
|
|
|
|
fail('Tool throw expected when pod install fails');
|
|
|
|
} on ToolExit {
|
|
|
|
expect(projectUnderTest.childFile('Pods/Manifest.lock').existsSync(), isFalse);
|
|
|
|
}
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
FileSystem: () => fs,
|
|
|
|
ProcessManager: () => mockProcessManager,
|
|
|
|
});
|
2018-02-16 09:17:28 +00:00
|
|
|
});
|
2017-07-13 01:35:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class MockProcessManager extends Mock implements ProcessManager {}
|
2018-02-16 09:17:28 +00:00
|
|
|
class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {}
|
2017-07-13 01:35:08 +00:00
|
|
|
|
|
|
|
class TestCocoaPods extends CocoaPods {
|
|
|
|
const TestCocoaPods([this._hasCocoaPods = true]);
|
|
|
|
|
|
|
|
final bool _hasCocoaPods;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<bool> get hasCocoaPods => new Future<bool>.value(_hasCocoaPods);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<String> get cocoaPodsVersionText async => new Future<String>.value('1.5.0');
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<bool> get isCocoaPodsInitialized => new Future<bool>.value(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
final ProcessResult exitsHappy = new ProcessResult(
|
2018-02-02 22:27:29 +00:00
|
|
|
1, // pid
|
|
|
|
0, // exitCode
|
|
|
|
'', // stdout
|
|
|
|
'', // stderr
|
2017-07-13 01:35:08 +00:00
|
|
|
);
|