Revert pod install skip revert (#13774)

* Revert "Revert "Enable developers to run pod from terminal directly and skip pod install if possible. (#13374)" (#13770)"

This reverts commit 0759043e47.

* some nits on cocoapods code

* put back the FLUTTER_FRAMEWORK_DIR env variable
This commit is contained in:
xster
2017-12-27 07:30:31 -08:00
committed by GitHub
parent 0759043e47
commit 4d2c2aaaa1
7 changed files with 207 additions and 60 deletions

View File

@@ -95,7 +95,8 @@ void main() {
await cocoaPodsUnderTest.processPods(
appIosDir: projectUnderTest,
iosEngineDir: 'engine/path',
); expect(fs.file(fs.path.join('project', 'ios', 'Podfile')).readAsStringSync() , 'Existing Podfile');
);
expect(fs.file(fs.path.join('project', 'ios', 'Podfile')).readAsStringSync() , 'Existing Podfile');
verify(mockProcessManager.run(
<String>['pod', 'install', '--verbose'],
workingDirectory: 'project/ios',
@@ -177,6 +178,64 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
ProcessManager: () => mockProcessManager,
},
);
testUsingContext(
'Run pod install if plugins or flutter framework have changes.',
() async {
fs.file(fs.path.join('project', 'ios', 'Podfile'))
..createSync()
..writeAsString('Existing Podfile');
fs.file(fs.path.join('project', 'ios', 'Podfile.lock'))
..createSync()
..writeAsString('Existing lock files.');
fs.file(fs.path.join('project', 'ios', 'Pods','Manifest.lock'))
..createSync(recursive: true)
..writeAsString('Existing lock files.');
await cocoaPodsUnderTest.processPods(
appIosDir: projectUnderTest,
iosEngineDir: 'engine/path',
pluginOrFlutterPodChanged: 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(
'Skip pod install if plugins and flutter framework remain unchanged.',
() async {
fs.file(fs.path.join('project', 'ios', 'Podfile'))
..createSync()
..writeAsString('Existing Podfile');
fs.file(fs.path.join('project', 'ios', 'Podfile.lock'))
..createSync()
..writeAsString('Existing lock files.');
fs.file(fs.path.join('project', 'ios', 'Pods','Manifest.lock'))
..createSync(recursive: true)
..writeAsString('Existing lock files.');
await cocoaPodsUnderTest.processPods(
appIosDir: projectUnderTest,
iosEngineDir: 'engine/path',
pluginOrFlutterPodChanged: false
);
verifyNever(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,
},
);
}
class MockProcessManager extends Mock implements ProcessManager {}