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
5d201a35
Unverified
Commit
5d201a35
authored
Dec 01, 2020
by
Jonah Williams
Committed by
GitHub
Dec 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] allow hiding web server device, provide flags to re-enable (#71434)
parent
0a08f8af
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+10
-0
web_device.dart
packages/flutter_tools/lib/src/web/web_device.dart
+5
-1
devices_test.dart
...es/flutter_tools/test/general.shard/web/devices_test.dart
+19
-1
No files found.
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
5d201a35
...
@@ -18,6 +18,7 @@ import '../cache.dart';
...
@@ -18,6 +18,7 @@ import '../cache.dart';
import
'../convert.dart'
;
import
'../convert.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals.dart'
as
globals
;
import
'../tester/flutter_tester.dart'
;
import
'../tester/flutter_tester.dart'
;
import
'../web/web_device.dart'
;
const
String
kFlutterRootEnvironmentVariableName
=
'FLUTTER_ROOT'
;
// should point to //flutter/ (root of flutter/flutter repo)
const
String
kFlutterRootEnvironmentVariableName
=
'FLUTTER_ROOT'
;
// should point to //flutter/ (root of flutter/flutter repo)
const
String
kFlutterEngineEnvironmentVariableName
=
'FLUTTER_ENGINE'
;
// should point to //engine/src/ (root of flutter/engine repo)
const
String
kFlutterEngineEnvironmentVariableName
=
'FLUTTER_ENGINE'
;
// should point to //engine/src/ (root of flutter/engine repo)
...
@@ -109,6 +110,11 @@ class FlutterCommandRunner extends CommandRunner<void> {
...
@@ -109,6 +110,11 @@ class FlutterCommandRunner extends CommandRunner<void> {
hide:
!
verboseHelp
,
hide:
!
verboseHelp
,
help:
"List the special 'flutter-tester' device in device listings. "
help:
"List the special 'flutter-tester' device in device listings. "
'This headless device is used to
\n
test Flutter tooling.'
);
'This headless device is used to
\n
test Flutter tooling.'
);
argParser
.
addFlag
(
'show-web-server-device'
,
negatable:
false
,
hide:
!
verboseHelp
,
help:
"List the special 'web-server' device in device listings. "
);
}
}
@override
@override
...
@@ -204,6 +210,10 @@ class FlutterCommandRunner extends CommandRunner<void> {
...
@@ -204,6 +210,10 @@ class FlutterCommandRunner extends CommandRunner<void> {
topLevelResults
[
'device-id'
]
==
FlutterTesterDevices
.
kTesterDeviceId
)
{
topLevelResults
[
'device-id'
]
==
FlutterTesterDevices
.
kTesterDeviceId
)
{
FlutterTesterDevices
.
showFlutterTesterDevice
=
true
;
FlutterTesterDevices
.
showFlutterTesterDevice
=
true
;
}
}
if
(
topLevelResults
[
'show-web-server-device'
]
as
bool
||
topLevelResults
[
'device-id'
]
==
WebServerDevice
.
kWebServerDeviceId
)
{
WebServerDevice
.
showWebServerDevice
=
true
;
}
// Set up the tooling configuration.
// Set up the tooling configuration.
final
EngineBuildPaths
engineBuildPaths
=
await
globals
.
localEngineLocator
.
findEnginePath
(
final
EngineBuildPaths
engineBuildPaths
=
await
globals
.
localEngineLocator
.
findEnginePath
(
...
...
packages/flutter_tools/lib/src/web/web_device.dart
View file @
5d201a35
...
@@ -345,7 +345,8 @@ class WebDevices extends PollingDeviceDiscovery {
...
@@ -345,7 +345,8 @@ class WebDevices extends PollingDeviceDiscovery {
return
<
Device
>[];
return
<
Device
>[];
}
}
return
<
Device
>[
return
<
Device
>[
_webServerDevice
,
if
(
WebServerDevice
.
showWebServerDevice
)
_webServerDevice
,
if
(
_chromeDevice
.
isSupported
())
if
(
_chromeDevice
.
isSupported
())
_chromeDevice
,
_chromeDevice
,
if
(
await
_edgeDevice
?.
_meetsVersionConstraint
()
??
false
)
if
(
await
_edgeDevice
?.
_meetsVersionConstraint
()
??
false
)
...
@@ -375,6 +376,9 @@ class WebServerDevice extends Device {
...
@@ -375,6 +376,9 @@ class WebServerDevice extends Device {
ephemeral:
false
,
ephemeral:
false
,
);
);
static
const
String
kWebServerDeviceId
=
'web-server'
;
static
bool
showWebServerDevice
=
true
;
final
Logger
_logger
;
final
Logger
_logger
;
@override
@override
...
...
packages/flutter_tools/test/general.shard/web/devices_test.dart
View file @
5d201a35
...
@@ -159,7 +159,8 @@ void main() {
...
@@ -159,7 +159,8 @@ void main() {
isNot
(
contains
(
isA
<
MicrosoftEdgeDevice
>())));
isNot
(
contains
(
isA
<
MicrosoftEdgeDevice
>())));
});
});
testWithoutContext
(
'Web Server device is listed by default'
,
()
async
{
testWithoutContext
(
'Web Server device is listed if enabled via showWebServerDevice'
,
()
async
{
WebServerDevice
.
showWebServerDevice
=
true
;
final
WebDevices
webDevices
=
WebDevices
(
final
WebDevices
webDevices
=
WebDevices
(
featureFlags:
TestFeatureFlags
(
isWebEnabled:
true
),
featureFlags:
TestFeatureFlags
(
isWebEnabled:
true
),
fileSystem:
MemoryFileSystem
.
test
(),
fileSystem:
MemoryFileSystem
.
test
(),
...
@@ -175,6 +176,23 @@ void main() {
...
@@ -175,6 +176,23 @@ void main() {
contains
(
isA
<
WebServerDevice
>()));
contains
(
isA
<
WebServerDevice
>()));
});
});
testWithoutContext
(
'Web Server device is not listed if disabled via showWebServerDevice'
,
()
async
{
WebServerDevice
.
showWebServerDevice
=
false
;
final
WebDevices
webDevices
=
WebDevices
(
featureFlags:
TestFeatureFlags
(
isWebEnabled:
true
),
fileSystem:
MemoryFileSystem
.
test
(),
logger:
BufferLogger
.
test
(),
platform:
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{}
),
processManager:
FakeProcessManager
.
any
(),
);
expect
(
await
webDevices
.
pollingGetDevices
(),
isNot
(
contains
(
isA
<
WebServerDevice
>())));
});
testWithoutContext
(
'Chrome invokes version command on non-Windows platforms'
,
()
async
{
testWithoutContext
(
'Chrome invokes version command on non-Windows platforms'
,
()
async
{
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
const
FakeCommand
(
...
...
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