Skip pod initialization if version >= 1.8.0. (#41491)
This commit is contained in:
@@ -414,7 +414,7 @@ task:
|
||||
print_date_script:
|
||||
- date
|
||||
install_cocoapods_script:
|
||||
- sudo gem install cocoapods -v 1.7.5 --no-document
|
||||
- sudo gem install cocoapods --no-document
|
||||
git_fetch_script:
|
||||
- git clean -xfd
|
||||
- git fetch origin
|
||||
@@ -486,7 +486,7 @@ task:
|
||||
print_date_script:
|
||||
- date
|
||||
install_cocoapods_script:
|
||||
- sudo gem install cocoapods -v 1.7.5 --no-document
|
||||
- sudo gem install cocoapods --no-document
|
||||
git_fetch_script:
|
||||
- git clean -xfd
|
||||
- git fetch origin
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# Using a CDN with CocoaPods 1.7.2 or later can save a lot of time on pod installation, but it's experimental rather than the default.
|
||||
# source 'https://cdn.cocoapods.org/'
|
||||
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
|
||||
@@ -35,12 +35,10 @@ const String brokenCocoaPodsConsequence = '''
|
||||
This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.''';
|
||||
|
||||
const String cocoaPodsInstallInstructions = '''
|
||||
sudo gem install cocoapods
|
||||
pod setup''';
|
||||
sudo gem install cocoapods''';
|
||||
|
||||
const String cocoaPodsUpgradeInstructions = '''
|
||||
sudo gem install cocoapods
|
||||
pod setup''';
|
||||
sudo gem install cocoapods''';
|
||||
|
||||
CocoaPods get cocoaPods => context.get<CocoaPods>();
|
||||
|
||||
@@ -105,12 +103,20 @@ class CocoaPods {
|
||||
/// Whether CocoaPods ran 'pod setup' once where the costly pods' specs are
|
||||
/// cloned.
|
||||
///
|
||||
/// Versions >= 1.8.0 do not require 'pod setup' and default to a CDN instead
|
||||
/// of a locally cloned repository.
|
||||
/// See http://blog.cocoapods.org/CocoaPods-1.8.0-beta/
|
||||
///
|
||||
/// A user can override the default location via the CP_REPOS_DIR environment
|
||||
/// variable.
|
||||
///
|
||||
/// See https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/config.rb#L138
|
||||
/// for details of this variable.
|
||||
Future<bool> get isCocoaPodsInitialized {
|
||||
Future<bool> get isCocoaPodsInitialized async {
|
||||
final Version installedVersion = Version.parse(await cocoaPodsVersionText);
|
||||
if (installedVersion != null && installedVersion >= Version.parse('1.8.0')) {
|
||||
return true;
|
||||
}
|
||||
final String cocoapodsReposDir = platform.environment['CP_REPOS_DIR'] ?? fs.path.join(homeDirPath, '.cocoapods', 'repos');
|
||||
return fs.isDirectory(fs.path.join(cocoapodsReposDir, 'master'));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# Using a CDN with CocoaPods 1.7.2 or later can save a lot of time on pod installation, but it's experimental rather than the default.
|
||||
# source 'https://cdn.cocoapods.org/'
|
||||
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# Using a CDN with CocoaPods 1.7.2 or later can save a lot of time on pod installation, but it's experimental rather than the default.
|
||||
# source 'https://cdn.cocoapods.org/'
|
||||
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# Using a CDN with CocoaPods 1.7.2 or later can save a lot of time on pod installation, but it's experimental rather than the default.
|
||||
# source 'https://cdn.cocoapods.org/'
|
||||
|
||||
platform :osx, '10.11'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
|
||||
@@ -160,6 +160,16 @@ void main() {
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
|
||||
testUsingContext('detects initialized over 1.8.0', () async {
|
||||
pretendPodIsInstalled();
|
||||
pretendPodVersionIs('1.8.0');
|
||||
expect(await cocoaPodsUnderTest.isCocoaPodsInitialized, isTrue);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
Platform: () => FakePlatform(),
|
||||
FileSystem: () => fs,
|
||||
});
|
||||
});
|
||||
|
||||
group('Setup Podfile', () {
|
||||
|
||||
Reference in New Issue
Block a user