Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
85ded441
Commit
85ded441
authored
Jan 03, 2019
by
KyleWong
Committed by
xster
Jan 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize cocoapods logic in flutter doctor. (#25872)
parent
4b87e334
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
0 deletions
+44
-0
user_messages.dart
packages/flutter_tools/lib/src/base/user_messages.dart
+5
-0
cocoapods.dart
packages/flutter_tools/lib/src/ios/cocoapods.dart
+17
-0
ios_workflow.dart
packages/flutter_tools/lib/src/ios/ios_workflow.dart
+5
-0
cocoapods_test.dart
packages/flutter_tools/test/ios/cocoapods_test.dart
+7
-0
ios_workflow_test.dart
packages/flutter_tools/test/ios/ios_workflow_test.dart
+10
-0
No files found.
packages/flutter_tools/lib/src/base/user_messages.dart
View file @
85ded441
...
...
@@ -170,6 +170,11 @@ class UserMessages {
'
$consequence
\n
'
'To install:
\n
'
'
$installInstructions
'
;
String
cocoaPodsUnknownVersion
(
String
consequence
,
String
upgradeInstructions
)
=>
'Unknown CocoaPods version installed.
\n
'
'
$consequence
\n
'
'To upgrade:
\n
'
'
$upgradeInstructions
'
;
String
cocoaPodsOutdated
(
String
recVersion
,
String
consequence
,
String
upgradeInstructions
)
=>
'CocoaPods out of date (
$recVersion
is recommended).
\n
'
'
$consequence
\n
'
...
...
packages/flutter_tools/lib/src/ios/cocoapods.dart
View file @
85ded441
...
...
@@ -24,6 +24,10 @@ const String noCocoaPodsConsequence = '''
Without
resolving
iOS
dependencies
with
CocoaPods
,
plugins
will
not
work
on
iOS
.
For
more
info
,
see
https:
//flutter.io/platform-plugins''';
const
String
unknownCocoaPodsConsequence
=
'''
Flutter is unable to determine the installed CocoaPods'
s
version
.
Ensure
that
the
output
of
'pod --version'
contains
only
digits
and
.
to
be
recognized
by
Flutter
.
''';
const String cocoaPodsInstallInstructions = '''
brew
install
cocoapods
pod
setup
''';
...
...
@@ -38,6 +42,8 @@ CocoaPods get cocoaPods => context[CocoaPods];
enum CocoaPodsStatus {
/// iOS plugins will not work, installation required.
notInstalled,
/// iOS plugins might not work, upgrade recommended.
unknownVersion,
/// iOS plugins will not work, upgrade required.
belowMinimumVersion,
/// iOS plugins may not work in certain situations (Swift, static libraries),
...
...
@@ -66,6 +72,8 @@ class CocoaPods {
return CocoaPodsStatus.notInstalled;
try {
final Version installedVersion = Version.parse(versionText);
if (installedVersion == null)
return CocoaPodsStatus.unknownVersion;
if (installedVersion < Version.parse(cocoaPodsMinimumVersion))
return CocoaPodsStatus.belowMinimumVersion;
else if (installedVersion < Version.parse(cocoaPodsRecommendedVersion))
...
...
@@ -112,6 +120,15 @@ class CocoaPods {
emphasis:
true
,
);
return
false
;
case
CocoaPodsStatus
.
unknownVersion
:
printError
(
'Warning: Unknown CocoaPods version installed.
\n
'
'
$unknownCocoaPodsConsequence
\n
'
'To upgrade:
\n
'
'
$cocoaPodsUpgradeInstructions
\n
'
,
emphasis:
true
,
);
break
;
case
CocoaPodsStatus
.
belowMinimumVersion
:
printError
(
'Warning: CocoaPods minimum required version
$cocoaPodsMinimumVersion
or greater not installed. Skipping pod install.
\n
'
...
...
packages/flutter_tools/lib/src/ios/ios_workflow.dart
View file @
85ded441
...
...
@@ -192,6 +192,11 @@ class CocoaPodsValidator extends DoctorValidator {
status
=
ValidationType
.
missing
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
cocoaPodsMissing
(
noCocoaPodsConsequence
,
cocoaPodsInstallInstructions
)));
}
else
if
(
cocoaPodsStatus
==
CocoaPodsStatus
.
unknownVersion
)
{
status
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
hint
(
userMessages
.
cocoaPodsUnknownVersion
(
unknownCocoaPodsConsequence
,
cocoaPodsUpgradeInstructions
)));
}
else
{
status
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
hint
(
...
...
packages/flutter_tools/test/ios/cocoapods_test.dart
View file @
85ded441
...
...
@@ -94,6 +94,13 @@ void main() {
ProcessManager:
()
=>
mockProcessManager
,
});
testUsingContext
(
'detects unknown version'
,
()
async
{
pretendPodVersionIs
(
'Plugin loaded.
\n
1.5.3'
);
expect
(
await
cocoaPodsUnderTest
.
evaluateCocoaPodsInstallation
,
CocoaPodsStatus
.
unknownVersion
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
});
testUsingContext
(
'detects below minimum version'
,
()
async
{
pretendPodVersionIs
(
'0.39.8'
);
expect
(
await
cocoaPodsUnderTest
.
evaluateCocoaPodsInstallation
,
CocoaPodsStatus
.
belowMinimumVersion
);
...
...
packages/flutter_tools/test/ios/ios_workflow_test.dart
View file @
85ded441
...
...
@@ -297,6 +297,16 @@ Show information about a connected device.
CocoaPods:
()
=>
cocoaPods
,
});
testUsingContext
(
'Emits partial status when CocoaPods is installed with unknown version'
,
()
async
{
when
(
cocoaPods
.
evaluateCocoaPodsInstallation
)
.
thenAnswer
((
_
)
async
=>
CocoaPodsStatus
.
unknownVersion
);
final
CocoaPodsTestTarget
workflow
=
CocoaPodsTestTarget
();
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
CocoaPods:
()
=>
cocoaPods
,
});
testUsingContext
(
'Emits partial status when CocoaPods is not initialized'
,
()
async
{
when
(
cocoaPods
.
isCocoaPodsInitialized
).
thenAnswer
((
_
)
async
=>
false
);
final
CocoaPodsTestTarget
workflow
=
CocoaPodsTestTarget
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment