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
7065e433
Unverified
Commit
7065e433
authored
Sep 25, 2019
by
Jonah Williams
Committed by
GitHub
Sep 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow skipping chrome launch with --no-web-browser-launch (#40627)
parent
9bd02a17
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
65 additions
and
8 deletions
+65
-8
logger.dart
packages/flutter_tools/lib/src/base/logger.dart
+17
-0
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+1
-1
web_fs.dart
packages/flutter_tools/lib/src/build_runner/web_fs.dart
+8
-3
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+13
-0
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+1
-0
device.dart
packages/flutter_tools/lib/src/device.dart
+4
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+8
-0
web_device.dart
packages/flutter_tools/lib/src/web/web_device.dart
+8
-1
attach_test.dart
...lutter_tools/test/general.shard/commands/attach_test.dart
+3
-0
resident_web_runner_cold_test.dart
...ols/test/general.shard/resident_web_runner_cold_test.dart
+1
-1
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/base/logger.dart
View file @
7065e433
...
@@ -146,6 +146,14 @@ abstract class Logger {
...
@@ -146,6 +146,14 @@ abstract class Logger {
bool
multilineOutput
=
false
,
bool
multilineOutput
=
false
,
int
progressIndicatorPadding
=
kDefaultStatusPadding
,
int
progressIndicatorPadding
=
kDefaultStatusPadding
,
});
});
/// Send a progress notification that is instant.
///
/// Only surfaces a value in machine modes, Loggers may ignore this message in
/// non-machine modes. Like [startProgress] but with a single event.
void
sendNotification
(
String
message
,
{
String
progressId
,
});
}
}
class
StdoutLogger
extends
Logger
{
class
StdoutLogger
extends
Logger
{
...
@@ -250,6 +258,9 @@ class StdoutLogger extends Logger {
...
@@ -250,6 +258,9 @@ class StdoutLogger extends Logger {
void
_clearStatus
()
{
void
_clearStatus
()
{
_status
=
null
;
_status
=
null
;
}
}
@override
void
sendNotification
(
String
message
,
{
String
progressId
})
{
}
}
}
/// A [StdoutLogger] which replaces Unicode characters that cannot be printed to
/// A [StdoutLogger] which replaces Unicode characters that cannot be printed to
...
@@ -341,6 +352,9 @@ class BufferLogger extends Logger {
...
@@ -341,6 +352,9 @@ class BufferLogger extends Logger {
_status
.
clear
();
_status
.
clear
();
_trace
.
clear
();
_trace
.
clear
();
}
}
@override
void
sendNotification
(
String
message
,
{
String
progressId
})
{
}
}
}
class
VerboseLogger
extends
Logger
{
class
VerboseLogger
extends
Logger
{
...
@@ -453,6 +467,9 @@ class VerboseLogger extends Logger {
...
@@ -453,6 +467,9 @@ class VerboseLogger extends Logger {
parent
.
printStatus
(
prefix
+
indentMessage
);
parent
.
printStatus
(
prefix
+
indentMessage
);
}
}
}
}
@override
void
sendNotification
(
String
message
,
{
String
progressId
})
{
}
}
}
enum
_LogType
{
error
,
status
,
trace
}
enum
_LogType
{
error
,
status
,
trace
}
...
...
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
7065e433
...
@@ -177,7 +177,7 @@ class ResidentWebRunner extends ResidentRunner {
...
@@ -177,7 +177,7 @@ class ResidentWebRunner extends ResidentRunner {
'uri'
:
_webFs
.
uri
'uri'
:
_webFs
.
uri
});
});
if
(
supportsServiceProtocol
)
{
if
(
supportsServiceProtocol
)
{
_debugConnection
=
await
_webFs
.
runAndDebug
();
_debugConnection
=
await
_webFs
.
runAndDebug
(
debuggingOptions
);
unawaited
(
_debugConnection
.
onDone
.
whenComplete
(
exit
));
unawaited
(
_debugConnection
.
onDone
.
whenComplete
(
exit
));
}
}
}
catch
(
err
,
stackTrace
)
{
}
catch
(
err
,
stackTrace
)
{
...
...
packages/flutter_tools/lib/src/build_runner/web_fs.dart
View file @
7065e433
...
@@ -30,6 +30,7 @@ import '../build_info.dart';
...
@@ -30,6 +30,7 @@ import '../build_info.dart';
import
'../bundle.dart'
;
import
'../bundle.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
import
'../dart/package_map.dart'
;
import
'../dart/package_map.dart'
;
import
'../device.dart'
;
import
'../globals.dart'
;
import
'../globals.dart'
;
import
'../platform_plugins.dart'
;
import
'../platform_plugins.dart'
;
import
'../plugins.dart'
;
import
'../plugins.dart'
;
...
@@ -107,15 +108,19 @@ class WebFs {
...
@@ -107,15 +108,19 @@ class WebFs {
await
_connectedApps
?.
cancel
();
await
_connectedApps
?.
cancel
();
}
}
Future
<
DebugConnection
>
_cachedExtensionFuture
;
/// Retrieve the [DebugConnection] for the current application
/// Retrieve the [DebugConnection] for the current application
Future
<
DebugConnection
>
runAndDebug
()
{
Future
<
DebugConnection
>
runAndDebug
(
DebuggingOptions
debuggingOptions
)
{
final
Completer
<
DebugConnection
>
firstConnection
=
Completer
<
DebugConnection
>();
final
Completer
<
DebugConnection
>
firstConnection
=
Completer
<
DebugConnection
>();
_connectedApps
=
_dwds
.
connectedApps
.
listen
((
AppConnection
appConnection
)
async
{
_connectedApps
=
_dwds
.
connectedApps
.
listen
((
AppConnection
appConnection
)
async
{
appConnection
.
runMain
();
final
DebugConnection
debugConnection
=
debuggingOptions
.
browserLaunch
final
DebugConnection
debugConnection
=
await
_dwds
.
debugConnection
(
appConnection
);
?
await
_dwds
.
debugConnection
(
appConnection
)
:
await
(
_cachedExtensionFuture
??=
_dwds
.
extensionDebugConnections
.
stream
.
first
);
if
(!
firstConnection
.
isCompleted
)
{
if
(!
firstConnection
.
isCompleted
)
{
firstConnection
.
complete
(
debugConnection
);
firstConnection
.
complete
(
debugConnection
);
}
}
appConnection
.
runMain
();
});
});
return
firstConnection
.
future
;
return
firstConnection
.
future
;
}
}
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
7065e433
...
@@ -895,6 +895,9 @@ class NotifyingLogger extends Logger {
...
@@ -895,6 +895,9 @@ class NotifyingLogger extends Logger {
void
dispose
()
{
void
dispose
()
{
_messageController
.
close
();
_messageController
.
close
();
}
}
@override
void
sendNotification
(
String
message
,
{
String
progressId
})
{
}
}
}
/// A running application, started by this daemon.
/// A running application, started by this daemon.
...
@@ -1105,6 +1108,16 @@ class _AppRunLogger extends Logger {
...
@@ -1105,6 +1108,16 @@ class _AppRunLogger extends Logger {
domain
.
_sendAppEvent
(
app
,
'progress'
,
event
);
domain
.
_sendAppEvent
(
app
,
'progress'
,
event
);
}
}
}
}
@override
void
sendNotification
(
String
message
,
{
String
progressId
})
{
final
int
id
=
_nextProgressId
++;
_sendProgressEvent
(<
String
,
dynamic
>{
'id'
:
id
.
toString
(),
'progressId'
:
progressId
,
'finished'
:
true
,
});
}
}
}
class
LogMessage
{
class
LogMessage
{
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
7065e433
...
@@ -306,6 +306,7 @@ class RunCommand extends RunCommandBase {
...
@@ -306,6 +306,7 @@ class RunCommand extends RunCommandBase {
initializePlatform:
argResults
[
'web-initialize-platform'
],
initializePlatform:
argResults
[
'web-initialize-platform'
],
hostname:
featureFlags
.
isWebEnabled
?
argResults
[
'web-hostname'
]
:
''
,
hostname:
featureFlags
.
isWebEnabled
?
argResults
[
'web-hostname'
]
:
''
,
port:
featureFlags
.
isWebEnabled
?
argResults
[
'web-port'
]
:
''
,
port:
featureFlags
.
isWebEnabled
?
argResults
[
'web-port'
]
:
''
,
browserLaunch:
featureFlags
.
isWebEnabled
?
argResults
[
'web-browser-launch'
]
:
null
,
);
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/device.dart
View file @
7065e433
...
@@ -492,6 +492,7 @@ class DebuggingOptions {
...
@@ -492,6 +492,7 @@ class DebuggingOptions {
this
.
initializePlatform
=
true
,
this
.
initializePlatform
=
true
,
this
.
hostname
,
this
.
hostname
,
this
.
port
,
this
.
port
,
this
.
browserLaunch
=
true
,
})
:
debuggingEnabled
=
true
;
})
:
debuggingEnabled
=
true
;
DebuggingOptions
.
disabled
(
this
.
buildInfo
,
{
this
.
initializePlatform
=
true
,
this
.
port
,
this
.
hostname
})
DebuggingOptions
.
disabled
(
this
.
buildInfo
,
{
this
.
initializePlatform
=
true
,
this
.
port
,
this
.
hostname
})
...
@@ -506,7 +507,8 @@ class DebuggingOptions {
...
@@ -506,7 +507,8 @@ class DebuggingOptions {
traceSystrace
=
false
,
traceSystrace
=
false
,
dumpSkpOnShaderCompilation
=
false
,
dumpSkpOnShaderCompilation
=
false
,
verboseSystemLogs
=
false
,
verboseSystemLogs
=
false
,
observatoryPort
=
null
;
observatoryPort
=
null
,
browserLaunch
=
true
;
final
bool
debuggingEnabled
;
final
bool
debuggingEnabled
;
...
@@ -526,6 +528,7 @@ class DebuggingOptions {
...
@@ -526,6 +528,7 @@ class DebuggingOptions {
final
int
observatoryPort
;
final
int
observatoryPort
;
final
String
port
;
final
String
port
;
final
String
hostname
;
final
String
hostname
;
final
bool
browserLaunch
;
bool
get
hasObservatoryPort
=>
observatoryPort
!=
null
;
bool
get
hasObservatoryPort
=>
observatoryPort
!=
null
;
}
}
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
7065e433
...
@@ -146,6 +146,14 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -146,6 +146,14 @@ abstract class FlutterCommand extends Command<void> {
'will select a random open port on the host.'
,
'will select a random open port on the host.'
,
hide:
hide
,
hide:
hide
,
);
);
argParser
.
addFlag
(
'web-browser-launch'
,
defaultsTo:
true
,
negatable:
true
,
help:
'Whether to automatically launch browsers for web devices '
'that do so. Setting this to true allows using the Dart debug extension '
'on Chrome and other browsers which support extensions.'
,
hide:
hide
,
);
}
}
void
usesTargetOption
()
{
void
usesTargetOption
()
{
...
...
packages/flutter_tools/lib/src/web/web_device.dart
View file @
7065e433
...
@@ -131,7 +131,13 @@ class ChromeDevice extends Device {
...
@@ -131,7 +131,13 @@ class ChromeDevice extends Device {
})
async
{
})
async
{
// See [ResidentWebRunner.run] in flutter_tools/lib/src/resident_web_runner.dart
// See [ResidentWebRunner.run] in flutter_tools/lib/src/resident_web_runner.dart
// for the web initialization and server logic.
// for the web initialization and server logic.
_chrome
=
await
chromeLauncher
.
launch
(
platformArgs
[
'uri'
]);
final
String
url
=
platformArgs
[
'uri'
];
if
(
debuggingOptions
.
browserLaunch
)
{
_chrome
=
await
chromeLauncher
.
launch
(
url
);
}
else
{
printStatus
(
'Waiting for connection from Dart debug extension at
$url
'
,
emphasis:
true
);
logger
.
sendNotification
(
url
,
progressId:
'debugExtension'
);
}
return
LaunchResult
.
succeeded
(
observatoryUri:
null
);
return
LaunchResult
.
succeeded
(
observatoryUri:
null
);
}
}
...
@@ -240,6 +246,7 @@ class WebServerDevice extends Device {
...
@@ -240,6 +246,7 @@ class WebServerDevice extends Device {
})
async
{
})
async
{
final
String
url
=
platformArgs
[
'uri'
];
final
String
url
=
platformArgs
[
'uri'
];
printStatus
(
'
$mainPath
is being served at
$url
'
,
emphasis:
true
);
printStatus
(
'
$mainPath
is being served at
$url
'
,
emphasis:
true
);
logger
.
sendNotification
(
url
,
progressId:
'debugExtension'
);
return
LaunchResult
.
succeeded
(
observatoryUri:
null
);
return
LaunchResult
.
succeeded
(
observatoryUri:
null
);
}
}
...
...
packages/flutter_tools/test/general.shard/commands/attach_test.dart
View file @
7065e433
...
@@ -539,6 +539,9 @@ class StreamLogger extends Logger {
...
@@ -539,6 +539,9 @@ class StreamLogger extends Logger {
}
}
Stream
<
String
>
get
stream
=>
_controller
.
stream
;
Stream
<
String
>
get
stream
=>
_controller
.
stream
;
@override
void
sendNotification
(
String
message
,
{
String
progressId
})
{
}
}
}
class
LoggerInterrupted
implements
Exception
{
class
LoggerInterrupted
implements
Exception
{
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_cold_test.dart
View file @
7065e433
...
@@ -56,7 +56,7 @@ void main() {
...
@@ -56,7 +56,7 @@ void main() {
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
'web'
,
'index.html'
)).
createSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
'web'
,
'index.html'
)).
createSync
(
recursive:
true
);
when
(
mockWebFs
.
runAndDebug
()).
thenThrow
(
StateError
(
'debugging not supported'
));
when
(
mockWebFs
.
runAndDebug
(
any
)).
thenThrow
(
StateError
(
'debugging not supported'
));
}
}
test
(
'Can successfully run and connect without vmservice'
,
()
=>
testbed
.
run
(()
async
{
test
(
'Can successfully run and connect without vmservice'
,
()
=>
testbed
.
run
(()
async
{
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
7065e433
...
@@ -65,7 +65,7 @@ void main() {
...
@@ -65,7 +65,7 @@ void main() {
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
'web'
,
'index.html'
)).
createSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
'web'
,
'index.html'
)).
createSync
(
recursive:
true
);
when
(
mockWebFs
.
runAndDebug
()).
thenAnswer
((
Invocation
_
)
async
{
when
(
mockWebFs
.
runAndDebug
(
any
)).
thenAnswer
((
Invocation
_
)
async
{
return
mockDebugConnection
;
return
mockDebugConnection
;
});
});
when
(
mockWebFs
.
recompile
()).
thenAnswer
((
Invocation
_
)
{
when
(
mockWebFs
.
recompile
()).
thenAnswer
((
Invocation
_
)
{
...
...
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