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
2c846af1
Unverified
Commit
2c846af1
authored
Mar 04, 2020
by
Christopher Fujino
Committed by
GitHub
Mar 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `_checkPodCondition` not handling `CocoaPodsStatus.brokenInstall` (#51676)
parent
fb953b71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
11 deletions
+53
-11
cocoapods.dart
packages/flutter_tools/lib/src/macos/cocoapods.dart
+16
-6
cocoapods_test.dart
...lutter_tools/test/general.shard/macos/cocoapods_test.dart
+37
-5
No files found.
packages/flutter_tools/lib/src/macos/cocoapods.dart
View file @
2c846af1
...
...
@@ -143,13 +143,14 @@ class CocoaPods {
throwToolExit
(
'Podfile missing'
);
}
bool
podsProcessed
=
false
;
if
(
await
_checkPodCondition
())
{
if
(
_shouldRunPodInstall
(
xcodeProject
,
dependenciesChanged
))
{
await
_runPodInstall
(
xcodeProject
,
engineDir
);
podsProcessed
=
true
;
if
(
_shouldRunPodInstall
(
xcodeProject
,
dependenciesChanged
))
{
if
(!
await
_checkPodCondition
())
{
throwToolExit
(
'CocoaPods not installed or not in valid state.'
);
}
_warnIfPodfileOutOfDate
(
xcodeProject
);
await
_runPodInstall
(
xcodeProject
,
engineDir
);
podsProcessed
=
true
;
}
_warnIfPodfileOutOfDate
(
xcodeProject
);
return
podsProcessed
;
}
...
...
@@ -166,6 +167,15 @@ class CocoaPods {
emphasis:
true
,
);
return
false
;
case
CocoaPodsStatus
.
brokenInstall
:
globals
.
printError
(
'Warning: CocoaPods is installed but broken. Skipping pod install.
\n
'
'
$brokenCocoaPodsConsequence
\n
'
'To re-install:
\n
'
'
$cocoaPodsUpgradeInstructions
\n
'
,
emphasis:
true
,
);
return
false
;
case
CocoaPodsStatus
.
unknownVersion
:
globals
.
printError
(
'Warning: Unknown CocoaPods version installed.
\n
'
...
...
@@ -193,7 +203,7 @@ class CocoaPods {
emphasis:
true
,
);
break
;
default
:
case
CocoaPodsStatus
.
recommended
:
break
;
}
if
(!
await
isCocoaPodsInitialized
)
{
...
...
packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
View file @
2c846af1
...
...
@@ -109,6 +109,22 @@ void main() {
)).
thenAnswer
((
_
)
async
=>
exitsWithError
());
}
void
pretendPodIsBroken
()
{
// it is present
when
(
mockProcessManager
.
run
(
<
String
>[
'which'
,
'pod'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenAnswer
((
_
)
async
=>
exitsHappy
());
// but is not working
when
(
mockProcessManager
.
run
(
<
String
>[
'pod'
,
'--version'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenAnswer
((
_
)
async
=>
exitsWithError
());
}
void
pretendPodIsInstalled
()
{
when
(
mockProcessManager
.
run
(
<
String
>[
'which'
,
'pod'
],
...
...
@@ -306,21 +322,37 @@ void main() {
podsIsInHomeDir
();
});
testUsingContext
(
'
prints error,
if CocoaPods is not installed'
,
()
async
{
testUsingContext
(
'
throwsToolExit
if CocoaPods is not installed'
,
()
async
{
pretendPodIsNotInstalled
();
projectUnderTest
.
ios
.
podfile
.
createSync
();
final
bool
didInstall
=
await
cocoaPodsUnderTest
.
processPods
(
final
Function
invokeProcessPods
=
()
async
=>
await
cocoaPodsUnderTest
.
processPods
(
xcodeProject:
projectUnderTest
.
ios
,
engineDir:
'engine/path'
,
);
expect
(
invokeProcessPods
,
throwsToolExit
());
verifyNever
(
mockProcessManager
.
run
(
argThat
(
containsAllInOrder
(<
String
>[
'pod'
,
'install'
])),
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
mockProcessManager
,
});
testUsingContext
(
'throwsToolExit if CocoaPods install is broken'
,
()
async
{
pretendPodIsBroken
();
projectUnderTest
.
ios
.
podfile
.
createSync
();
final
Function
invokeProcessPods
=
()
async
=>
await
cocoaPodsUnderTest
.
processPods
(
xcodeProject:
projectUnderTest
.
ios
,
engineDir:
'engine/path'
,
);
expect
(
invokeProcessPods
,
throwsToolExit
());
verifyNever
(
mockProcessManager
.
run
(
argThat
(
containsAllInOrder
(<
String
>[
'pod'
,
'install'
])),
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
));
expect
(
testLogger
.
errorText
,
contains
(
'not installed'
));
expect
(
testLogger
.
errorText
,
contains
(
'Skipping pod install'
));
expect
(
didInstall
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
mockProcessManager
,
...
...
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