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
Show 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 {
...
@@ -445,7 +445,7 @@ class AndroidDevice extends Device {
Match
match
=
discoverExp
.
firstMatch
(
line
);
Match
match
=
discoverExp
.
firstMatch
(
line
);
if
(
match
!=
null
)
{
if
(
match
!=
null
)
{
Map
<
String
,
dynamic
>
app
=
JSON
.
decode
(
match
.
group
(
1
));
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 {
...
@@ -163,6 +163,7 @@ Future<int> findPreferredPort(int defaultPort, { int searchStep: 2 }) async {
Future
<
bool
>
_isPortAvailable
(
int
port
)
async
{
Future
<
bool
>
_isPortAvailable
(
int
port
)
async
{
try
{
try
{
// TODO(ianh): This is super racy.
ServerSocket
socket
=
await
ServerSocket
.
bind
(
InternetAddress
.
LOOPBACK_IP_V4
,
port
);
ServerSocket
socket
=
await
ServerSocket
.
bind
(
InternetAddress
.
LOOPBACK_IP_V4
,
port
);
await
socket
.
close
();
await
socket
.
close
();
return
true
;
return
true
;
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
576b4e11
...
@@ -485,7 +485,8 @@ class AppDomain extends Domain {
...
@@ -485,7 +485,8 @@ class AppDomain extends Domain {
return
apps
.
map
((
DiscoveredApp
app
)
{
return
apps
.
map
((
DiscoveredApp
app
)
{
return
<
String
,
dynamic
>{
return
<
String
,
dynamic
>{
'id'
:
app
.
id
,
'id'
:
app
.
id
,
'observatoryDevicePort'
:
app
.
observatoryPort
'observatoryDevicePort'
:
app
.
observatoryPort
,
'diagnosticDevicePort'
:
app
.
diagnosticPort
,
};
};
}).
toList
();
}).
toList
();
}
}
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
576b4e11
...
@@ -65,10 +65,7 @@ class DriveCommand extends RunCommandBase {
...
@@ -65,10 +65,7 @@ class DriveCommand extends RunCommandBase {
'the application running after tests are done.'
'the application running after tests are done.'
);
);
argParser
.
addOption
(
'debug-port'
,
usesPortOptions
();
defaultsTo:
kDefaultDrivePort
.
toString
(),
help:
'Listen to the given port for a debug connection.'
);
}
}
@override
@override
...
@@ -87,7 +84,8 @@ class DriveCommand extends RunCommandBase {
...
@@ -87,7 +84,8 @@ class DriveCommand extends RunCommandBase {
// ignore: cancel_subscriptions
// ignore: cancel_subscriptions
StreamSubscription
<
String
>
_deviceLogSubscription
;
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
@override
Future
<
Null
>
verifyThenRunCommand
()
async
{
Future
<
Null
>
verifyThenRunCommand
()
async
{
...
@@ -315,7 +313,8 @@ Future<int> startApp(DriveCommand command) async {
...
@@ -315,7 +313,8 @@ Future<int> startApp(DriveCommand command) async {
debuggingOptions:
new
DebuggingOptions
.
enabled
(
debuggingOptions:
new
DebuggingOptions
.
enabled
(
command
.
getBuildMode
(),
command
.
getBuildMode
(),
startPaused:
true
,
startPaused:
true
,
observatoryPort:
command
.
debugPort
observatoryPort:
command
.
observatoryPort
,
diagnosticPort:
command
.
diagnosticPort
,
),
),
platformArgs:
platformArgs
platformArgs:
platformArgs
);
);
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
576b4e11
...
@@ -50,8 +50,7 @@ class RunCommand extends RunCommandBase {
...
@@ -50,8 +50,7 @@ class RunCommand extends RunCommandBase {
defaultsTo:
false
,
defaultsTo:
false
,
negatable:
false
,
negatable:
false
,
help:
'Start in a paused mode and wait for a debugger to connect.'
);
help:
'Start in a paused mode and wait for a debugger to connect.'
);
argParser
.
addOption
(
'debug-port'
,
usesPortOptions
();
help:
'Listen to the given port for a debug connection (defaults to
$kDefaultObservatoryPort
).'
);
argParser
.
addFlag
(
'build'
,
argParser
.
addFlag
(
'build'
,
defaultsTo:
true
,
defaultsTo:
true
,
help:
'If necessary, build the app before running.'
);
help:
'If necessary, build the app before running.'
);
...
@@ -190,12 +189,21 @@ class RunCommand extends RunCommandBase {
...
@@ -190,12 +189,21 @@ class RunCommand extends RunCommandBase {
return
null
;
return
null
;
}
}
int
debug
Port
;
int
observatory
Port
;
if
(
argResults
[
'
debug
-port'
]
!=
null
)
{
if
(
argResults
[
'
observatory
-port'
]
!=
null
)
{
try
{
try
{
debugPort
=
int
.
parse
(
argResults
[
'debug
-port'
]);
observatoryPort
=
int
.
parse
(
argResults
[
'observatory
-port'
]);
}
catch
(
error
)
{
}
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 {
...
@@ -210,7 +218,8 @@ class RunCommand extends RunCommandBase {
options
=
new
DebuggingOptions
.
enabled
(
options
=
new
DebuggingOptions
.
enabled
(
getBuildMode
(),
getBuildMode
(),
startPaused:
argResults
[
'start-paused'
],
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 {
...
@@ -313,6 +313,8 @@ class DebuggingOptions {
/// Return the user specified diagnostic port. If that isn't available,
/// Return the user specified diagnostic port. If that isn't available,
/// return [kDefaultDiagnosticPort], or a port close to that one.
/// return [kDefaultDiagnosticPort], or a port close to that one.
Future
<
int
>
findBestDiagnosticPort
()
{
Future
<
int
>
findBestDiagnosticPort
()
{
if
(
hasDiagnosticPort
)
return
new
Future
<
int
>.
value
(
diagnosticPort
);
return
findPreferredPort
(
diagnosticPort
??
kDefaultDiagnosticPort
);
return
findPreferredPort
(
diagnosticPort
??
kDefaultDiagnosticPort
);
}
}
}
}
...
@@ -378,7 +380,8 @@ abstract class DeviceLogReader {
...
@@ -378,7 +380,8 @@ abstract class DeviceLogReader {
/// Describes an app running on the device.
/// Describes an app running on the device.
class
DiscoveredApp
{
class
DiscoveredApp
{
DiscoveredApp
(
this
.
id
,
this
.
observatoryPort
);
DiscoveredApp
(
this
.
id
,
this
.
observatoryPort
,
this
.
diagnosticPort
);
final
String
id
;
final
String
id
;
final
int
observatoryPort
;
final
int
observatoryPort
;
final
int
diagnosticPort
;
}
}
packages/flutter_tools/lib/src/hot.dart
View file @
576b4e11
...
@@ -183,7 +183,6 @@ class HotRunner extends ResidentRunner {
...
@@ -183,7 +183,6 @@ class HotRunner extends ResidentRunner {
return
2
;
return
2
;
}
}
try
{
try
{
Uri
baseUri
=
await
_initDevFS
();
Uri
baseUri
=
await
_initDevFS
();
if
(
connectionInfoCompleter
!=
null
)
{
if
(
connectionInfoCompleter
!=
null
)
{
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
576b4e11
...
@@ -299,8 +299,8 @@ class IOSDevice extends Device {
...
@@ -299,8 +299,8 @@ class IOSDevice extends Device {
if
(
installationResult
!=
0
)
{
if
(
installationResult
!=
0
)
{
printError
(
'Could not install
${bundle.path}
on
$id
.'
);
printError
(
'Could not install
${bundle.path}
on
$id
.'
);
printError
(
"Try launching XCode and selecting 'Product > Run' to fix the problem:"
);
printError
(
'Try launching XCode and selecting "Product > Run" to fix the problem:'
);
printError
(
" open ios/Runner.xcodeproj"
);
printError
(
' open ios/Runner.xcodeproj'
);
printError
(
''
);
printError
(
''
);
return
new
LaunchResult
.
failed
();
return
new
LaunchResult
.
failed
();
}
}
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
576b4e11
...
@@ -453,6 +453,8 @@ class IOSSimulator extends Device {
...
@@ -453,6 +453,8 @@ class IOSSimulator extends Device {
int
observatoryPort
=
await
debuggingOptions
.
findBestObservatoryPort
();
int
observatoryPort
=
await
debuggingOptions
.
findBestObservatoryPort
();
args
.
add
(
"--observatory-port=
$observatoryPort
"
);
args
.
add
(
"--observatory-port=
$observatoryPort
"
);
int
diagnosticPort
=
await
debuggingOptions
.
findBestDiagnosticPort
();
args
.
add
(
"--diagnostic-port=
$diagnosticPort
"
);
}
}
ProtocolDiscovery
observatoryDiscovery
;
ProtocolDiscovery
observatoryDiscovery
;
...
...
packages/flutter_tools/lib/src/protocol_discovery.dart
View file @
576b4e11
...
@@ -63,14 +63,13 @@ class ProtocolDiscovery {
...
@@ -63,14 +63,13 @@ class ProtocolDiscovery {
hostPort
=
await
portForwarder
hostPort
=
await
portForwarder
.
forward
(
devicePort
,
hostPort:
hostPort
)
.
forward
(
devicePort
,
hostPort:
hostPort
)
.
timeout
(
const
Duration
(
seconds:
60
),
onTimeout:
()
{
.
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
);
hostUri
=
deviceUri
.
replace
(
port:
hostPort
);
}
else
{
}
else
{
hostUri
=
deviceUri
;
hostUri
=
deviceUri
;
}
}
printStatus
(
'
$_serviceName
listening on
$hostUri
'
);
return
hostUri
;
return
hostUri
;
}
}
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
576b4e11
...
@@ -143,9 +143,8 @@ abstract class ResidentRunner {
...
@@ -143,9 +143,8 @@ abstract class ResidentRunner {
}
}
Future
<
Null
>
startEchoingDeviceLog
(
ApplicationPackage
app
)
async
{
Future
<
Null
>
startEchoingDeviceLog
(
ApplicationPackage
app
)
async
{
if
(
_loggingSubscription
!=
null
)
{
if
(
_loggingSubscription
!=
null
)
return
;
return
;
}
_loggingSubscription
=
device
.
getLogReader
(
app:
app
).
logLines
.
listen
((
String
line
)
{
_loggingSubscription
=
device
.
getLogReader
(
app:
app
).
logLines
.
listen
((
String
line
)
{
if
(!
line
.
contains
(
'Observatory listening on http'
)
&&
if
(!
line
.
contains
(
'Observatory listening on http'
)
&&
!
line
.
contains
(
'Diagnostic server 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> {
...
@@ -63,6 +63,19 @@ abstract class FlutterCommand extends Command<Null> {
_usesPubOption
=
true
;
_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
})
{
void
addBuildModeFlags
({
bool
defaultToRelease:
true
})
{
defaultBuildMode
=
defaultToRelease
?
BuildMode
.
release
:
BuildMode
.
debug
;
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