Unverified Commit 1eb1e222 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Skip pod initialization if version >= 1.8.0. (#41491)

parent 4891e4a3
...@@ -414,7 +414,7 @@ task: ...@@ -414,7 +414,7 @@ task:
print_date_script: print_date_script:
- date - date
install_cocoapods_script: install_cocoapods_script:
- sudo gem install cocoapods -v 1.7.5 --no-document - sudo gem install cocoapods --no-document
git_fetch_script: git_fetch_script:
- git clean -xfd - git clean -xfd
- git fetch origin - git fetch origin
...@@ -486,7 +486,7 @@ task: ...@@ -486,7 +486,7 @@ task:
print_date_script: print_date_script:
- date - date
install_cocoapods_script: install_cocoapods_script:
- sudo gem install cocoapods -v 1.7.5 --no-document - sudo gem install cocoapods --no-document
git_fetch_script: git_fetch_script:
- git clean -xfd - git clean -xfd
- git fetch origin - git fetch origin
......
# 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 # Uncomment this line to define a global platform for your project
# platform :ios, '9.0' # platform :ios, '9.0'
......
...@@ -35,12 +35,10 @@ const String brokenCocoaPodsConsequence = ''' ...@@ -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.'''; This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.''';
const String cocoaPodsInstallInstructions = ''' const String cocoaPodsInstallInstructions = '''
sudo gem install cocoapods sudo gem install cocoapods''';
pod setup''';
const String cocoaPodsUpgradeInstructions = ''' const String cocoaPodsUpgradeInstructions = '''
sudo gem install cocoapods sudo gem install cocoapods''';
pod setup''';
CocoaPods get cocoaPods => context.get<CocoaPods>(); CocoaPods get cocoaPods => context.get<CocoaPods>();
...@@ -105,12 +103,20 @@ class CocoaPods { ...@@ -105,12 +103,20 @@ class CocoaPods {
/// Whether CocoaPods ran 'pod setup' once where the costly pods' specs are /// Whether CocoaPods ran 'pod setup' once where the costly pods' specs are
/// cloned. /// 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 /// A user can override the default location via the CP_REPOS_DIR environment
/// variable. /// variable.
/// ///
/// See https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/config.rb#L138 /// See https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/config.rb#L138
/// for details of this variable. /// 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'); final String cocoapodsReposDir = platform.environment['CP_REPOS_DIR'] ?? fs.path.join(homeDirPath, '.cocoapods', 'repos');
return fs.isDirectory(fs.path.join(cocoapodsReposDir, 'master')); return fs.isDirectory(fs.path.join(cocoapodsReposDir, 'master'));
} }
......
# 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 # Uncomment this line to define a global platform for your project
# platform :ios, '9.0' # platform :ios, '9.0'
......
# 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 # Uncomment this line to define a global platform for your project
# platform :ios, '9.0' # platform :ios, '9.0'
......
# 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' platform :osx, '10.11'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
......
...@@ -160,6 +160,16 @@ void main() { ...@@ -160,6 +160,16 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager, 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', () { group('Setup Podfile', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment