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
Show 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 {
...
@@ -170,6 +170,11 @@ class UserMessages {
'
$consequence
\n
'
'
$consequence
\n
'
'To install:
\n
'
'To install:
\n
'
'
$installInstructions
'
;
'
$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
)
=>
String
cocoaPodsOutdated
(
String
recVersion
,
String
consequence
,
String
upgradeInstructions
)
=>
'CocoaPods out of date (
$recVersion
is recommended).
\n
'
'CocoaPods out of date (
$recVersion
is recommended).
\n
'
'
$consequence
\n
'
'
$consequence
\n
'
...
...
packages/flutter_tools/lib/src/ios/cocoapods.dart
View file @
85ded441
...
@@ -24,6 +24,10 @@ const String noCocoaPodsConsequence = '''
...
@@ -24,6 +24,10 @@ const String noCocoaPodsConsequence = '''
Without
resolving
iOS
dependencies
with
CocoaPods
,
plugins
will
not
work
on
iOS
.
Without
resolving
iOS
dependencies
with
CocoaPods
,
plugins
will
not
work
on
iOS
.
For
more
info
,
see
https:
//flutter.io/platform-plugins''';
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 = '''
const String cocoaPodsInstallInstructions = '''
brew
install
cocoapods
brew
install
cocoapods
pod
setup
''';
pod
setup
''';
...
@@ -38,6 +42,8 @@ CocoaPods get cocoaPods => context[CocoaPods];
...
@@ -38,6 +42,8 @@ CocoaPods get cocoaPods => context[CocoaPods];
enum CocoaPodsStatus {
enum CocoaPodsStatus {
/// iOS plugins will not work, installation required.
/// iOS plugins will not work, installation required.
notInstalled,
notInstalled,
/// iOS plugins might not work, upgrade recommended.
unknownVersion,
/// iOS plugins will not work, upgrade required.
/// iOS plugins will not work, upgrade required.
belowMinimumVersion,
belowMinimumVersion,
/// iOS plugins may not work in certain situations (Swift, static libraries),
/// iOS plugins may not work in certain situations (Swift, static libraries),
...
@@ -66,6 +72,8 @@ class CocoaPods {
...
@@ -66,6 +72,8 @@ class CocoaPods {
return CocoaPodsStatus.notInstalled;
return CocoaPodsStatus.notInstalled;
try {
try {
final Version installedVersion = Version.parse(versionText);
final Version installedVersion = Version.parse(versionText);
if (installedVersion == null)
return CocoaPodsStatus.unknownVersion;
if (installedVersion < Version.parse(cocoaPodsMinimumVersion))
if (installedVersion < Version.parse(cocoaPodsMinimumVersion))
return CocoaPodsStatus.belowMinimumVersion;
return CocoaPodsStatus.belowMinimumVersion;
else if (installedVersion < Version.parse(cocoaPodsRecommendedVersion))
else if (installedVersion < Version.parse(cocoaPodsRecommendedVersion))
...
@@ -112,6 +120,15 @@ class CocoaPods {
...
@@ -112,6 +120,15 @@ class CocoaPods {
emphasis:
true
,
emphasis:
true
,
);
);
return
false
;
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
:
case
CocoaPodsStatus
.
belowMinimumVersion
:
printError
(
printError
(
'Warning: CocoaPods minimum required version
$cocoaPodsMinimumVersion
or greater not installed. Skipping pod install.
\n
'
'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 {
...
@@ -192,6 +192,11 @@ class CocoaPodsValidator extends DoctorValidator {
status
=
ValidationType
.
missing
;
status
=
ValidationType
.
missing
;
messages
.
add
(
ValidationMessage
.
error
(
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
cocoaPodsMissing
(
noCocoaPodsConsequence
,
cocoaPodsInstallInstructions
)));
userMessages
.
cocoaPodsMissing
(
noCocoaPodsConsequence
,
cocoaPodsInstallInstructions
)));
}
else
if
(
cocoaPodsStatus
==
CocoaPodsStatus
.
unknownVersion
)
{
status
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
hint
(
userMessages
.
cocoaPodsUnknownVersion
(
unknownCocoaPodsConsequence
,
cocoaPodsUpgradeInstructions
)));
}
else
{
}
else
{
status
=
ValidationType
.
partial
;
status
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
hint
(
messages
.
add
(
ValidationMessage
.
hint
(
...
...
packages/flutter_tools/test/ios/cocoapods_test.dart
View file @
85ded441
...
@@ -94,6 +94,13 @@ void main() {
...
@@ -94,6 +94,13 @@ void main() {
ProcessManager:
()
=>
mockProcessManager
,
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
{
testUsingContext
(
'detects below minimum version'
,
()
async
{
pretendPodVersionIs
(
'0.39.8'
);
pretendPodVersionIs
(
'0.39.8'
);
expect
(
await
cocoaPodsUnderTest
.
evaluateCocoaPodsInstallation
,
CocoaPodsStatus
.
belowMinimumVersion
);
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.
...
@@ -297,6 +297,16 @@ Show information about a connected device.
CocoaPods:
()
=>
cocoaPods
,
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
{
testUsingContext
(
'Emits partial status when CocoaPods is not initialized'
,
()
async
{
when
(
cocoaPods
.
isCocoaPodsInitialized
).
thenAnswer
((
_
)
async
=>
false
);
when
(
cocoaPods
.
isCocoaPodsInitialized
).
thenAnswer
((
_
)
async
=>
false
);
final
CocoaPodsTestTarget
workflow
=
CocoaPodsTestTarget
();
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