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
576b4e11
Commit
576b4e11
authored
Jan 27, 2017
by
Ian Hickson
Committed by
GitHub
Jan 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change --debug-port to --observatory-port (#7675)
...and add --diagnostic-port. ...and document port 0.
parent
682c7992
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
49 additions
and
24 deletions
+49
-24
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+1
-1
os.dart
packages/flutter_tools/lib/src/base/os.dart
+1
-0
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+2
-1
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+5
-6
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+16
-7
device.dart
packages/flutter_tools/lib/src/device.dart
+4
-1
hot.dart
packages/flutter_tools/lib/src/hot.dart
+0
-1
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+2
-2
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+2
-0
protocol_discovery.dart
packages/flutter_tools/lib/src/protocol_discovery.dart
+2
-3
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+1
-2
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+13
-0
No files found.
packages/flutter_tools/lib/src/android/android_device.dart
View file @
576b4e11
...
...
@@ -445,7 +445,7 @@ class AndroidDevice extends Device {
Match
match
=
discoverExp
.
firstMatch
(
line
);
if
(
match
!=
null
)
{
Map
<
String
,
dynamic
>
app
=
JSON
.
decode
(
match
.
group
(
1
));
result
.
add
(
new
DiscoveredApp
(
app
[
'id'
],
app
[
'observatoryPort'
]));
result
.
add
(
new
DiscoveredApp
(
app
[
'id'
],
app
[
'observatoryPort'
]
,
app
[
'diagnosticPort'
]
));
}
});
...
...
packages/flutter_tools/lib/src/base/os.dart
View file @
576b4e11
...
...
@@ -163,6 +163,7 @@ Future<int> findPreferredPort(int defaultPort, { int searchStep: 2 }) async {
Future
<
bool
>
_isPortAvailable
(
int
port
)
async
{
try
{
// TODO(ianh): This is super racy.
ServerSocket
socket
=
await
ServerSocket
.
bind
(
InternetAddress
.
LOOPBACK_IP_V4
,
port
);
await
socket
.
close
();
return
true
;
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
576b4e11
...
...
@@ -485,7 +485,8 @@ class AppDomain extends Domain {
return
apps
.
map
((
DiscoveredApp
app
)
{
return
<
String
,
dynamic
>{
'id'
:
app
.
id
,
'observatoryDevicePort'
:
app
.
observatoryPort
'observatoryDevicePort'
:
app
.
observatoryPort
,
'diagnosticDevicePort'
:
app
.
diagnosticPort
,
};
}).
toList
();
}
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
576b4e11
...
...
@@ -65,10 +65,7 @@ class DriveCommand extends RunCommandBase {
'the application running after tests are done.'
);
argParser
.
addOption
(
'debug-port'
,
defaultsTo:
kDefaultDrivePort
.
toString
(),
help:
'Listen to the given port for a debug connection.'
);
usesPortOptions
();
}
@override
...
...
@@ -87,7 +84,8 @@ class DriveCommand extends RunCommandBase {
// ignore: cancel_subscriptions
StreamSubscription
<
String
>
_deviceLogSubscription
;
int
get
debugPort
=>
int
.
parse
(
argResults
[
'debug-port'
]);
int
get
observatoryPort
=>
int
.
parse
(
argResults
[
'observatory-port'
]);
int
get
diagnosticPort
=>
int
.
parse
(
argResults
[
'diagnostic-port'
]);
@override
Future
<
Null
>
verifyThenRunCommand
()
async
{
...
...
@@ -315,7 +313,8 @@ Future<int> startApp(DriveCommand command) async {
debuggingOptions:
new
DebuggingOptions
.
enabled
(
command
.
getBuildMode
(),
startPaused:
true
,
observatoryPort:
command
.
debugPort
observatoryPort:
command
.
observatoryPort
,
diagnosticPort:
command
.
diagnosticPort
,
),
platformArgs:
platformArgs
);
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
576b4e11
...
...
@@ -50,8 +50,7 @@ class RunCommand extends RunCommandBase {
defaultsTo:
false
,
negatable:
false
,
help:
'Start in a paused mode and wait for a debugger to connect.'
);
argParser
.
addOption
(
'debug-port'
,
help:
'Listen to the given port for a debug connection (defaults to
$kDefaultObservatoryPort
).'
);
usesPortOptions
();
argParser
.
addFlag
(
'build'
,
defaultsTo:
true
,
help:
'If necessary, build the app before running.'
);
...
...
@@ -190,12 +189,21 @@ class RunCommand extends RunCommandBase {
return
null
;
}
int
debug
Port
;
if
(
argResults
[
'
debug
-port'
]
!=
null
)
{
int
observatory
Port
;
if
(
argResults
[
'
observatory
-port'
]
!=
null
)
{
try
{
debugPort
=
int
.
parse
(
argResults
[
'debug
-port'
]);
observatoryPort
=
int
.
parse
(
argResults
[
'observatory
-port'
]);
}
catch
(
error
)
{
throwToolExit
(
'Invalid port for `--debug-port`:
$error
'
);
throwToolExit
(
'Invalid port for `--observatory-port`:
$error
'
);
}
}
int
diagnosticPort
;
if
(
argResults
[
'diagnostic-port'
]
!=
null
)
{
try
{
diagnosticPort
=
int
.
parse
(
argResults
[
'diagnostic-port'
]);
}
catch
(
error
)
{
throwToolExit
(
'Invalid port for `--diagnostic-port`:
$error
'
);
}
}
...
...
@@ -210,7 +218,8 @@ class RunCommand extends RunCommandBase {
options
=
new
DebuggingOptions
.
enabled
(
getBuildMode
(),
startPaused:
argResults
[
'start-paused'
],
observatoryPort:
debugPort
observatoryPort:
observatoryPort
,
diagnosticPort:
diagnosticPort
,
);
}
...
...
packages/flutter_tools/lib/src/device.dart
View file @
576b4e11
...
...
@@ -313,6 +313,8 @@ class DebuggingOptions {
/// Return the user specified diagnostic port. If that isn't available,
/// return [kDefaultDiagnosticPort], or a port close to that one.
Future
<
int
>
findBestDiagnosticPort
()
{
if
(
hasDiagnosticPort
)
return
new
Future
<
int
>.
value
(
diagnosticPort
);
return
findPreferredPort
(
diagnosticPort
??
kDefaultDiagnosticPort
);
}
}
...
...
@@ -378,7 +380,8 @@ abstract class DeviceLogReader {
/// Describes an app running on the device.
class
DiscoveredApp
{
DiscoveredApp
(
this
.
id
,
this
.
observatoryPort
);
DiscoveredApp
(
this
.
id
,
this
.
observatoryPort
,
this
.
diagnosticPort
);
final
String
id
;
final
int
observatoryPort
;
final
int
diagnosticPort
;
}
packages/flutter_tools/lib/src/hot.dart
View file @
576b4e11
...
...
@@ -183,7 +183,6 @@ class HotRunner extends ResidentRunner {
return
2
;
}
try
{
Uri
baseUri
=
await
_initDevFS
();
if
(
connectionInfoCompleter
!=
null
)
{
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
576b4e11
...
...
@@ -299,8 +299,8 @@ class IOSDevice extends Device {
if
(
installationResult
!=
0
)
{
printError
(
'Could not install
${bundle.path}
on
$id
.'
);
printError
(
"Try launching XCode and selecting 'Product > Run' to fix the problem:"
);
printError
(
" open ios/Runner.xcodeproj"
);
printError
(
'Try launching XCode and selecting "Product > Run" to fix the problem:'
);
printError
(
' open ios/Runner.xcodeproj'
);
printError
(
''
);
return
new
LaunchResult
.
failed
();
}
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
576b4e11
...
...
@@ -453,6 +453,8 @@ class IOSSimulator extends Device {
int
observatoryPort
=
await
debuggingOptions
.
findBestObservatoryPort
();
args
.
add
(
"--observatory-port=
$observatoryPort
"
);
int
diagnosticPort
=
await
debuggingOptions
.
findBestDiagnosticPort
();
args
.
add
(
"--diagnostic-port=
$diagnosticPort
"
);
}
ProtocolDiscovery
observatoryDiscovery
;
...
...
packages/flutter_tools/lib/src/protocol_discovery.dart
View file @
576b4e11
...
...
@@ -63,14 +63,13 @@ class ProtocolDiscovery {
hostPort
=
await
portForwarder
.
forward
(
devicePort
,
hostPort:
hostPort
)
.
timeout
(
const
Duration
(
seconds:
60
),
onTimeout:
()
{
throwToolExit
(
'Timeout while atempting to foward device port
$devicePort
'
);
throwToolExit
(
'Timeout while atempting to foward device port
$devicePort
for
$_serviceName
'
);
});
printTrace
(
'Forwarded host port
$hostPort
to device port
$devicePort
'
);
printTrace
(
'Forwarded host port
$hostPort
to device port
$devicePort
for
$_serviceName
'
);
hostUri
=
deviceUri
.
replace
(
port:
hostPort
);
}
else
{
hostUri
=
deviceUri
;
}
printStatus
(
'
$_serviceName
listening on
$hostUri
'
);
return
hostUri
;
}
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
576b4e11
...
...
@@ -143,9 +143,8 @@ abstract class ResidentRunner {
}
Future
<
Null
>
startEchoingDeviceLog
(
ApplicationPackage
app
)
async
{
if
(
_loggingSubscription
!=
null
)
{
if
(
_loggingSubscription
!=
null
)
return
;
}
_loggingSubscription
=
device
.
getLogReader
(
app:
app
).
logLines
.
listen
((
String
line
)
{
if
(!
line
.
contains
(
'Observatory listening on http'
)
&&
!
line
.
contains
(
'Diagnostic server listening on http'
))
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
576b4e11
...
...
@@ -63,6 +63,19 @@ abstract class FlutterCommand extends Command<Null> {
_usesPubOption
=
true
;
}
void
usesPortOptions
()
{
argParser
.
addOption
(
'observatory-port'
,
help:
'Listen to the given port for an observatory debugger connection.
\n
'
'Specifying port 0 will find a random free port.
\n
'
'Defaults to the first available port after
$kDefaultObservatoryPort
.'
);
argParser
.
addOption
(
'diagnostic-port'
,
help:
'Listen to the given port for a diagnostic connection.
\n
'
'Specifying port 0 will find a random free port.
\n
'
'Defaults to the first available port after
$kDefaultDiagnosticPort
.'
);
}
void
addBuildModeFlags
({
bool
defaultToRelease:
true
})
{
defaultBuildMode
=
defaultToRelease
?
BuildMode
.
release
:
BuildMode
.
debug
;
...
...
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