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
830c0dfe
Unverified
Commit
830c0dfe
authored
Jan 18, 2019
by
Jonah Williams
Committed by
GitHub
Jan 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow attaching to profile builds (#26720)
parent
179fa904
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
16 deletions
+81
-16
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+23
-13
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+5
-0
run_cold.dart
packages/flutter_tools/lib/src/run_cold.dart
+46
-3
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+1
-0
resident_runner_test.dart
packages/flutter_tools/test/resident_runner_test.dart
+6
-0
No files found.
packages/flutter_tools/lib/src/commands/attach.dart
View file @
830c0dfe
...
@@ -16,6 +16,7 @@ import '../fuchsia/fuchsia_device.dart';
...
@@ -16,6 +16,7 @@ import '../fuchsia/fuchsia_device.dart';
import
'../globals.dart'
;
import
'../globals.dart'
;
import
'../protocol_discovery.dart'
;
import
'../protocol_discovery.dart'
;
import
'../resident_runner.dart'
;
import
'../resident_runner.dart'
;
import
'../run_cold.dart'
;
import
'../run_hot.dart'
;
import
'../run_hot.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../runner/flutter_command.dart'
;
...
@@ -176,6 +177,7 @@ class AttachCommand extends FlutterCommand {
...
@@ -176,6 +177,7 @@ class AttachCommand extends FlutterCommand {
:
Uri
.
parse
(
'http://
$ipv4Loopback
:
$localPort
/'
);
:
Uri
.
parse
(
'http://
$ipv4Loopback
:
$localPort
/'
);
}
}
try
{
try
{
final
bool
useHot
=
getBuildInfo
().
isDebug
;
final
FlutterDevice
flutterDevice
=
FlutterDevice
(
final
FlutterDevice
flutterDevice
=
FlutterDevice
(
device
,
device
,
trackWidgetCreation:
false
,
trackWidgetCreation:
false
,
...
@@ -186,24 +188,32 @@ class AttachCommand extends FlutterCommand {
...
@@ -186,24 +188,32 @@ class AttachCommand extends FlutterCommand {
targetModel:
TargetModel
(
argResults
[
'target-model'
]),
targetModel:
TargetModel
(
argResults
[
'target-model'
]),
);
);
flutterDevice
.
observatoryUris
=
<
Uri
>[
observatoryUri
];
flutterDevice
.
observatoryUris
=
<
Uri
>[
observatoryUri
];
final
HotRunner
hotRunner
=
hotRunnerFactory
.
build
(
final
List
<
FlutterDevice
>
flutterDevices
=
<
FlutterDevice
>[
flutterDevice
];
<
FlutterDevice
>[
flutterDevice
],
final
DebuggingOptions
debuggingOptions
=
DebuggingOptions
.
enabled
(
getBuildInfo
());
final
ResidentRunner
runner
=
useHot
?
hotRunnerFactory
.
build
(
flutterDevices
,
target:
targetFile
,
target:
targetFile
,
debuggingOptions:
DebuggingOptions
.
enabled
(
getBuildInfo
())
,
debuggingOptions:
debuggingOptions
,
packagesFilePath:
globalResults
[
'packages'
],
packagesFilePath:
globalResults
[
'packages'
],
usesTerminalUI:
daemon
==
null
,
usesTerminalUI:
daemon
==
null
,
projectRootPath:
argResults
[
'project-root'
],
projectRootPath:
argResults
[
'project-root'
],
dillOutputPath:
argResults
[
'output-dill'
],
dillOutputPath:
argResults
[
'output-dill'
],
ipv6:
usesIpv6
,
ipv6:
usesIpv6
,
)
:
ColdRunner
(
flutterDevices
,
target:
targetFile
,
debuggingOptions:
debuggingOptions
,
ipv6:
usesIpv6
,
);
);
if
(
attachLogger
)
{
if
(
attachLogger
)
{
flutterDevice
.
startEchoingDeviceLog
();
flutterDevice
.
startEchoingDeviceLog
();
}
}
if
(
daemon
!=
null
)
{
if
(
daemon
!=
null
)
{
AppInstance
app
;
AppInstance
app
;
try
{
try
{
app
=
await
daemon
.
appDomain
.
launch
(
hotRunner
,
hotR
unner
.
attach
,
app
=
await
daemon
.
appDomain
.
launch
(
runner
,
r
unner
.
attach
,
device
,
null
,
true
,
fs
.
currentDirectory
);
device
,
null
,
true
,
fs
.
currentDirectory
);
}
catch
(
error
)
{
}
catch
(
error
)
{
throwToolExit
(
error
.
toString
());
throwToolExit
(
error
.
toString
());
...
@@ -212,7 +222,7 @@ class AttachCommand extends FlutterCommand {
...
@@ -212,7 +222,7 @@ class AttachCommand extends FlutterCommand {
if
(
result
!=
0
)
if
(
result
!=
0
)
throwToolExit
(
null
,
exitCode:
result
);
throwToolExit
(
null
,
exitCode:
result
);
}
else
{
}
else
{
await
hotR
unner
.
attach
();
await
r
unner
.
attach
();
}
}
}
finally
{
}
finally
{
final
List
<
ForwardedPort
>
ports
=
device
.
portForwarder
.
forwardedPorts
.
toList
();
final
List
<
ForwardedPort
>
ports
=
device
.
portForwarder
.
forwardedPorts
.
toList
();
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
830c0dfe
...
@@ -489,6 +489,11 @@ abstract class ResidentRunner {
...
@@ -489,6 +489,11 @@ abstract class ResidentRunner {
bool
shouldBuild
=
true
bool
shouldBuild
=
true
});
});
Future
<
int
>
attach
({
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
void
>
appStartedCompleter
,
});
bool
get
supportsRestart
=>
false
;
bool
get
supportsRestart
=>
false
;
Future
<
OperationResult
>
restart
({
bool
fullRestart
=
false
,
bool
pauseAfterRestart
=
false
,
String
reason
})
{
Future
<
OperationResult
>
restart
({
bool
fullRestart
=
false
,
bool
pauseAfterRestart
=
false
,
String
reason
})
{
...
...
packages/flutter_tools/lib/src/run_cold.dart
View file @
830c0dfe
...
@@ -11,6 +11,7 @@ import 'device.dart';
...
@@ -11,6 +11,7 @@ import 'device.dart';
import
'globals.dart'
;
import
'globals.dart'
;
import
'resident_runner.dart'
;
import
'resident_runner.dart'
;
import
'tracing.dart'
;
import
'tracing.dart'
;
import
'vmservice.dart'
;
// TODO(mklim): Test this, flutter/flutter#23031.
// TODO(mklim): Test this, flutter/flutter#23031.
class
ColdRunner
extends
ResidentRunner
{
class
ColdRunner
extends
ResidentRunner
{
...
@@ -34,6 +35,7 @@ class ColdRunner extends ResidentRunner {
...
@@ -34,6 +35,7 @@ class ColdRunner extends ResidentRunner {
final
bool
traceStartup
;
final
bool
traceStartup
;
final
File
applicationBinary
;
final
File
applicationBinary
;
bool
_didAttach
=
false
;
@override
@override
Future
<
int
>
run
({
Future
<
int
>
run
({
...
@@ -111,12 +113,50 @@ class ColdRunner extends ResidentRunner {
...
@@ -111,12 +113,50 @@ class ColdRunner extends ResidentRunner {
return
0
;
return
0
;
}
}
@override
Future
<
int
>
attach
({
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
void
>
appStartedCompleter
,
})
async
{
_didAttach
=
true
;
try
{
await
connectToServiceProtocol
();
}
catch
(
error
)
{
printError
(
'Error connecting to the service protocol:
$error
'
);
return
2
;
}
for
(
FlutterDevice
device
in
flutterDevices
)
{
device
.
initLogReader
();
}
await
refreshViews
();
for
(
FlutterDevice
device
in
flutterDevices
)
{
for
(
FlutterView
view
in
device
.
views
)
{
printTrace
(
'Connected to
$view
.'
);
}
}
if
(
stayResident
)
{
setupTerminal
();
registerSignalHandlers
();
}
appStartedCompleter
?.
complete
();
if
(
stayResident
)
{
return
waitForAppToFinish
();
}
await
cleanupAtFinish
();
return
0
;
}
@override
@override
Future
<
void
>
handleTerminalCommand
(
String
code
)
async
{
}
Future
<
void
>
handleTerminalCommand
(
String
code
)
async
{
}
@override
@override
Future
<
void
>
cleanupAfterSignal
()
async
{
Future
<
void
>
cleanupAfterSignal
()
async
{
await
stopEchoingDeviceLog
();
await
stopEchoingDeviceLog
();
if
(
_didAttach
)
{
appFinished
();
}
else
{
await
stopApp
();
}
await
stopApp
();
await
stopApp
();
}
}
...
@@ -145,15 +185,18 @@ class ColdRunner extends ResidentRunner {
...
@@ -145,15 +185,18 @@ class ColdRunner extends ResidentRunner {
haveAnything
=
true
;
haveAnything
=
true
;
}
}
}
}
final
String
quitMessage
=
_didAttach
?
'To detach, press "d"; to quit, press "q".'
:
'To quit, press "q".'
;
if
(
haveDetails
&&
!
details
)
{
if
(
haveDetails
&&
!
details
)
{
if
(
saveCompilationTrace
)
{
if
(
saveCompilationTrace
)
{
printStatus
(
'Compilation training data will be saved when flutter run quits...'
);
printStatus
(
'Compilation training data will be saved when flutter run quits...'
);
}
}
printStatus
(
'For a more detailed help message, press "h".
To quit, press "q".
'
);
printStatus
(
'For a more detailed help message, press "h".
$quitMessage
'
);
}
else
if
(
haveAnything
)
{
}
else
if
(
haveAnything
)
{
printStatus
(
'To repeat this help message, press "h".
To quit, press "q".
'
);
printStatus
(
'To repeat this help message, press "h".
$quitMessage
'
);
}
else
{
}
else
{
printStatus
(
'To quit, press "q".'
);
printStatus
(
quitMessage
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
830c0dfe
...
@@ -176,6 +176,7 @@ class HotRunner extends ResidentRunner {
...
@@ -176,6 +176,7 @@ class HotRunner extends ResidentRunner {
throw
'Failed to compile
$expression
'
;
throw
'Failed to compile
$expression
'
;
}
}
@override
Future
<
int
>
attach
({
Future
<
int
>
attach
({
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
void
>
appStartedCompleter
,
Completer
<
void
>
appStartedCompleter
,
...
...
packages/flutter_tools/test/resident_runner_test.dart
View file @
830c0dfe
...
@@ -40,6 +40,12 @@ class TestRunner extends ResidentRunner {
...
@@ -40,6 +40,12 @@ class TestRunner extends ResidentRunner {
String
route
,
String
route
,
bool
shouldBuild
=
true
,
bool
shouldBuild
=
true
,
})
async
=>
null
;
})
async
=>
null
;
@override
Future
<
int
>
attach
({
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
void
>
appStartedCompleter
,
})
async
=>
null
;
}
}
void
main
(
)
{
void
main
(
)
{
...
...
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