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
907bed69
Unverified
Commit
907bed69
authored
Jan 12, 2021
by
Jonah Williams
Committed by
GitHub
Jan 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] daemon does not report platforms that are not enabled (#73736)
parent
737496e8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
10 deletions
+35
-10
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+8
-9
daemon_test.dart
...utter_tools/test/commands.shard/hermetic/daemon_test.dart
+27
-1
No files found.
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
907bed69
...
...
@@ -19,6 +19,7 @@ import '../build_info.dart';
import
'../convert.dart'
;
import
'../device.dart'
;
import
'../emulator.dart'
;
import
'../features.dart'
;
import
'../globals.dart'
as
globals
;
import
'../project.dart'
;
import
'../resident_runner.dart'
;
...
...
@@ -365,28 +366,26 @@ class DaemonDomain extends Domain {
final
String
projectRoot
=
_getStringArg
(
args
,
'projectRoot'
,
required:
true
);
final
List
<
String
>
result
=
<
String
>[];
try
{
// TODO(jonahwilliams): replace this with a project metadata check once
// that has been implemented.
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
globals
.
fs
.
directory
(
projectRoot
));
if
(
flutterProject
.
linux
.
existsSync
())
{
if
(
f
eatureFlags
.
isLinuxEnabled
&&
f
lutterProject
.
linux
.
existsSync
())
{
result
.
add
(
'linux'
);
}
if
(
flutterProject
.
macos
.
existsSync
())
{
if
(
f
eatureFlags
.
isMacOSEnabled
&&
f
lutterProject
.
macos
.
existsSync
())
{
result
.
add
(
'macos'
);
}
if
(
flutterProject
.
windows
.
existsSync
())
{
if
(
f
eatureFlags
.
isWindowsEnabled
&&
f
lutterProject
.
windows
.
existsSync
())
{
result
.
add
(
'windows'
);
}
if
(
flutterProject
.
ios
.
existsSync
())
{
if
(
f
eatureFlags
.
isIOSEnabled
&&
f
lutterProject
.
ios
.
existsSync
())
{
result
.
add
(
'ios'
);
}
if
(
flutterProject
.
android
.
existsSync
())
{
if
(
f
eatureFlags
.
isAndroidEnabled
&&
f
lutterProject
.
android
.
existsSync
())
{
result
.
add
(
'android'
);
}
if
(
flutterProject
.
web
.
existsSync
())
{
if
(
f
eatureFlags
.
isWebEnabled
&&
f
lutterProject
.
web
.
existsSync
())
{
result
.
add
(
'web'
);
}
if
(
flutterProject
.
fuchsia
.
existsSync
())
{
if
(
f
eatureFlags
.
isFuchsiaEnabled
&&
f
lutterProject
.
fuchsia
.
existsSync
())
{
result
.
add
(
'fuchsia'
);
}
return
<
String
,
Object
>{
...
...
packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart
View file @
907bed69
...
...
@@ -9,6 +9,7 @@ import 'package:flutter_tools/src/base/common.dart';
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/utils.dart'
;
import
'package:flutter_tools/src/commands/daemon.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/ios/ios_workflow.dart'
;
...
...
@@ -19,6 +20,7 @@ import 'package:fake_async/fake_async.dart';
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/mocks.dart'
;
import
'../../src/testbed.dart'
;
void
main
(
)
{
Daemon
daemon
;
...
...
@@ -57,6 +59,30 @@ void main() {
await
commands
.
close
();
});
testUsingContext
(
'daemon.getSupportedPlatforms command should succeed'
,
()
async
{
final
StreamController
<
Map
<
String
,
dynamic
>>
commands
=
StreamController
<
Map
<
String
,
dynamic
>>();
final
StreamController
<
Map
<
String
,
dynamic
>>
responses
=
StreamController
<
Map
<
String
,
dynamic
>>();
daemon
=
Daemon
(
commands
.
stream
,
responses
.
add
,
notifyingLogger:
notifyingLogger
,
);
// Use the flutter_gallery project which has a known set of supported platforms.
final
String
projectPath
=
globals
.
fs
.
path
.
join
(
getFlutterRoot
(),
'dev'
,
'integration_tests'
,
'flutter_gallery'
);
commands
.
add
(<
String
,
dynamic
>{
'id'
:
0
,
'method'
:
'daemon.getSupportedPlatforms'
,
'params'
:
<
String
,
Object
>{
'projectRoot'
:
projectPath
}});
final
Map
<
String
,
dynamic
>
response
=
await
responses
.
stream
.
firstWhere
(
_notEvent
);
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'result'
],
isNotEmpty
);
expect
(
response
[
'result'
][
'platforms'
],
<
String
>{
'macos'
});
await
responses
.
close
();
await
commands
.
close
();
},
overrides:
<
Type
,
Generator
>{
// Disable Android/iOS and enable macOS to make sure result is consistent and defaults are tested off.
FeatureFlags:
()
=>
TestFeatureFlags
(
isAndroidEnabled:
false
,
isIOSEnabled:
false
,
isMacOSEnabled:
true
),
});
testUsingContext
(
'printError should send daemon.logMessage event'
,
()
async
{
final
StreamController
<
Map
<
String
,
dynamic
>>
commands
=
StreamController
<
Map
<
String
,
dynamic
>>();
final
StreamController
<
Map
<
String
,
dynamic
>>
responses
=
StreamController
<
Map
<
String
,
dynamic
>>();
...
...
@@ -443,7 +469,7 @@ void main() {
});
testWithoutContext
(
'does not run any operations concurrently'
,
()
async
{
// Crete a function thats slow, but throws if another instance of the
// Crete a function that
'
s slow, but throws if another instance of the
// function is running.
bool
isRunning
=
false
;
Future
<
int
>
f
(
int
ret
)
async
{
...
...
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