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
fef9d4d7
Unverified
Commit
fef9d4d7
authored
Apr 05, 2020
by
Zachary Anderson
Committed by
GitHub
Apr 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Launch DevTools with 'v' (#53902)
parent
caeaac77
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
0 deletions
+55
-0
command_help.dart
packages/flutter_tools/lib/src/base/command_help.dart
+6
-0
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+37
-0
command_help_test.dart
...tter_tools/test/general.shard/base/command_help_test.dart
+4
-0
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+1
-0
terminal_handler_test.dart
...utter_tools/test/general.shard/terminal_handler_test.dart
+7
-0
No files found.
packages/flutter_tools/lib/src/base/command_help.dart
View file @
fef9d4d7
...
...
@@ -140,6 +140,12 @@ class CommandHelp {
'debugDumpRenderTree'
,
);
CommandHelpOption
_v
;
CommandHelpOption
get
v
=>
_v
??=
_makeOption
(
'v'
,
'Launch DevTools.'
,
);
CommandHelpOption
_w
;
CommandHelpOption
get
w
=>
_w
??=
_makeOption
(
'w'
,
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
fef9d4d7
...
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'package:devtools_server/devtools_server.dart'
as
devtools_server
;
import
'package:meta/meta.dart'
;
import
'application_package.dart'
;
...
...
@@ -650,6 +651,8 @@ abstract class ResidentRunner {
final
CommandHelp
commandHelp
;
io
.
HttpServer
_devtoolsServer
;
bool
_exited
=
false
;
Completer
<
int
>
_finished
=
Completer
<
int
>();
bool
hotMode
;
...
...
@@ -769,12 +772,14 @@ abstract class ResidentRunner {
Future
<
void
>
exit
()
async
{
_exited
=
true
;
await
shutdownDevtools
();
await
stopEchoingDeviceLog
();
await
preExit
();
await
exitApp
();
}
Future
<
void
>
detach
()
async
{
await
shutdownDevtools
();
await
stopEchoingDeviceLog
();
await
preExit
();
appFinished
();
...
...
@@ -982,6 +987,31 @@ abstract class ResidentRunner {
}
}
Future
<
void
>
launchDevTools
()
async
{
try
{
assert
(
supportsServiceProtocol
);
_devtoolsServer
??=
await
devtools_server
.
serveDevTools
(
enableStdinCommands:
false
,
);
await
devtools_server
.
launchDevTools
(
<
String
,
dynamic
>{
'reuseWindows'
:
true
,
},
flutterDevices
.
first
.
vmService
.
httpAddress
,
'http://
${_devtoolsServer.address.host}
:
${_devtoolsServer.port}
'
,
false
,
// headless mode,
false
,
// machine mode
);
}
on
Exception
catch
(
e
,
st
)
{
globals
.
printTrace
(
'Failed to launch DevTools:
$e
\n
$st
'
);
}
}
Future
<
void
>
shutdownDevtools
()
async
{
await
_devtoolsServer
?.
close
();
_devtoolsServer
=
null
;
}
Future
<
void
>
_serviceProtocolDone
(
dynamic
object
)
async
{
globals
.
printTrace
(
'Service protocol connection closed.'
);
}
...
...
@@ -1064,6 +1094,7 @@ abstract class ResidentRunner {
if
(
supportsCanvasKit
){
commandHelp
.
k
.
print
();
}
commandHelp
.
v
.
print
();
// `P` should precede `a`
commandHelp
.
P
.
print
();
commandHelp
.
a
.
print
();
...
...
@@ -1299,6 +1330,12 @@ class TerminalHandler {
return
true
;
}
return
false
;
case
'v'
:
if
(
residentRunner
.
supportsServiceProtocol
)
{
await
residentRunner
.
launchDevTools
();
return
true
;
}
return
false
;
case
'w'
:
case
'W'
:
if
(
residentRunner
.
supportsServiceProtocol
)
{
...
...
packages/flutter_tools/test/general.shard/base/command_help_test.dart
View file @
fef9d4d7
...
...
@@ -66,6 +66,7 @@ void _testMessageLength({
expect
(
commandHelp
.
r
.
toString
().
length
,
lessThanOrEqualTo
(
expectedWidth
));
expect
(
commandHelp
.
s
.
toString
().
length
,
lessThanOrEqualTo
(
expectedWidth
));
expect
(
commandHelp
.
t
.
toString
().
length
,
lessThanOrEqualTo
(
expectedWidth
));
expect
(
commandHelp
.
v
.
toString
().
length
,
lessThanOrEqualTo
(
expectedWidth
));
expect
(
commandHelp
.
w
.
toString
().
length
,
lessThanOrEqualTo
(
expectedWidth
));
expect
(
commandHelp
.
z
.
toString
().
length
,
lessThanOrEqualTo
(
expectedWidth
));
}
...
...
@@ -95,6 +96,7 @@ void main() {
expect
(
commandHelp
.
r
.
toString
(),
startsWith
(
'
\
x1B[1mr
\
x1B[22m'
));
expect
(
commandHelp
.
s
.
toString
(),
startsWith
(
'
\
x1B[1ms
\
x1B[22m'
));
expect
(
commandHelp
.
t
.
toString
(),
startsWith
(
'
\
x1B[1mt
\
x1B[22m'
));
expect
(
commandHelp
.
v
.
toString
(),
startsWith
(
'
\
x1B[1mv
\
x1B[22m'
));
expect
(
commandHelp
.
w
.
toString
(),
startsWith
(
'
\
x1B[1mw
\
x1B[22m'
));
expect
(
commandHelp
.
z
.
toString
(),
startsWith
(
'
\
x1B[1mz
\
x1B[22m'
));
});
...
...
@@ -170,6 +172,7 @@ void main() {
expect
(
commandHelp
.
r
.
toString
(),
equals
(
'
\
x1B[1mr
\
x1B[22m Hot reload.
$fire$fire$fire
'
));
expect
(
commandHelp
.
s
.
toString
(),
equals
(
'
\
x1B[1ms
\
x1B[22m Save a screenshot to flutter.png.'
));
expect
(
commandHelp
.
t
.
toString
(),
equals
(
'
\
x1B[1mt
\
x1B[22m Dump rendering tree to the console.
\
x1B[1;30m(debugDumpRenderTree)
\
x1B[39m'
));
expect
(
commandHelp
.
v
.
toString
(),
equals
(
'
\
x1B[1mv
\
x1B[22m Launch DevTools.'
));
expect
(
commandHelp
.
w
.
toString
(),
equals
(
'
\
x1B[1mw
\
x1B[22m Dump widget hierarchy to the console.
\
x1B[1;30m(debugDumpApp)
\
x1B[39m'
));
expect
(
commandHelp
.
z
.
toString
(),
equals
(
'
\
x1B[1mz
\
x1B[22m Toggle elevation checker.'
));
});
...
...
@@ -195,6 +198,7 @@ void main() {
expect
(
commandHelp
.
r
.
toString
(),
equals
(
'r Hot reload.
$fire$fire$fire
'
));
expect
(
commandHelp
.
s
.
toString
(),
equals
(
's Save a screenshot to flutter.png.'
));
expect
(
commandHelp
.
t
.
toString
(),
equals
(
't Dump rendering tree to the console. (debugDumpRenderTree)'
));
expect
(
commandHelp
.
v
.
toString
(),
equals
(
'v Launch DevTools.'
));
expect
(
commandHelp
.
w
.
toString
(),
equals
(
'w Dump widget hierarchy to the console. (debugDumpApp)'
));
expect
(
commandHelp
.
z
.
toString
(),
equals
(
'z Toggle elevation checker.'
));
});
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
fef9d4d7
...
...
@@ -406,6 +406,7 @@ void main() {
commandHelp
.
p
,
commandHelp
.
o
,
commandHelp
.
z
,
commandHelp
.
v
,
commandHelp
.
P
,
commandHelp
.
a
,
'An Observatory debugger and profiler on null is available at: null'
,
...
...
packages/flutter_tools/test/general.shard/terminal_handler_test.dart
View file @
fef9d4d7
...
...
@@ -364,6 +364,13 @@ void main() {
verifyNever
(
mockResidentRunner
.
debugDumpSemanticsTreeInInverseHitTestOrder
());
});
testUsingContext
(
'v - launchDevTools'
,
()
async
{
when
(
mockResidentRunner
.
supportsServiceProtocol
).
thenReturn
(
true
);
await
terminalHandler
.
processTerminalInput
(
'v'
);
verify
(
mockResidentRunner
.
launchDevTools
()).
called
(
1
);
});
testUsingContext
(
'w,W - debugDumpApp with service protocol'
,
()
async
{
await
terminalHandler
.
processTerminalInput
(
'w'
);
await
terminalHandler
.
processTerminalInput
(
'W'
);
...
...
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