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
42ae15f4
Unverified
Commit
42ae15f4
authored
Feb 28, 2020
by
Jonah Williams
Committed by
GitHub
Feb 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove LinuxWorkflow from injection and clean up tests (#51597)
parent
bae79599
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
53 deletions
+84
-53
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+0
-2
device.dart
packages/flutter_tools/lib/src/device.dart
+5
-1
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+9
-0
linux_device.dart
packages/flutter_tools/lib/src/linux/linux_device.dart
+18
-4
linux_workflow.dart
packages/flutter_tools/lib/src/linux/linux_workflow.dart
+14
-9
linux_device_test.dart
...ter_tools/test/general.shard/linux/linux_device_test.dart
+5
-3
linux_workflow_test.dart
...r_tools/test/general.shard/linux/linux_workflow_test.dart
+33
-34
No files found.
packages/flutter_tools/lib/src/context_runner.dart
View file @
42ae15f4
...
@@ -40,7 +40,6 @@ import 'ios/ios_workflow.dart';
...
@@ -40,7 +40,6 @@ import 'ios/ios_workflow.dart';
import
'ios/mac.dart'
;
import
'ios/mac.dart'
;
import
'ios/simulators.dart'
;
import
'ios/simulators.dart'
;
import
'ios/xcodeproj.dart'
;
import
'ios/xcodeproj.dart'
;
import
'linux/linux_workflow.dart'
;
import
'macos/cocoapods.dart'
;
import
'macos/cocoapods.dart'
;
import
'macos/cocoapods_validator.dart'
;
import
'macos/cocoapods_validator.dart'
;
import
'macos/macos_workflow.dart'
;
import
'macos/macos_workflow.dart'
;
...
@@ -141,7 +140,6 @@ Future<T> runInContext<T>(
...
@@ -141,7 +140,6 @@ Future<T> runInContext<T>(
IOSSimulatorUtils:
()
=>
IOSSimulatorUtils
(),
IOSSimulatorUtils:
()
=>
IOSSimulatorUtils
(),
IOSWorkflow:
()
=>
const
IOSWorkflow
(),
IOSWorkflow:
()
=>
const
IOSWorkflow
(),
KernelCompilerFactory:
()
=>
const
KernelCompilerFactory
(),
KernelCompilerFactory:
()
=>
const
KernelCompilerFactory
(),
LinuxWorkflow:
()
=>
const
LinuxWorkflow
(),
Logger:
()
=>
globals
.
platform
.
isWindows
Logger:
()
=>
globals
.
platform
.
isWindows
?
WindowsStdoutLogger
(
?
WindowsStdoutLogger
(
terminal:
globals
.
terminal
,
terminal:
globals
.
terminal
,
...
...
packages/flutter_tools/lib/src/device.dart
View file @
42ae15f4
...
@@ -15,6 +15,7 @@ import 'base/file_system.dart';
...
@@ -15,6 +15,7 @@ import 'base/file_system.dart';
import
'base/io.dart'
;
import
'base/io.dart'
;
import
'base/utils.dart'
;
import
'base/utils.dart'
;
import
'build_info.dart'
;
import
'build_info.dart'
;
import
'features.dart'
;
import
'fuchsia/fuchsia_device.dart'
;
import
'fuchsia/fuchsia_device.dart'
;
import
'globals.dart'
as
globals
;
import
'globals.dart'
as
globals
;
import
'ios/devices.dart'
;
import
'ios/devices.dart'
;
...
@@ -74,7 +75,10 @@ class DeviceManager {
...
@@ -74,7 +75,10 @@ class DeviceManager {
FuchsiaDevices
(),
FuchsiaDevices
(),
FlutterTesterDevices
(),
FlutterTesterDevices
(),
MacOSDevices
(),
MacOSDevices
(),
LinuxDevices
(),
LinuxDevices
(
platform:
globals
.
platform
,
featureFlags:
featureFlags
,
),
WindowsDevices
(),
WindowsDevices
(),
WebDevices
(),
WebDevices
(),
]);
]);
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
42ae15f4
...
@@ -20,6 +20,7 @@ import 'base/utils.dart';
...
@@ -20,6 +20,7 @@ import 'base/utils.dart';
import
'base/version.dart'
;
import
'base/version.dart'
;
import
'cache.dart'
;
import
'cache.dart'
;
import
'device.dart'
;
import
'device.dart'
;
import
'features.dart'
;
import
'fuchsia/fuchsia_workflow.dart'
;
import
'fuchsia/fuchsia_workflow.dart'
;
import
'globals.dart'
as
globals
;
import
'globals.dart'
as
globals
;
import
'intellij/intellij.dart'
;
import
'intellij/intellij.dart'
;
...
@@ -67,6 +68,10 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
...
@@ -67,6 +68,10 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
...
IntelliJValidator
.
installedValidators
,
...
IntelliJValidator
.
installedValidators
,
...
VsCodeValidator
.
installedValidators
,
...
VsCodeValidator
.
installedValidators
,
];
];
final
LinuxWorkflow
linuxWorkflow
=
LinuxWorkflow
(
platform:
globals
.
platform
,
featureFlags:
featureFlags
,
);
_validators
=
<
DoctorValidator
>[
_validators
=
<
DoctorValidator
>[
FlutterValidator
(),
FlutterValidator
(),
...
@@ -115,6 +120,10 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
...
@@ -115,6 +120,10 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
_workflows
.
add
(
fuchsiaWorkflow
);
_workflows
.
add
(
fuchsiaWorkflow
);
}
}
final
LinuxWorkflow
linuxWorkflow
=
LinuxWorkflow
(
platform:
globals
.
platform
,
featureFlags:
featureFlags
,
);
if
(
linuxWorkflow
.
appliesToHostPlatform
)
{
if
(
linuxWorkflow
.
appliesToHostPlatform
)
{
_workflows
.
add
(
linuxWorkflow
);
_workflows
.
add
(
linuxWorkflow
);
}
}
...
...
packages/flutter_tools/lib/src/linux/linux_device.dart
View file @
42ae15f4
...
@@ -2,10 +2,13 @@
...
@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:meta/meta.dart'
;
import
'package:platform/platform.dart'
;
import
'../build_info.dart'
;
import
'../build_info.dart'
;
import
'../desktop_device.dart'
;
import
'../desktop_device.dart'
;
import
'../device.dart'
;
import
'../device.dart'
;
import
'../
globals.dart'
as
globals
;
import
'../
features.dart'
;
import
'../project.dart'
;
import
'../project.dart'
;
import
'application_package.dart'
;
import
'application_package.dart'
;
import
'build_linux.dart'
;
import
'build_linux.dart'
;
...
@@ -53,13 +56,24 @@ class LinuxDevice extends DesktopDevice {
...
@@ -53,13 +56,24 @@ class LinuxDevice extends DesktopDevice {
}
}
class
LinuxDevices
extends
PollingDeviceDiscovery
{
class
LinuxDevices
extends
PollingDeviceDiscovery
{
LinuxDevices
()
:
super
(
'linux devices'
);
LinuxDevices
({
@required
Platform
platform
,
@required
FeatureFlags
featureFlags
,
})
:
_platform
=
platform
,
_linuxWorkflow
=
LinuxWorkflow
(
platform:
platform
,
featureFlags:
featureFlags
,
),
super
(
'linux devices'
);
final
Platform
_platform
;
final
LinuxWorkflow
_linuxWorkflow
;
@override
@override
bool
get
supportsPlatform
=>
globals
.
platform
.
isLinux
;
bool
get
supportsPlatform
=>
_
platform
.
isLinux
;
@override
@override
bool
get
canListAnything
=>
linuxWorkflow
.
canListDevices
;
bool
get
canListAnything
=>
_
linuxWorkflow
.
canListDevices
;
@override
@override
Future
<
List
<
Device
>>
pollingGetDevices
()
async
{
Future
<
List
<
Device
>>
pollingGetDevices
()
async
{
...
...
packages/flutter_tools/lib/src/linux/linux_workflow.dart
View file @
42ae15f4
...
@@ -2,29 +2,34 @@
...
@@ -2,29 +2,34 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'../base/context.dart'
;
import
'package:meta/meta.dart'
;
import
'package:platform/platform.dart'
;
import
'../doctor.dart'
;
import
'../doctor.dart'
;
import
'../features.dart'
;
import
'../features.dart'
;
import
'../globals.dart'
as
globals
;
/// The [WindowsWorkflow] instance.
LinuxWorkflow
get
linuxWorkflow
=>
context
.
get
<
LinuxWorkflow
>();
/// The windows-specific implementation of a [Workflow].
/// The windows-specific implementation of a [Workflow].
///
///
/// This workflow requires the flutter-desktop-embedding as a sibling
/// This workflow requires the flutter-desktop-embedding as a sibling
/// repository to the flutter repo.
/// repository to the flutter repo.
class
LinuxWorkflow
implements
Workflow
{
class
LinuxWorkflow
implements
Workflow
{
const
LinuxWorkflow
();
const
LinuxWorkflow
({
@required
Platform
platform
,
@required
FeatureFlags
featureFlags
,
})
:
_platform
=
platform
,
_featureFlags
=
featureFlags
;
final
Platform
_platform
;
final
FeatureFlags
_featureFlags
;
@override
@override
bool
get
appliesToHostPlatform
=>
globals
.
platform
.
isLinux
&&
featureFlags
.
isLinuxEnabled
;
bool
get
appliesToHostPlatform
=>
_platform
.
isLinux
&&
_
featureFlags
.
isLinuxEnabled
;
@override
@override
bool
get
canLaunchDevices
=>
globals
.
platform
.
isLinux
&&
featureFlags
.
isLinuxEnabled
;
bool
get
canLaunchDevices
=>
_platform
.
isLinux
&&
_
featureFlags
.
isLinuxEnabled
;
@override
@override
bool
get
canListDevices
=>
globals
.
platform
.
isLinux
&&
featureFlags
.
isLinuxEnabled
;
bool
get
canListDevices
=>
_platform
.
isLinux
&&
_
featureFlags
.
isLinuxEnabled
;
@override
@override
bool
get
canListEmulators
=>
false
;
bool
get
canListEmulators
=>
false
;
...
...
packages/flutter_tools/test/general.shard/linux/linux_device_test.dart
View file @
42ae15f4
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/linux/application_package.dart'
;
import
'package:flutter_tools/src/linux/application_package.dart'
;
import
'package:flutter_tools/src/linux/linux_device.dart'
;
import
'package:flutter_tools/src/linux/linux_device.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/device.dart'
;
...
@@ -36,9 +37,10 @@ void main() {
...
@@ -36,9 +37,10 @@ void main() {
});
});
testUsingContext
(
'LinuxDevice: no devices listed if platform unsupported'
,
()
async
{
testUsingContext
(
'LinuxDevice: no devices listed if platform unsupported'
,
()
async
{
expect
(
await
LinuxDevices
().
devices
,
<
Device
>[]);
expect
(
await
LinuxDevices
(
},
overrides:
<
Type
,
Generator
>{
platform:
notLinux
,
Platform:
()
=>
notLinux
,
featureFlags:
featureFlags
,
).
devices
,
<
Device
>[]);
});
});
testUsingContext
(
'LinuxDevice.isSupportedForProject is true with editable host app'
,
()
async
{
testUsingContext
(
'LinuxDevice.isSupportedForProject is true with editable host app'
,
()
async
{
...
...
packages/flutter_tools/test/general.shard/linux/linux_workflow_test.dart
View file @
42ae15f4
...
@@ -2,61 +2,60 @@
...
@@ -2,61 +2,60 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter_tools/src/features.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:platform/platform.dart'
;
import
'package:platform/platform.dart'
;
import
'package:flutter_tools/src/features.dart'
;
import
'package:flutter_tools/src/linux/linux_workflow.dart'
;
import
'package:flutter_tools/src/linux/linux_workflow.dart'
;
import
'../../src/common.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/testbed.dart'
;
import
'../../src/testbed.dart'
;
void
main
(
)
{
void
main
(
)
{
MockPlatform
linux
;
final
Platform
linux
=
FakePlatform
(
MockPlatform
notLinux
;
operatingSystem:
'linux'
,
Testbed
testbed
;
environment:
<
String
,
String
>{},
);
setUp
(()
{
final
Platform
notLinux
=
FakePlatform
(
linux
=
MockPlatform
();
operatingSystem:
'windows'
,
notLinux
=
MockPlatform
();
environment:
<
String
,
String
>{},
when
(
linux
.
isLinux
).
thenReturn
(
true
);
);
when
(
notLinux
.
isLinux
).
thenReturn
(
false
);
final
FeatureFlags
enabledFlags
=
TestFeatureFlags
(
testbed
=
Testbed
(
isLinuxEnabled:
true
,
overrides:
<
Type
,
Generator
>{
);
Platform:
()
=>
linux
,
final
FeatureFlags
disabledFlags
=
TestFeatureFlags
(
isLinuxEnabled:
false
);
FeatureFlags:
()
=>
TestFeatureFlags
(
isLinuxEnabled:
true
),
},
testWithoutContext
(
'Applies to Linux platform'
,
()
{
final
LinuxWorkflow
linuxWorkflow
=
LinuxWorkflow
(
platform:
linux
,
featureFlags:
enabledFlags
,
);
);
});
test
(
'Applies to linux platform'
,
()
=>
testbed
.
run
(()
{
expect
(
linuxWorkflow
.
appliesToHostPlatform
,
true
);
expect
(
linuxWorkflow
.
appliesToHostPlatform
,
true
);
expect
(
linuxWorkflow
.
canLaunchDevices
,
true
);
expect
(
linuxWorkflow
.
canLaunchDevices
,
true
);
expect
(
linuxWorkflow
.
canListDevices
,
true
);
expect
(
linuxWorkflow
.
canListDevices
,
true
);
expect
(
linuxWorkflow
.
canListEmulators
,
false
);
expect
(
linuxWorkflow
.
canListEmulators
,
false
);
}));
});
testWithoutContext
(
'Does not apply to non-Linux platform'
,
()
{
final
LinuxWorkflow
linuxWorkflow
=
LinuxWorkflow
(
platform:
notLinux
,
featureFlags:
enabledFlags
,
);
test
(
'Does not apply to non-linux platform'
,
()
=>
testbed
.
run
(()
{
expect
(
linuxWorkflow
.
appliesToHostPlatform
,
false
);
expect
(
linuxWorkflow
.
appliesToHostPlatform
,
false
);
expect
(
linuxWorkflow
.
canLaunchDevices
,
false
);
expect
(
linuxWorkflow
.
canLaunchDevices
,
false
);
expect
(
linuxWorkflow
.
canListDevices
,
false
);
expect
(
linuxWorkflow
.
canListDevices
,
false
);
expect
(
linuxWorkflow
.
canListEmulators
,
false
);
expect
(
linuxWorkflow
.
canListEmulators
,
false
);
},
overrides:
<
Type
,
Generator
>{
});
Platform:
()
=>
notLinux
,
}));
testWithoutContext
(
'Does not apply when the Linux desktop feature is disabled'
,
()
{
final
LinuxWorkflow
linuxWorkflow
=
LinuxWorkflow
(
platform:
linux
,
featureFlags:
disabledFlags
,
);
test
(
'Does not apply when feature is disabled'
,
()
=>
testbed
.
run
(()
{
expect
(
linuxWorkflow
.
appliesToHostPlatform
,
false
);
expect
(
linuxWorkflow
.
appliesToHostPlatform
,
false
);
expect
(
linuxWorkflow
.
canLaunchDevices
,
false
);
expect
(
linuxWorkflow
.
canLaunchDevices
,
false
);
expect
(
linuxWorkflow
.
canListDevices
,
false
);
expect
(
linuxWorkflow
.
canListDevices
,
false
);
expect
(
linuxWorkflow
.
canListEmulators
,
false
);
expect
(
linuxWorkflow
.
canListEmulators
,
false
);
},
overrides:
<
Type
,
Generator
>{
});
FeatureFlags:
()
=>
TestFeatureFlags
(
isLinuxEnabled:
false
),
}));
}
class
MockPlatform
extends
Mock
implements
Platform
{
@override
final
Map
<
String
,
String
>
environment
=
<
String
,
String
>{};
}
}
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