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
c23d9cd4
Unverified
Commit
c23d9cd4
authored
Feb 10, 2020
by
Zachary Anderson
Committed by
GitHub
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Print emojis in Windows Terminal (#50446)
parent
5f465897
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
447 additions
and
338 deletions
+447
-338
command_help.dart
packages/flutter_tools/lib/src/base/command_help.dart
+104
-35
logger.dart
packages/flutter_tools/lib/src/base/logger.dart
+16
-21
terminal.dart
packages/flutter_tools/lib/src/base/terminal.dart
+14
-2
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+0
-2
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+1
-2
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+1
-2
logger_test.dart
...es/flutter_tools/test/general.shard/base/logger_test.dart
+295
-266
vmservice_test.dart
...ages/flutter_tools/test/general.shard/vmservice_test.dart
+16
-8
No files found.
packages/flutter_tools/lib/src/base/command_help.dart
View file @
c23d9cd4
...
@@ -36,58 +36,122 @@ class CommandHelp {
...
@@ -36,58 +36,122 @@ class CommandHelp {
final
OutputPreferences
_outputPreferences
;
final
OutputPreferences
_outputPreferences
;
CommandHelpOption
_L
;
CommandHelpOption
_L
;
CommandHelpOption
get
L
=>
_L
??=
_makeOption
(
'L'
,
'Dump layer tree to the console.'
,
'debugDumpLayerTree'
);
CommandHelpOption
get
L
=>
_L
??=
_makeOption
(
'L'
,
'Dump layer tree to the console.'
,
'debugDumpLayerTree'
,
);
CommandHelpOption
_P
;
CommandHelpOption
_P
;
CommandHelpOption
get
P
=>
_P
??=
_makeOption
(
'P'
,
'Toggle performance overlay.'
,
'WidgetsApp.showPerformanceOverlay'
);
CommandHelpOption
get
P
=>
_P
??=
_makeOption
(
'P'
,
'Toggle performance overlay.'
,
'WidgetsApp.showPerformanceOverlay'
,
);
CommandHelpOption
_R
;
CommandHelpOption
_R
;
CommandHelpOption
get
R
=>
_R
??=
_makeOption
(
'R'
,
'Hot restart.'
);
CommandHelpOption
get
R
=>
_R
??=
_makeOption
(
'R'
,
'Hot restart.'
,
);
CommandHelpOption
_S
;
CommandHelpOption
_S
;
CommandHelpOption
get
S
=>
_S
??=
_makeOption
(
'S'
,
'Dump accessibility tree in traversal order.'
,
'debugDumpSemantics'
);
CommandHelpOption
get
S
=>
_S
??=
_makeOption
(
'S'
,
'Dump accessibility tree in traversal order.'
,
'debugDumpSemantics'
,
);
CommandHelpOption
_U
;
CommandHelpOption
_U
;
CommandHelpOption
get
U
=>
_U
??=
_makeOption
(
'U'
,
'Dump accessibility tree in inverse hit test order.'
,
'debugDumpSemantics'
);
CommandHelpOption
get
U
=>
_U
??=
_makeOption
(
'U'
,
'Dump accessibility tree in inverse hit test order.'
,
'debugDumpSemantics'
,
);
CommandHelpOption
_a
;
CommandHelpOption
_a
;
CommandHelpOption
get
a
=>
_a
??=
_makeOption
(
'a'
,
'Toggle timeline events for all widget build methods.'
,
'debugProfileWidgetBuilds'
);
CommandHelpOption
get
a
=>
_a
??=
_makeOption
(
'a'
,
'Toggle timeline events for all widget build methods.'
,
'debugProfileWidgetBuilds'
,
);
CommandHelpOption
_c
;
CommandHelpOption
_c
;
CommandHelpOption
get
c
=>
_c
??=
_makeOption
(
'c'
,
'Clear the screen'
);
CommandHelpOption
get
c
=>
_c
??=
_makeOption
(
'c'
,
'Clear the screen'
,
);
CommandHelpOption
_d
;
CommandHelpOption
_d
;
CommandHelpOption
get
d
=>
_d
??=
_makeOption
(
'd'
,
'Detach (terminate "flutter run" but leave application running).'
);
CommandHelpOption
get
d
=>
_d
??=
_makeOption
(
'd'
,
'Detach (terminate "flutter run" but leave application running).'
,
);
CommandHelpOption
_h
;
CommandHelpOption
_h
;
CommandHelpOption
get
h
=>
_h
??=
_makeOption
(
'h'
,
'Repeat this help message.'
);
CommandHelpOption
get
h
=>
_h
??=
_makeOption
(
'h'
,
'Repeat this help message.'
,
);
CommandHelpOption
_i
;
CommandHelpOption
_i
;
CommandHelpOption
get
i
=>
_i
??=
_makeOption
(
'i'
,
'Toggle widget inspector.'
,
'WidgetsApp.showWidgetInspectorOverride'
);
CommandHelpOption
get
i
=>
_i
??=
_makeOption
(
'i'
,
'Toggle widget inspector.'
,
'WidgetsApp.showWidgetInspectorOverride'
,
);
CommandHelpOption
_o
;
CommandHelpOption
_o
;
CommandHelpOption
get
o
=>
_o
??=
_makeOption
(
'o'
,
'Simulate different operating systems.'
,
'defaultTargetPlatform'
);
CommandHelpOption
get
o
=>
_o
??=
_makeOption
(
'o'
,
'Simulate different operating systems.'
,
'defaultTargetPlatform'
,
);
CommandHelpOption
_p
;
CommandHelpOption
_p
;
CommandHelpOption
get
p
=>
_p
??=
_makeOption
(
'p'
,
'Toggle the display of construction lines.'
,
'debugPaintSizeEnabled'
);
CommandHelpOption
get
p
=>
_p
??=
_makeOption
(
'p'
,
'Toggle the display of construction lines.'
,
'debugPaintSizeEnabled'
,
);
CommandHelpOption
_q
;
CommandHelpOption
_q
;
CommandHelpOption
get
q
=>
_q
??=
_makeOption
(
'q'
,
'Quit (terminate the application on the device).'
);
CommandHelpOption
get
q
=>
_q
??=
_makeOption
(
'q'
,
'Quit (terminate the application on the device).'
,
);
CommandHelpOption
_r
;
CommandHelpOption
_r
;
CommandHelpOption
get
r
=>
_r
??=
_makeOption
(
'r'
,
'Hot reload.
$fire$fire$fire
'
);
CommandHelpOption
get
r
=>
_r
??=
_makeOption
(
'r'
,
'Hot reload.
$fire$fire$fire
'
,
);
CommandHelpOption
_s
;
CommandHelpOption
_s
;
CommandHelpOption
get
s
=>
_s
??=
_makeOption
(
's'
,
'Save a screenshot to flutter.png.'
);
CommandHelpOption
get
s
=>
_s
??=
_makeOption
(
's'
,
'Save a screenshot to flutter.png.'
,
);
CommandHelpOption
_t
;
CommandHelpOption
_t
;
CommandHelpOption
get
t
=>
_t
??=
_makeOption
(
't'
,
'Dump rendering tree to the console.'
,
'debugDumpRenderTree'
);
CommandHelpOption
get
t
=>
_t
??=
_makeOption
(
't'
,
'Dump rendering tree to the console.'
,
'debugDumpRenderTree'
,
);
CommandHelpOption
_w
;
CommandHelpOption
_w
;
CommandHelpOption
get
w
=>
_w
??=
_makeOption
(
'w'
,
'Dump widget hierarchy to the console.'
,
'debugDumpApp'
);
CommandHelpOption
get
w
=>
_w
??=
_makeOption
(
'w'
,
'Dump widget hierarchy to the console.'
,
'debugDumpApp'
,
);
CommandHelpOption
_z
;
CommandHelpOption
_z
;
CommandHelpOption
get
z
=>
_z
??=
_makeOption
(
'z'
,
'Toggle elevation checker.'
);
CommandHelpOption
get
z
=>
_z
??=
_makeOption
(
'z'
,
'Toggle elevation checker.'
,
);
CommandHelpOption
_makeOption
(
String
key
,
String
description
,
[
CommandHelpOption
_makeOption
(
String
key
,
String
description
,
[
String
inParenthesis
=
''
,
String
inParenthesis
=
''
,
...
@@ -142,25 +206,30 @@ class CommandHelpOption {
...
@@ -142,25 +206,30 @@ class CommandHelpOption {
String
toString
()
{
String
toString
()
{
final
StringBuffer
message
=
StringBuffer
();
final
StringBuffer
message
=
StringBuffer
();
message
.
writeAll
(<
String
>[
_terminal
.
bolden
(
key
),
description
],
' '
);
message
.
writeAll
(<
String
>[
_terminal
.
bolden
(
key
),
description
],
' '
);
if
(!
_hasTextInParenthesis
)
{
return
message
.
toString
();
}
if
(
_hasTextInParenthesis
)
{
bool
wrap
=
false
;
bool
wrap
=
false
;
final
int
maxWidth
=
math
.
max
(
_outputPreferences
.
wrapColumn
??
0
,
maxLineWidth
);
final
int
maxWidth
=
math
.
max
(
int
width
=
maxWidth
-
(
_platform
.
stdoutSupportsAnsi
?
_rawMessageLength
+
1
:
message
.
length
);
_outputPreferences
.
wrapColumn
??
0
,
maxLineWidth
,
);
final
int
adjustedMessageLength
=
_platform
.
stdoutSupportsAnsi
?
_rawMessageLength
+
1
:
message
.
length
;
int
width
=
maxWidth
-
adjustedMessageLength
;
final
String
parentheticalText
=
'(
$inParenthesis
)'
;
final
String
parentheticalText
=
'(
$inParenthesis
)'
;
if
(
width
<
parentheticalText
.
length
)
{
if
(
width
<
parentheticalText
.
length
)
{
width
=
maxWidth
;
width
=
maxWidth
;
wrap
=
true
;
wrap
=
true
;
}
}
if
(
wrap
)
{
if
(
wrap
)
{
message
.
write
(
'
\n
'
);
message
.
write
(
'
\n
'
);
}
}
// pad according to the raw text
// pad according to the raw text
message
.
write
(
''
.
padLeft
(
width
-
parentheticalText
.
length
));
message
.
write
(
''
.
padLeft
(
width
-
parentheticalText
.
length
));
message
.
write
(
_terminal
.
color
(
parentheticalText
,
TerminalColor
.
grey
));
message
.
write
(
_terminal
.
color
(
parentheticalText
,
TerminalColor
.
grey
));
}
return
message
.
toString
();
return
message
.
toString
();
}
}
...
...
packages/flutter_tools/lib/src/base/logger.dart
View file @
c23d9cd4
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:platform/platform.dart'
;
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals.dart'
as
globals
;
...
@@ -179,15 +178,13 @@ class StdoutLogger extends Logger {
...
@@ -179,15 +178,13 @@ class StdoutLogger extends Logger {
@required
Stdio
stdio
,
@required
Stdio
stdio
,
@required
OutputPreferences
outputPreferences
,
@required
OutputPreferences
outputPreferences
,
@required
TimeoutConfiguration
timeoutConfiguration
,
@required
TimeoutConfiguration
timeoutConfiguration
,
@required
Platform
platform
,
StopwatchFactory
stopwatchFactory
=
const
StopwatchFactory
(),
StopwatchFactory
stopwatchFactory
=
const
StopwatchFactory
(),
})
})
:
_stdio
=
stdio
,
:
_stdio
=
stdio
,
_terminal
=
terminal
,
_terminal
=
terminal
,
_timeoutConfiguration
=
timeoutConfiguration
,
_timeoutConfiguration
=
timeoutConfiguration
,
_outputPreferences
=
outputPreferences
,
_outputPreferences
=
outputPreferences
,
_stopwatchFactory
=
stopwatchFactory
,
_stopwatchFactory
=
stopwatchFactory
;
_platform
=
platform
;
@override
@override
final
AnsiTerminal
_terminal
;
final
AnsiTerminal
_terminal
;
...
@@ -197,7 +194,6 @@ class StdoutLogger extends Logger {
...
@@ -197,7 +194,6 @@ class StdoutLogger extends Logger {
final
TimeoutConfiguration
_timeoutConfiguration
;
final
TimeoutConfiguration
_timeoutConfiguration
;
final
Stdio
_stdio
;
final
Stdio
_stdio
;
final
StopwatchFactory
_stopwatchFactory
;
final
StopwatchFactory
_stopwatchFactory
;
final
Platform
_platform
;
Status
_status
;
Status
_status
;
...
@@ -306,8 +302,8 @@ class StdoutLogger extends Logger {
...
@@ -306,8 +302,8 @@ class StdoutLogger extends Logger {
onFinish:
_clearStatus
,
onFinish:
_clearStatus
,
stdio:
_stdio
,
stdio:
_stdio
,
timeoutConfiguration:
_timeoutConfiguration
,
timeoutConfiguration:
_timeoutConfiguration
,
platform:
_platform
,
stopwatch:
_stopwatchFactory
.
createStopwatch
(),
stopwatch:
_stopwatchFactory
.
createStopwatch
(),
terminal:
_terminal
,
)..
start
();
)..
start
();
}
else
{
}
else
{
_status
=
SummaryStatus
(
_status
=
SummaryStatus
(
...
@@ -352,7 +348,6 @@ class WindowsStdoutLogger extends StdoutLogger {
...
@@ -352,7 +348,6 @@ class WindowsStdoutLogger extends StdoutLogger {
@required
Stdio
stdio
,
@required
Stdio
stdio
,
@required
OutputPreferences
outputPreferences
,
@required
OutputPreferences
outputPreferences
,
@required
TimeoutConfiguration
timeoutConfiguration
,
@required
TimeoutConfiguration
timeoutConfiguration
,
@required
Platform
platform
,
StopwatchFactory
stopwatchFactory
=
const
StopwatchFactory
(),
StopwatchFactory
stopwatchFactory
=
const
StopwatchFactory
(),
})
:
super
(
})
:
super
(
terminal:
terminal
,
terminal:
terminal
,
...
@@ -360,13 +355,14 @@ class WindowsStdoutLogger extends StdoutLogger {
...
@@ -360,13 +355,14 @@ class WindowsStdoutLogger extends StdoutLogger {
outputPreferences:
outputPreferences
,
outputPreferences:
outputPreferences
,
timeoutConfiguration:
timeoutConfiguration
,
timeoutConfiguration:
timeoutConfiguration
,
stopwatchFactory:
stopwatchFactory
,
stopwatchFactory:
stopwatchFactory
,
platform:
platform
,
);
);
@override
@override
void
writeToStdOut
(
String
message
)
{
void
writeToStdOut
(
String
message
)
{
// TODO(jcollins-g): wrong abstraction layer for this, move to [Stdio].
// TODO(jcollins-g): wrong abstraction layer for this, move to [Stdio].
final
String
windowsMessage
=
message
final
String
windowsMessage
=
_terminal
.
supportsEmoji
?
message
:
message
.
replaceAll
(
'🔥'
,
''
)
.
replaceAll
(
'✗'
,
'X'
)
.
replaceAll
(
'✗'
,
'X'
)
.
replaceAll
(
'✓'
,
'√'
);
.
replaceAll
(
'✓'
,
'√'
);
_stdio
.
stdoutWrite
(
windowsMessage
);
_stdio
.
stdoutWrite
(
windowsMessage
);
...
@@ -681,19 +677,18 @@ abstract class Status {
...
@@ -681,19 +677,18 @@ abstract class Status {
@required
Duration
timeout
,
@required
Duration
timeout
,
@required
TimeoutConfiguration
timeoutConfiguration
,
@required
TimeoutConfiguration
timeoutConfiguration
,
@required
Stopwatch
stopwatch
,
@required
Stopwatch
stopwatch
,
@required
bool
supportsColor
,
@required
AnsiTerminal
terminal
,
@required
Platform
platform
,
VoidCallback
onFinish
,
VoidCallback
onFinish
,
SlowWarningCallback
slowWarningCallback
,
SlowWarningCallback
slowWarningCallback
,
})
{
})
{
if
(
supportsColor
)
{
if
(
terminal
.
supportsColor
)
{
return
AnsiSpinner
(
return
AnsiSpinner
(
timeout:
timeout
,
timeout:
timeout
,
onFinish:
onFinish
,
onFinish:
onFinish
,
slowWarningCallback:
slowWarningCallback
,
slowWarningCallback:
slowWarningCallback
,
timeoutConfiguration:
timeoutConfiguration
,
timeoutConfiguration:
timeoutConfiguration
,
stopwatch:
stopwatch
,
stopwatch:
stopwatch
,
platform:
platform
,
terminal:
terminal
,
)..
start
();
)..
start
();
}
}
return
SilentStatus
(
return
SilentStatus
(
...
@@ -862,12 +857,12 @@ class AnsiSpinner extends Status {
...
@@ -862,12 +857,12 @@ class AnsiSpinner extends Status {
@required
Duration
timeout
,
@required
Duration
timeout
,
@required
TimeoutConfiguration
timeoutConfiguration
,
@required
TimeoutConfiguration
timeoutConfiguration
,
@required
Stopwatch
stopwatch
,
@required
Stopwatch
stopwatch
,
@required
Platform
platform
,
@required
AnsiTerminal
terminal
,
VoidCallback
onFinish
,
VoidCallback
onFinish
,
this
.
slowWarningCallback
,
this
.
slowWarningCallback
,
Stdio
stdio
,
Stdio
stdio
,
})
:
_stdio
=
stdio
??
globals
.
stdio
,
})
:
_stdio
=
stdio
??
globals
.
stdio
,
_
isWindows
=
platform
.
isWindows
,
_
terminal
=
terminal
,
super
(
super
(
timeout:
timeout
,
timeout:
timeout
,
onFinish:
onFinish
,
onFinish:
onFinish
,
...
@@ -878,7 +873,7 @@ class AnsiSpinner extends Status {
...
@@ -878,7 +873,7 @@ class AnsiSpinner extends Status {
final
String
_backspaceChar
=
'
\
b'
;
final
String
_backspaceChar
=
'
\
b'
;
final
String
_clearChar
=
' '
;
final
String
_clearChar
=
' '
;
final
Stdio
_stdio
;
final
Stdio
_stdio
;
final
bool
_isWindows
;
final
AnsiTerminal
_terminal
;
bool
timedOut
=
false
;
bool
timedOut
=
false
;
...
@@ -886,7 +881,7 @@ class AnsiSpinner extends Status {
...
@@ -886,7 +881,7 @@ class AnsiSpinner extends Status {
Timer
timer
;
Timer
timer
;
// Windows console font has a limited set of Unicode characters.
// Windows console font has a limited set of Unicode characters.
List
<
String
>
get
_animation
=>
_isWindows
List
<
String
>
get
_animation
=>
!
_terminal
.
supportsEmoji
?
const
<
String
>[
r'-'
,
r'\'
,
r'|'
,
r'/'
]
?
const
<
String
>[
r'-'
,
r'\'
,
r'|'
,
r'/'
]
:
const
<
String
>[
'⣾'
,
'⣽'
,
'⣻'
,
'⢿'
,
'⡿'
,
'⣟'
,
'⣯'
,
'⣷'
];
:
const
<
String
>[
'⣾'
,
'⣽'
,
'⣻'
,
'⢿'
,
'⡿'
,
'⣟'
,
'⣯'
,
'⣷'
];
...
@@ -984,7 +979,7 @@ class AnsiStatus extends AnsiSpinner {
...
@@ -984,7 +979,7 @@ class AnsiStatus extends AnsiSpinner {
this
.
padding
=
kDefaultStatusPadding
,
this
.
padding
=
kDefaultStatusPadding
,
@required
Duration
timeout
,
@required
Duration
timeout
,
@required
Stopwatch
stopwatch
,
@required
Stopwatch
stopwatch
,
@required
Platform
platform
,
@required
AnsiTerminal
terminal
,
VoidCallback
onFinish
,
VoidCallback
onFinish
,
Stdio
stdio
,
Stdio
stdio
,
TimeoutConfiguration
timeoutConfiguration
,
TimeoutConfiguration
timeoutConfiguration
,
...
@@ -997,7 +992,7 @@ class AnsiStatus extends AnsiSpinner {
...
@@ -997,7 +992,7 @@ class AnsiStatus extends AnsiSpinner {
stdio:
stdio
,
stdio:
stdio
,
timeoutConfiguration:
timeoutConfiguration
,
timeoutConfiguration:
timeoutConfiguration
,
stopwatch:
stopwatch
,
stopwatch:
stopwatch
,
platform:
platform
,
terminal:
terminal
,
);
);
final
String
message
;
final
String
message
;
...
...
packages/flutter_tools/lib/src/base/terminal.dart
View file @
c23d9cd4
...
@@ -86,7 +86,10 @@ class OutputPreferences {
...
@@ -86,7 +86,10 @@ class OutputPreferences {
}
}
class
AnsiTerminal
{
class
AnsiTerminal
{
AnsiTerminal
({
@required
io
.
Stdio
stdio
,
@required
Platform
platform
})
AnsiTerminal
({
@required
io
.
Stdio
stdio
,
@required
Platform
platform
,
})
:
_stdio
=
stdio
,
:
_stdio
=
stdio
,
_platform
=
platform
;
_platform
=
platform
;
...
@@ -121,7 +124,16 @@ class AnsiTerminal {
...
@@ -121,7 +124,16 @@ class AnsiTerminal {
bool
get
supportsColor
=>
_platform
.
stdoutSupportsAnsi
??
false
;
bool
get
supportsColor
=>
_platform
.
stdoutSupportsAnsi
??
false
;
final
RegExp
_boldControls
=
RegExp
(
'(
${RegExp.escape(resetBold)}
|
${RegExp.escape(bold)}
)'
);
// Assume unicode emojis are supported when not on Windows.
// If we are on Windows, unicode emojis are supported in Windows Terminal,
// which sets the WT_SESSION environment variable. See:
// https://github.com/microsoft/terminal/blob/master/doc/user-docs/index.md#tips-and-tricks
bool
get
supportsEmoji
=>
!
_platform
.
isWindows
||
_platform
.
environment
.
containsKey
(
'WT_SESSION'
);
final
RegExp
_boldControls
=
RegExp
(
'(
${RegExp.escape(resetBold)}
|
${RegExp.escape(bold)}
)'
,
);
/// Whether we are interacting with the flutter tool via the terminal.
/// Whether we are interacting with the flutter tool via the terminal.
///
///
...
...
packages/flutter_tools/lib/src/context_runner.dart
View file @
c23d9cd4
...
@@ -127,14 +127,12 @@ Future<T> runInContext<T>(
...
@@ -127,14 +127,12 @@ Future<T> runInContext<T>(
stdio:
globals
.
stdio
,
stdio:
globals
.
stdio
,
outputPreferences:
outputPreferences
,
outputPreferences:
outputPreferences
,
timeoutConfiguration:
timeoutConfiguration
,
timeoutConfiguration:
timeoutConfiguration
,
platform:
globals
.
platform
,
)
)
:
StdoutLogger
(
:
StdoutLogger
(
terminal:
globals
.
terminal
,
terminal:
globals
.
terminal
,
stdio:
globals
.
stdio
,
stdio:
globals
.
stdio
,
outputPreferences:
outputPreferences
,
outputPreferences:
outputPreferences
,
timeoutConfiguration:
timeoutConfiguration
,
timeoutConfiguration:
timeoutConfiguration
,
platform:
globals
.
platform
,
),
),
MacOSWorkflow:
()
=>
const
MacOSWorkflow
(),
MacOSWorkflow:
()
=>
const
MacOSWorkflow
(),
MDnsObservatoryDiscovery:
()
=>
MDnsObservatoryDiscovery
(),
MDnsObservatoryDiscovery:
()
=>
MDnsObservatoryDiscovery
(),
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
c23d9cd4
...
@@ -258,8 +258,7 @@ class Doctor {
...
@@ -258,8 +258,7 @@ class Doctor {
slowWarningCallback:
()
=>
validator
.
slowWarning
,
slowWarningCallback:
()
=>
validator
.
slowWarning
,
timeoutConfiguration:
timeoutConfiguration
,
timeoutConfiguration:
timeoutConfiguration
,
stopwatch:
Stopwatch
(),
stopwatch:
Stopwatch
(),
supportsColor:
globals
.
terminal
.
supportsColor
,
terminal:
globals
.
terminal
,
platform:
globals
.
platform
,
);
);
ValidationResult
result
;
ValidationResult
result
;
try
{
try
{
...
...
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
c23d9cd4
...
@@ -314,9 +314,8 @@ class XcodeProjectInterpreter {
...
@@ -314,9 +314,8 @@ class XcodeProjectInterpreter {
final
Status
status
=
Status
.
withSpinner
(
final
Status
status
=
Status
.
withSpinner
(
timeout:
const
TimeoutConfiguration
().
fastOperation
,
timeout:
const
TimeoutConfiguration
().
fastOperation
,
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
_platform
,
stopwatch:
Stopwatch
(),
stopwatch:
Stopwatch
(),
supportsColor:
_terminal
.
supportsColor
,
terminal:
_terminal
,
);
);
final
List
<
String
>
showBuildSettingsCommand
=
<
String
>[
final
List
<
String
>
showBuildSettingsCommand
=
<
String
>[
_executable
,
_executable
,
...
...
packages/flutter_tools/test/general.shard/base/logger_test.dart
View file @
c23d9cd4
...
@@ -112,7 +112,6 @@ void main() {
...
@@ -112,7 +112,6 @@ void main() {
stdio:
stdio
,
stdio:
stdio
,
outputPreferences:
OutputPreferences
.
test
(),
outputPreferences:
OutputPreferences
.
test
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printStatus
(
'message'
);
logger
.
printStatus
(
'message'
);
logger
.
printError
(
'error message'
);
logger
.
printError
(
'error message'
);
...
@@ -125,7 +124,33 @@ void main() {
...
@@ -125,7 +124,33 @@ void main() {
FakeStopwatch
mockStopwatch
;
FakeStopwatch
mockStopwatch
;
FakeStopwatchFactory
stopwatchFactory
;
FakeStopwatchFactory
stopwatchFactory
;
int
called
;
int
called
;
const
List
<
String
>
testPlatforms
=
<
String
>[
'linux'
,
'macos'
,
'windows'
,
'fuchsia'
];
final
List
<
Platform
>
testPlatforms
=
<
Platform
>[
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{},
executableArguments:
<
String
>[],
),
FakePlatform
(
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{},
executableArguments:
<
String
>[],
),
FakePlatform
(
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{},
executableArguments:
<
String
>[],
),
FakePlatform
(
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{
'WT_SESSION'
:
''
},
executableArguments:
<
String
>[],
),
FakePlatform
(
operatingSystem:
'fuchsia'
,
environment:
<
String
,
String
>{},
executableArguments:
<
String
>[],
),
];
final
RegExp
secondDigits
=
RegExp
(
r'[0-9,.]*[0-9]m?s'
);
final
RegExp
secondDigits
=
RegExp
(
r'[0-9,.]*[0-9]m?s'
);
setUp
(()
{
setUp
(()
{
...
@@ -145,11 +170,28 @@ void main() {
...
@@ -145,11 +170,28 @@ void main() {
}
while
(
doThis
());
}
while
(
doThis
());
}
}
for
(
final
String
testOs
in
testPlatforms
)
{
for
(
final
Platform
testPlatform
in
testPlatforms
)
{
Platform
currentPlatform
()
=>
FakePlatform
(
operatingSystem:
testOs
);
group
(
'(
${testPlatform.operatingSystem}
)'
,
()
{
Platform
platform
;
Platform
ansiPlatform
;
AnsiTerminal
terminal
;
AnsiTerminal
coloredTerminal
;
AnsiStatus
ansiStatus
;
setUp
(()
{
platform
=
FakePlatform
.
fromPlatform
(
testPlatform
)..
stdoutSupportsAnsi
=
false
;
ansiPlatform
=
FakePlatform
.
fromPlatform
(
testPlatform
)..
stdoutSupportsAnsi
=
true
;
terminal
=
AnsiTerminal
(
stdio:
mockStdio
,
platform:
platform
,
);
coloredTerminal
=
AnsiTerminal
(
stdio:
mockStdio
,
platform:
ansiPlatform
,
);
AnsiStatus
createAnsiStatus
()
{
ansiStatus
=
AnsiStatus
(
return
AnsiStatus
(
message:
'Hello world'
,
message:
'Hello world'
,
timeout:
const
Duration
(
seconds:
2
),
timeout:
const
Duration
(
seconds:
2
),
padding:
20
,
padding:
20
,
...
@@ -157,10 +199,11 @@ void main() {
...
@@ -157,10 +199,11 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
stopwatch:
stopwatchFactory
.
createStopwatch
(),
stopwatch:
stopwatchFactory
.
createStopwatch
(),
platform:
currentPlatform
()
,
terminal:
terminal
,
);
);
}
});
testWithoutContext
(
'AnsiSpinner works for
$testOs
(1)'
,
()
async
{
testWithoutContext
(
'AnsiSpinner works (1)'
,
()
async
{
bool
done
=
false
;
bool
done
=
false
;
mockStopwatch
=
FakeStopwatch
();
mockStopwatch
=
FakeStopwatch
();
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
...
@@ -169,14 +212,14 @@ void main() {
...
@@ -169,14 +212,14 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
stopwatch:
stopwatchFactory
.
createStopwatch
(),
stopwatch:
stopwatchFactory
.
createStopwatch
(),
platform:
currentPlatform
()
,
terminal:
terminal
,
)..
start
();
)..
start
();
doWhileAsync
(
time
,
()
=>
ansiSpinner
.
ticks
<
10
);
doWhileAsync
(
time
,
()
=>
ansiSpinner
.
ticks
<
10
);
List
<
String
>
lines
=
outputStdout
();
List
<
String
>
lines
=
outputStdout
();
expect
(
lines
[
0
],
startsWith
(
expect
(
lines
[
0
],
startsWith
(
currentPlatform
().
isWindows
terminal
.
supportsEmoji
?
'
\
b
\\
\
b|
\
b/
\
b-
\
b
\\
\
b|
\
b/
\
b-
'
?
'
\
b⣽
\
b⣻
\
b⢿
\
b⡿
\
b⣟
\
b⣯
\
b⣷
\
b⣾
\
b⣽
\
b⣻
'
:
'
\
b⣽
\
b⣻
\
b⢿
\
b⡿
\
b⣟
\
b⣯
\
b⣷
\
b⣾
\
b⣽
\
b⣻
'
:
'
\
b
\\
\
b|
\
b/
\
b-
\
b
\\
\
b|
\
b/
\
b-
'
),
),
);
);
expect
(
lines
[
0
].
endsWith
(
'
\n
'
),
isFalse
);
expect
(
lines
[
0
].
endsWith
(
'
\n
'
),
isFalse
);
...
@@ -196,7 +239,7 @@ void main() {
...
@@ -196,7 +239,7 @@ void main() {
expect
(
done
,
isTrue
);
expect
(
done
,
isTrue
);
});
});
testWithoutContext
(
'AnsiSpinner works for
$testO
s
(2)'
,
()
async
{
testWithoutContext
(
'AnsiSpinner work
s (2)'
,
()
async
{
bool
done
=
false
;
bool
done
=
false
;
mockStopwatch
=
FakeStopwatch
();
mockStopwatch
=
FakeStopwatch
();
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
...
@@ -205,7 +248,7 @@ void main() {
...
@@ -205,7 +248,7 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
stopwatch:
mockStopwatch
,
stopwatch:
mockStopwatch
,
platform:
FakePlatform
(
operatingSystem:
testOs
)
,
terminal:
terminal
,
)..
start
();
)..
start
();
mockStopwatch
.
elapsed
=
const
Duration
(
seconds:
1
);
mockStopwatch
.
elapsed
=
const
Duration
(
seconds:
1
);
doWhileAsync
(
time
,
()
=>
ansiSpinner
.
ticks
<
10
);
// one second
doWhileAsync
(
time
,
()
=>
ansiSpinner
.
ticks
<
10
);
// one second
...
@@ -225,19 +268,15 @@ void main() {
...
@@ -225,19 +268,15 @@ void main() {
expect
(
done
,
isTrue
);
expect
(
done
,
isTrue
);
});
});
testWithoutContext
(
'Stdout startProgress on colored terminal for
$testOs
'
,
()
async
{
testWithoutContext
(
'Stdout startProgress on colored terminal
'
,
()
async
{
bool
done
=
false
;
bool
done
=
false
;
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
final
Logger
logger
=
StdoutLogger
(
final
Logger
logger
=
StdoutLogger
(
terminal:
AnsiTerminal
(
terminal:
coloredTerminal
,
stdio:
mockStdio
,
platform:
FakePlatform
(
operatingSystem:
testOs
)..
stdoutSupportsAnsi
=
true
,
),
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
stopwatchFactory:
stopwatchFactory
,
stopwatchFactory:
stopwatchFactory
,
platform:
currentPlatform
(),
);
);
final
Status
status
=
logger
.
startProgress
(
final
Status
status
=
logger
.
startProgress
(
'Hello'
,
'Hello'
,
...
@@ -248,32 +287,36 @@ void main() {
...
@@ -248,32 +287,36 @@ void main() {
expect
(
outputStderr
().
length
,
equals
(
1
));
expect
(
outputStderr
().
length
,
equals
(
1
));
expect
(
outputStderr
().
first
,
isEmpty
);
expect
(
outputStderr
().
first
,
isEmpty
);
// the 5 below is the margin that is always included between the message and the time.
// the 5 below is the margin that is always included between the message and the time.
expect
(
outputStdout
().
join
(
'
\n
'
),
expect
(
matches
(
currentPlatform
().
isWindows
?
r'^Hello {15} {5} {8}[\b]{8} {7}\\$'
:
outputStdout
().
join
(
'
\n
'
),
r'^Hello {15} {5} {8}[\b]{8} {7}⣽$'
));
matches
(
terminal
.
supportsEmoji
?
r'^Hello {15} {5} {8}[\b]{8} {7}⣽$'
:
r'^Hello {15} {5} {8}[\b]{8} {7}\\$'
),
);
status
.
stop
();
status
.
stop
();
expect
(
outputStdout
().
join
(
'
\n
'
),
expect
(
matches
(
currentPlatform
().
isWindows
?
r'^Hello {15} {5} {8}[\b]{8} {7}\\[\b]{8} {8}[\b]{8}[\d, ]{4}[\d]\.[\d]s[\n]$'
:
outputStdout
().
join
(
'
\n
'
),
r'^Hello {15} {5} {8}[\b]{8} {7}⣽[\b]{8} {8}[\b]{8}[\d, ]{4}[\d]\.[\d]s[\n]$'
));
matches
(
terminal
.
supportsEmoji
?
r'^Hello {15} {5} {8}[\b]{8} {7}⣽[\b]{8} {8}[\b]{8}[\d, ]{4}[\d]\.[\d]s[\n]$'
:
r'^Hello {15} {5} {8}[\b]{8} {7}\\[\b]{8} {8}[\b]{8}[\d, ]{4}[\d]\.[\d]s[\n]$'
,
),
);
done
=
true
;
done
=
true
;
});
});
expect
(
done
,
isTrue
);
expect
(
done
,
isTrue
);
});
});
testWithoutContext
(
'Stdout startProgress on colored terminal pauses on
$testO
s
'
,
()
async
{
testWithoutContext
(
'Stdout startProgress on colored terminal pause
s'
,
()
async
{
bool
done
=
false
;
bool
done
=
false
;
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
mockStopwatch
.
elapsed
=
const
Duration
(
seconds:
5
);
mockStopwatch
.
elapsed
=
const
Duration
(
seconds:
5
);
final
Logger
logger
=
StdoutLogger
(
final
Logger
logger
=
StdoutLogger
(
terminal:
AnsiTerminal
(
terminal:
coloredTerminal
,
stdio:
mockStdio
,
platform:
FakePlatform
(
operatingSystem:
testOs
)..
stdoutSupportsAnsi
=
true
,
),
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
stopwatchFactory:
stopwatchFactory
,
stopwatchFactory:
stopwatchFactory
,
platform:
currentPlatform
(),
);
);
final
Status
status
=
logger
.
startProgress
(
final
Status
status
=
logger
.
startProgress
(
'Knock Knock, Who
\'
s There'
,
'Knock Knock, Who
\'
s There'
,
...
@@ -282,8 +325,8 @@ void main() {
...
@@ -282,8 +325,8 @@ void main() {
);
);
logger
.
printStatus
(
'Rude Interrupting Cow'
);
logger
.
printStatus
(
'Rude Interrupting Cow'
);
status
.
stop
();
status
.
stop
();
final
String
a
=
currentPlatform
().
isWindows
?
r'\'
:
'⣽
'
;
final
String
a
=
terminal
.
supportsEmoji
?
'⣽'
:
r'\
'
;
final
String
b
=
currentPlatform
().
isWindows
?
'|'
:
'⣻
'
;
final
String
b
=
terminal
.
supportsEmoji
?
'⣻'
:
'|
'
;
expect
(
expect
(
outputStdout
().
join
(
'
\n
'
),
outputStdout
().
join
(
'
\n
'
),
...
@@ -307,8 +350,7 @@ void main() {
...
@@ -307,8 +350,7 @@ void main() {
expect
(
done
,
isTrue
);
expect
(
done
,
isTrue
);
});
});
testWithoutContext
(
'AnsiStatus works for
$testOs
'
,
()
{
testWithoutContext
(
'AnsiStatus works'
,
()
{
final
AnsiStatus
ansiStatus
=
createAnsiStatus
();
bool
done
=
false
;
bool
done
=
false
;
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
ansiStatus
.
start
();
ansiStatus
.
start
();
...
@@ -340,8 +382,7 @@ void main() {
...
@@ -340,8 +382,7 @@ void main() {
expect
(
done
,
isTrue
);
expect
(
done
,
isTrue
);
});
});
testWithoutContext
(
'AnsiStatus works when canceled for
$testOs
'
,
()
async
{
testWithoutContext
(
'AnsiStatus works when canceled'
,
()
async
{
final
AnsiStatus
ansiStatus
=
createAnsiStatus
();
bool
done
=
false
;
bool
done
=
false
;
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
ansiStatus
.
start
();
ansiStatus
.
start
();
...
@@ -349,9 +390,11 @@ void main() {
...
@@ -349,9 +390,11 @@ void main() {
doWhileAsync
(
time
,
()
=>
ansiStatus
.
ticks
<
10
);
doWhileAsync
(
time
,
()
=>
ansiStatus
.
ticks
<
10
);
List
<
String
>
lines
=
outputStdout
();
List
<
String
>
lines
=
outputStdout
();
expect
(
lines
[
0
],
startsWith
(
testOs
==
'windows'
expect
(
lines
[
0
],
startsWith
(
?
'Hello world
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b /
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b -
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b /
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b -
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |'
terminal
.
supportsEmoji
:
'Hello world
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣽
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣻
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⢿
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⡿
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣟
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣯
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣷
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣾
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣽
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣻'
));
?
'Hello world
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣽
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣻
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⢿
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⡿
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣟
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣯
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣷
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣾
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣽
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣻'
:
'Hello world
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b /
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b -
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b /
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b -
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |'
,
));
expect
(
lines
.
length
,
equals
(
1
));
expect
(
lines
.
length
,
equals
(
1
));
expect
(
lines
[
0
].
endsWith
(
'
\n
'
),
isFalse
);
expect
(
lines
[
0
].
endsWith
(
'
\n
'
),
isFalse
);
...
@@ -360,7 +403,7 @@ void main() {
...
@@ -360,7 +403,7 @@ void main() {
lines
=
outputStdout
();
lines
=
outputStdout
();
final
List
<
Match
>
matches
=
secondDigits
.
allMatches
(
lines
[
0
]).
toList
();
final
List
<
Match
>
matches
=
secondDigits
.
allMatches
(
lines
[
0
]).
toList
();
expect
(
matches
,
isEmpty
);
expect
(
matches
,
isEmpty
);
final
String
leading
=
currentPlatform
().
isWindows
?
'|'
:
'⣻
'
;
final
String
leading
=
terminal
.
supportsEmoji
?
'⣻'
:
'|
'
;
expect
(
lines
[
0
],
endsWith
(
'
$leading
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b'
));
expect
(
lines
[
0
],
endsWith
(
'
$leading
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b'
));
expect
(
called
,
equals
(
1
));
expect
(
called
,
equals
(
1
));
...
@@ -375,8 +418,7 @@ void main() {
...
@@ -375,8 +418,7 @@ void main() {
expect
(
done
,
isTrue
);
expect
(
done
,
isTrue
);
});
});
testWithoutContext
(
'AnsiStatus works when stopped for
$testOs
'
,
()
async
{
testWithoutContext
(
'AnsiStatus works when stopped'
,
()
async
{
final
AnsiStatus
ansiStatus
=
createAnsiStatus
();
bool
done
=
false
;
bool
done
=
false
;
FakeAsync
().
run
((
FakeAsync
time
)
{
FakeAsync
().
run
((
FakeAsync
time
)
{
ansiStatus
.
start
();
ansiStatus
.
start
();
...
@@ -385,10 +427,11 @@ void main() {
...
@@ -385,10 +427,11 @@ void main() {
List
<
String
>
lines
=
outputStdout
();
List
<
String
>
lines
=
outputStdout
();
expect
(
lines
,
hasLength
(
1
));
expect
(
lines
,
hasLength
(
1
));
expect
(
lines
[
0
],
expect
(
currentPlatform
().
isWindows
lines
[
0
],
?
'Hello world
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b /
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b -
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b /
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b -
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |'
terminal
.
supportsEmoji
:
'Hello world
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣽
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣻
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⢿
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⡿
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣟
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣯
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣷
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣾
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣽
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣻'
,
?
'Hello world
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣽
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣻
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⢿
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⡿
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣟
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣯
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣷
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣾
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣽
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b ⣻'
:
'Hello world
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b /
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b -
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b /
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b -
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\\
\
b
\
b
\
b
\
b
\
b
\
b
\
b
\
b |'
,
);
);
// Verify a stop prints the time.
// Verify a stop prints the time.
...
@@ -396,9 +439,9 @@ void main() {
...
@@ -396,9 +439,9 @@ void main() {
lines
=
outputStdout
();
lines
=
outputStdout
();
expect
(
lines
,
hasLength
(
2
));
expect
(
lines
,
hasLength
(
2
));
expect
(
lines
[
0
],
matches
(
expect
(
lines
[
0
],
matches
(
currentPlatform
().
isWindows
terminal
.
supportsEmoji
?
r'Hello world {8}[\b]{8} {7}\\[\b]{8} {7}|[\b]{8} {7}/[\b]{8} {7}-[\b]{8} {7}\\[\b]{8} {7}|[\b]{8} {7}/[\b]{8} {7}-[\b]{8} {7}\\[\b]{8} {7}|[\b]{8} {7} [\b]{8}[\d., ]{6
}[\d]ms$'
?
r'Hello world {8}[\b]{8} {7}⣽[\b]{8} {7}⣻[\b]{8} {7}⢿[\b]{8} {7}⡿[\b]{8} {7}⣟[\b]{8} {7}⣯[\b]{8} {7}⣷[\b]{8} {7}⣾[\b]{8} {7}⣽[\b]{8} {7}⣻[\b]{8} {7} [\b]{8}[\d., ]{5
}[\d]ms$'
:
r'Hello world {8}[\b]{8} {7}⣽[\b]{8} {7}⣻[\b]{8} {7}⢿[\b]{8} {7}⡿[\b]{8} {7}⣟[\b]{8} {7}⣯[\b]{8} {7}⣷[\b]{8} {7}⣾[\b]{8} {7}⣽[\b]{8} {7}⣻[\b]{8} {7} [\b]{8}[\d., ]{5}[\d]ms$'
:
r'Hello world {8}[\b]{8} {7}\\[\b]{8} {7}|[\b]{8} {7}/[\b]{8} {7}-[\b]{8} {7}\\[\b]{8} {7}|[\b]{8} {7}/[\b]{8} {7}-[\b]{8} {7}\\[\b]{8} {7}|[\b]{8} {7} [\b]{8}[\d., ]{6}[\d]ms$'
,
));
));
expect
(
lines
[
1
],
isEmpty
);
expect
(
lines
[
1
],
isEmpty
);
final
List
<
Match
>
times
=
secondDigits
.
allMatches
(
lines
[
0
]).
toList
();
final
List
<
Match
>
times
=
secondDigits
.
allMatches
(
lines
[
0
]).
toList
();
...
@@ -418,6 +461,7 @@ void main() {
...
@@ -418,6 +461,7 @@ void main() {
});
});
expect
(
done
,
isTrue
);
expect
(
done
,
isTrue
);
});
});
});
}
}
});
});
...
@@ -453,7 +497,6 @@ void main() {
...
@@ -453,7 +497,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printError
(
'0123456789'
*
15
);
logger
.
printError
(
'0123456789'
*
15
);
final
List
<
String
>
lines
=
outputStderr
();
final
List
<
String
>
lines
=
outputStderr
();
...
@@ -475,7 +518,6 @@ void main() {
...
@@ -475,7 +518,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printError
(
'0123456789'
*
15
,
indent:
5
);
logger
.
printError
(
'0123456789'
*
15
,
indent:
5
);
final
List
<
String
>
lines
=
outputStderr
();
final
List
<
String
>
lines
=
outputStderr
();
...
@@ -500,7 +542,6 @@ void main() {
...
@@ -500,7 +542,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printError
(
'0123456789'
*
15
,
hangingIndent:
5
);
logger
.
printError
(
'0123456789'
*
15
,
hangingIndent:
5
);
final
List
<
String
>
lines
=
outputStderr
();
final
List
<
String
>
lines
=
outputStderr
();
...
@@ -525,7 +566,6 @@ void main() {
...
@@ -525,7 +566,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printError
(
'0123456789'
*
15
,
indent:
4
,
hangingIndent:
5
);
logger
.
printError
(
'0123456789'
*
15
,
indent:
4
,
hangingIndent:
5
);
final
List
<
String
>
lines
=
outputStderr
();
final
List
<
String
>
lines
=
outputStderr
();
...
@@ -550,7 +590,6 @@ void main() {
...
@@ -550,7 +590,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printStatus
(
'0123456789'
*
15
);
logger
.
printStatus
(
'0123456789'
*
15
);
final
List
<
String
>
lines
=
outputStdout
();
final
List
<
String
>
lines
=
outputStdout
();
...
@@ -572,7 +611,6 @@ void main() {
...
@@ -572,7 +611,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printStatus
(
'0123456789'
*
15
,
indent:
5
);
logger
.
printStatus
(
'0123456789'
*
15
,
indent:
5
);
final
List
<
String
>
lines
=
outputStdout
();
final
List
<
String
>
lines
=
outputStdout
();
...
@@ -597,7 +635,6 @@ void main() {
...
@@ -597,7 +635,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printStatus
(
'0123456789'
*
15
,
hangingIndent:
5
);
logger
.
printStatus
(
'0123456789'
*
15
,
hangingIndent:
5
);
final
List
<
String
>
lines
=
outputStdout
();
final
List
<
String
>
lines
=
outputStdout
();
...
@@ -622,7 +659,6 @@ void main() {
...
@@ -622,7 +659,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
wrapText:
true
,
wrapColumn:
40
,
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printStatus
(
'0123456789'
*
15
,
indent:
4
,
hangingIndent:
5
);
logger
.
printStatus
(
'0123456789'
*
15
,
indent:
4
,
hangingIndent:
5
);
final
List
<
String
>
lines
=
outputStdout
();
final
List
<
String
>
lines
=
outputStdout
();
...
@@ -647,7 +683,6 @@ void main() {
...
@@ -647,7 +683,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printError
(
'Pants on fire!'
);
logger
.
printError
(
'Pants on fire!'
);
final
List
<
String
>
lines
=
outputStderr
();
final
List
<
String
>
lines
=
outputStderr
();
...
@@ -666,7 +701,6 @@ void main() {
...
@@ -666,7 +701,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printStatus
(
'All good.'
);
logger
.
printStatus
(
'All good.'
);
...
@@ -685,7 +719,6 @@ void main() {
...
@@ -685,7 +719,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
outputPreferences:
OutputPreferences
.
test
(
showColor:
true
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printStatus
(
logger
.
printStatus
(
null
,
null
,
...
@@ -710,7 +743,6 @@ void main() {
...
@@ -710,7 +743,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
printStatus
(
logger
.
printStatus
(
null
,
null
,
...
@@ -736,7 +768,6 @@ void main() {
...
@@ -736,7 +768,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
final
Status
status
=
logger
.
startProgress
(
final
Status
status
=
logger
.
startProgress
(
'Hello'
,
'Hello'
,
...
@@ -818,7 +849,6 @@ void main() {
...
@@ -818,7 +849,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(
showColor:
false
),
outputPreferences:
OutputPreferences
.
test
(
showColor:
false
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
);
);
logger
.
startProgress
(
'AAA'
,
timeout:
const
TimeoutConfiguration
().
fastOperation
)..
stop
();
logger
.
startProgress
(
'AAA'
,
timeout:
const
TimeoutConfiguration
().
fastOperation
)..
stop
();
logger
.
startProgress
(
'BBB'
,
timeout:
const
TimeoutConfiguration
().
fastOperation
)..
stop
();
logger
.
startProgress
(
'BBB'
,
timeout:
const
TimeoutConfiguration
().
fastOperation
)..
stop
();
...
@@ -843,7 +873,6 @@ void main() {
...
@@ -843,7 +873,6 @@ void main() {
stdio:
mockStdio
,
stdio:
mockStdio
,
outputPreferences:
OutputPreferences
.
test
(),
outputPreferences:
OutputPreferences
.
test
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
),
),
stopwatchFactory:
FakeStopwatchFactory
(),
stopwatchFactory:
FakeStopwatchFactory
(),
);
);
...
...
packages/flutter_tools/test/general.shard/vmservice_test.dart
View file @
c23d9cd4
...
@@ -204,9 +204,11 @@ void main() {
...
@@ -204,9 +204,11 @@ void main() {
Logger:
()
=>
StdoutLogger
(
Logger:
()
=>
StdoutLogger
(
outputPreferences:
OutputPreferences
.
test
(),
outputPreferences:
OutputPreferences
.
test
(),
stdio:
mockStdio
,
stdio:
mockStdio
,
terminal:
AnsiTerminal
(
stdio:
mockStdio
,
platform:
const
LocalPlatform
()),
terminal:
AnsiTerminal
(
stdio:
mockStdio
,
platform:
const
LocalPlatform
(),
),
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
),
),
WebSocketConnector:
()
=>
(
String
url
,
{
CompressionOptions
compression
})
async
=>
throw
const
SocketException
(
'test'
),
WebSocketConnector:
()
=>
(
String
url
,
{
CompressionOptions
compression
})
async
=>
throw
const
SocketException
(
'test'
),
});
});
...
@@ -283,10 +285,12 @@ void main() {
...
@@ -283,10 +285,12 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Logger:
()
=>
StdoutLogger
(
Logger:
()
=>
StdoutLogger
(
outputPreferences:
outputPreferences
,
outputPreferences:
outputPreferences
,
terminal:
AnsiTerminal
(
stdio:
mockStdio
,
platform:
const
LocalPlatform
()),
terminal:
AnsiTerminal
(
stdio:
mockStdio
,
platform:
const
LocalPlatform
(),
),
stdio:
mockStdio
,
stdio:
mockStdio
,
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
),
),
});
});
...
@@ -301,10 +305,12 @@ void main() {
...
@@ -301,10 +305,12 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Logger:
()
=>
StdoutLogger
(
Logger:
()
=>
StdoutLogger
(
outputPreferences:
outputPreferences
,
outputPreferences:
outputPreferences
,
terminal:
AnsiTerminal
(
stdio:
mockStdio
,
platform:
const
LocalPlatform
()),
terminal:
AnsiTerminal
(
stdio:
mockStdio
,
platform:
const
LocalPlatform
(),
),
stdio:
mockStdio
,
stdio:
mockStdio
,
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
),
),
});
});
...
@@ -320,10 +326,12 @@ void main() {
...
@@ -320,10 +326,12 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Logger:
()
=>
StdoutLogger
(
Logger:
()
=>
StdoutLogger
(
outputPreferences:
outputPreferences
,
outputPreferences:
outputPreferences
,
terminal:
AnsiTerminal
(
stdio:
mockStdio
,
platform:
const
LocalPlatform
()),
terminal:
AnsiTerminal
(
stdio:
mockStdio
,
platform:
const
LocalPlatform
(),
),
stdio:
mockStdio
,
stdio:
mockStdio
,
timeoutConfiguration:
const
TimeoutConfiguration
(),
timeoutConfiguration:
const
TimeoutConfiguration
(),
platform:
FakePlatform
(),
),
),
});
});
...
...
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