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
306bcbde
Commit
306bcbde
authored
Sep 26, 2018
by
Greg Spencer
Committed by
Dan Field
Sep 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes terse doctor output when no devices available. (#22108)
parent
f16d005d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
16 deletions
+55
-16
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+31
-14
doctor_test.dart
packages/flutter_tools/test/commands/doctor_test.dart
+24
-2
No files found.
packages/flutter_tools/lib/src/doctor.dart
View file @
306bcbde
...
...
@@ -124,12 +124,20 @@ class Doctor {
for
(
DoctorValidator
validator
in
validators
)
{
final
ValidationResult
result
=
await
validator
.
validate
();
buffer
.
write
(
'
${result.leadingBox}
${validator.title}
is '
);
if
(
result
.
type
==
ValidationType
.
missing
)
buffer
.
write
(
'not installed.'
);
else
if
(
result
.
type
==
ValidationType
.
partial
)
buffer
.
write
(
'partially installed; more components are available.'
);
else
buffer
.
write
(
'fully installed.'
);
switch
(
result
.
type
)
{
case
ValidationType
.
missing
:
buffer
.
write
(
'not installed.'
);
break
;
case
ValidationType
.
partial
:
buffer
.
write
(
'partially installed; more components are available.'
);
break
;
case
ValidationType
.
notAvailable
:
buffer
.
write
(
'not available.'
);
break
;
case
ValidationType
.
installed
:
buffer
.
write
(
'fully installed.'
);
break
;
}
if
(
result
.
statusInfo
!=
null
)
buffer
.
write
(
' (
${result.statusInfo}
)'
);
...
...
@@ -171,11 +179,17 @@ class Doctor {
}
status
.
stop
();
if
(
result
.
type
==
ValidationType
.
missing
)
{
doctorResult
=
false
;
}
if
(
result
.
type
!=
ValidationType
.
installed
)
{
issues
+=
1
;
switch
(
result
.
type
)
{
case
ValidationType
.
missing
:
doctorResult
=
false
;
issues
+=
1
;
break
;
case
ValidationType
.
partial
:
case
ValidationType
.
notAvailable
:
issues
+=
1
;
break
;
case
ValidationType
.
installed
:
break
;
}
if
(
result
.
statusInfo
!=
null
)
...
...
@@ -238,7 +252,8 @@ abstract class Workflow {
enum
ValidationType
{
missing
,
partial
,
installed
notAvailable
,
installed
,
}
abstract
class
DoctorValidator
{
...
...
@@ -286,6 +301,7 @@ class GroupedValidator extends DoctorValidator {
mergedType
=
ValidationType
.
partial
;
}
break
;
case
ValidationType
.
notAvailable
:
case
ValidationType
.
partial
:
mergedType
=
ValidationType
.
partial
;
break
;
...
...
@@ -322,6 +338,7 @@ class ValidationResult {
return
'[✗]'
;
case
ValidationType
.
installed
:
return
'[✓]'
;
case
ValidationType
.
notAvailable
:
case
ValidationType
.
partial
:
return
'[!]'
;
}
...
...
@@ -600,7 +617,7 @@ class IntelliJValidatorOnMac extends IntelliJValidator {
}
class
DeviceValidator
extends
DoctorValidator
{
DeviceValidator
()
:
super
(
'Connected device
s
'
);
DeviceValidator
()
:
super
(
'Connected device'
);
@override
Future
<
ValidationResult
>
validate
()
async
{
...
...
@@ -619,7 +636,7 @@ class DeviceValidator extends DoctorValidator {
}
if
(
devices
.
isEmpty
)
{
return
ValidationResult
(
ValidationType
.
partial
,
messages
);
return
ValidationResult
(
ValidationType
.
notAvailable
,
messages
);
}
else
{
return
ValidationResult
(
ValidationType
.
installed
,
messages
,
statusInfo:
'
${devices.length}
available'
);
}
...
...
packages/flutter_tools/test/commands/doctor_test.dart
View file @
306bcbde
...
...
@@ -148,13 +148,16 @@ void main() {
'[✗] Missing Validator
\n
'
' ✗ A useful error message
\n
'
' ! A hint message
\n
'
'[!] Not Available Validator
\n
'
' ✗ A useful error message
\n
'
' ! A hint message
\n
'
'[!] Partial Validator with only a Hint
\n
'
' ! There is a hint here
\n
'
'[!] Partial Validator with Errors
\n
'
' ✗ A error message indicating partial installation
\n
'
' ! Maybe a hint will help the user
\n
'
'
\n
'
'! Doctor found issues in
3
categories.
\n
'
'! Doctor found issues in
4
categories.
\n
'
));
});
...
...
@@ -170,6 +173,11 @@ void main() {
' • A message that is not an error
\n
'
' ! A hint message
\n
'
'
\n
'
'[!] Not Available Validator
\n
'
' ✗ A useful error message
\n
'
' • A message that is not an error
\n
'
' ! A hint message
\n
'
'
\n
'
'[!] Partial Validator with only a Hint
\n
'
' ! There is a hint here
\n
'
' • But there is no error
\n
'
...
...
@@ -179,7 +187,7 @@ void main() {
' ! Maybe a hint will help the user
\n
'
' • An extra message with some verbose details
\n
'
'
\n
'
'! Doctor found issues in
3
categories.
\n
'
'! Doctor found issues in
4
categories.
\n
'
));
});
});
...
...
@@ -301,6 +309,19 @@ class MissingValidator extends DoctorValidator {
}
}
class
NotAvailableValidator
extends
DoctorValidator
{
NotAvailableValidator
():
super
(
'Not Available Validator'
);
@override
Future
<
ValidationResult
>
validate
()
async
{
final
List
<
ValidationMessage
>
messages
=
<
ValidationMessage
>[];
messages
.
add
(
ValidationMessage
.
error
(
'A useful error message'
));
messages
.
add
(
ValidationMessage
(
'A message that is not an error'
));
messages
.
add
(
ValidationMessage
.
hint
(
'A hint message'
));
return
ValidationResult
(
ValidationType
.
notAvailable
,
messages
);
}
}
class
PartialValidatorWithErrors
extends
DoctorValidator
{
PartialValidatorWithErrors
()
:
super
(
'Partial Validator with Errors'
);
...
...
@@ -336,6 +357,7 @@ class FakeDoctor extends Doctor {
_validators
=
<
DoctorValidator
>[];
_validators
.
add
(
PassingValidator
(
'Passing Validator'
));
_validators
.
add
(
MissingValidator
());
_validators
.
add
(
NotAvailableValidator
());
_validators
.
add
(
PartialValidatorWithHintsOnly
());
_validators
.
add
(
PartialValidatorWithErrors
());
}
...
...
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