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
2e5284a2
Unverified
Commit
2e5284a2
authored
Jun 23, 2021
by
Jenn Magder
Committed by
GitHub
Jun 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not list Android or iOS devices when feature disabled (#85145)
parent
4606a746
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
9 deletions
+73
-9
android_workflow.dart
packages/flutter_tools/lib/src/android/android_workflow.dart
+3
-5
ios_workflow.dart
packages/flutter_tools/lib/src/ios/ios_workflow.dart
+2
-2
android_workflow_test.dart
...ols/test/general.shard/android/android_workflow_test.dart
+52
-0
ios_workflow_test.dart
...utter_tools/test/general.shard/ios/ios_workflow_test.dart
+16
-2
No files found.
packages/flutter_tools/lib/src/android/android_workflow.dart
View file @
2e5284a2
...
...
@@ -57,18 +57,16 @@ class AndroidWorkflow implements Workflow {
&&
_operatingSystemUtils
.
hostPlatform
!=
HostPlatform
.
linux_arm64
;
@override
bool
get
canListDevices
=>
_androidSdk
!=
null
bool
get
canListDevices
=>
appliesToHostPlatform
&&
_androidSdk
!=
null
&&
_androidSdk
?.
adbPath
!=
null
;
@override
bool
get
canLaunchDevices
=>
_androidSdk
!=
null
bool
get
canLaunchDevices
=>
appliesToHostPlatform
&&
_androidSdk
!=
null
&&
_androidSdk
?.
adbPath
!=
null
&&
_androidSdk
?.
validateSdkWellFormed
().
isEmpty
==
true
;
@override
bool
get
canListEmulators
=>
_androidSdk
!=
null
&&
_androidSdk
?.
adbPath
!=
null
&&
_androidSdk
?.
emulatorPath
!=
null
;
bool
get
canListEmulators
=>
canListDevices
&&
_androidSdk
?.
emulatorPath
!=
null
;
}
/// A validator that checks if the Android SDK and Java SDK are available and
...
...
packages/flutter_tools/lib/src/ios/ios_workflow.dart
View file @
2e5284a2
...
...
@@ -25,12 +25,12 @@ class IOSWorkflow implements Workflow {
// We need xcode (+simctl) to list simulator devices, and libimobiledevice to list real devices.
@override
bool
get
canListDevices
=>
_xcode
.
isInstalledAndMeetsVersionCheck
&&
_xcode
.
isSimctlInstalled
;
bool
get
canListDevices
=>
appliesToHostPlatform
&&
_xcode
.
isInstalledAndMeetsVersionCheck
&&
_xcode
.
isSimctlInstalled
;
// We need xcode to launch simulator devices, and ios-deploy
// for real devices.
@override
bool
get
canLaunchDevices
=>
_xcode
.
isInstalledAndMeetsVersionCheck
;
bool
get
canLaunchDevices
=>
appliesToHostPlatform
&&
_xcode
.
isInstalledAndMeetsVersionCheck
;
@override
bool
get
canListEmulators
=>
false
;
...
...
packages/flutter_tools/test/general.shard/android/android_workflow_test.dart
View file @
2e5284a2
...
...
@@ -73,6 +73,55 @@ void main() {
);
expect
(
androidWorkflow
.
appliesToHostPlatform
,
false
);
expect
(
androidWorkflow
.
canLaunchDevices
,
false
);
expect
(
androidWorkflow
.
canListDevices
,
false
);
expect
(
androidWorkflow
.
canListEmulators
,
false
);
});
testWithoutContext
(
'AndroidWorkflow is disabled if feature is disabled'
,
()
{
final
FakeAndroidSdk
androidSdk
=
FakeAndroidSdk
();
androidSdk
.
adbPath
=
'path/to/adb'
;
final
AndroidWorkflow
androidWorkflow
=
AndroidWorkflow
(
featureFlags:
TestFeatureFlags
(
isAndroidEnabled:
false
),
androidSdk:
androidSdk
,
operatingSystemUtils:
FakeOperatingSystemUtils
(),
);
expect
(
androidWorkflow
.
appliesToHostPlatform
,
false
);
expect
(
androidWorkflow
.
canLaunchDevices
,
false
);
expect
(
androidWorkflow
.
canListDevices
,
false
);
expect
(
androidWorkflow
.
canListEmulators
,
false
);
});
testWithoutContext
(
'AndroidWorkflow cannot list emulators if emulatorPath is null'
,
()
{
final
FakeAndroidSdk
androidSdk
=
FakeAndroidSdk
();
androidSdk
.
adbPath
=
'path/to/adb'
;
final
AndroidWorkflow
androidWorkflow
=
AndroidWorkflow
(
featureFlags:
TestFeatureFlags
(),
androidSdk:
androidSdk
,
operatingSystemUtils:
FakeOperatingSystemUtils
(),
);
expect
(
androidWorkflow
.
appliesToHostPlatform
,
true
);
expect
(
androidWorkflow
.
canLaunchDevices
,
true
);
expect
(
androidWorkflow
.
canListDevices
,
true
);
expect
(
androidWorkflow
.
canListEmulators
,
false
);
});
testWithoutContext
(
'AndroidWorkflow can list emulators'
,
()
{
final
FakeAndroidSdk
androidSdk
=
FakeAndroidSdk
();
androidSdk
.
adbPath
=
'path/to/adb'
;
androidSdk
.
emulatorPath
=
'path/to/emulator'
;
final
AndroidWorkflow
androidWorkflow
=
AndroidWorkflow
(
featureFlags:
TestFeatureFlags
(),
androidSdk:
androidSdk
,
operatingSystemUtils:
FakeOperatingSystemUtils
(),
);
expect
(
androidWorkflow
.
appliesToHostPlatform
,
true
);
expect
(
androidWorkflow
.
canLaunchDevices
,
true
);
expect
(
androidWorkflow
.
canListDevices
,
true
);
expect
(
androidWorkflow
.
canListEmulators
,
true
);
});
testWithoutContext
(
'licensesAccepted returns LicensesAccepted.unknown if cannot find sdkmanager'
,
()
async
{
...
...
@@ -496,6 +545,9 @@ class FakeAndroidSdk extends Fake implements AndroidSdk {
@override
AndroidSdkVersion
latestVersion
;
@override
String
emulatorPath
;
@override
List
<
String
>
validateSdkWellFormed
()
=>
<
String
>[];
...
...
packages/flutter_tools/test/general.shard/ios/ios_workflow_test.dart
View file @
2e5284a2
...
...
@@ -21,6 +21,8 @@ void main() {
);
expect
(
iosWorkflow
.
appliesToHostPlatform
,
false
);
expect
(
iosWorkflow
.
canLaunchDevices
,
false
);
expect
(
iosWorkflow
.
canListDevices
,
false
);
});
testWithoutContext
(
'iOS workflow is disabled on Linux'
,
()
{
...
...
@@ -31,6 +33,8 @@ void main() {
);
expect
(
iosWorkflow
.
appliesToHostPlatform
,
false
);
expect
(
iosWorkflow
.
canLaunchDevices
,
false
);
expect
(
iosWorkflow
.
canListDevices
,
false
);
});
testWithoutContext
(
'iOS workflow is disabled on windows'
,
()
{
...
...
@@ -41,16 +45,25 @@ void main() {
);
expect
(
iosWorkflow
.
appliesToHostPlatform
,
false
);
expect
(
iosWorkflow
.
canLaunchDevices
,
false
);
expect
(
iosWorkflow
.
canListDevices
,
false
);
});
testWithoutContext
(
'iOS workflow
is enabled on macOS
'
,
()
{
testWithoutContext
(
'iOS workflow
applies on macOS, no Xcode
'
,
()
{
final
IOSWorkflow
iosWorkflow
=
IOSWorkflow
(
platform:
FakePlatform
(
operatingSystem:
'macos'
),
xcode:
Xcode
.
test
(
processManager:
FakeProcessManager
.
any
()),
xcode:
Xcode
.
test
(
processManager:
FakeProcessManager
.
any
(),
xcodeProjectInterpreter:
XcodeProjectInterpreter
.
test
(
processManager:
FakeProcessManager
.
any
(),
version:
null
,
),
),
featureFlags:
TestFeatureFlags
(
isIOSEnabled:
true
),
);
expect
(
iosWorkflow
.
appliesToHostPlatform
,
true
);
expect
(
iosWorkflow
.
canLaunchDevices
,
false
);
expect
(
iosWorkflow
.
canListDevices
,
false
);
expect
(
iosWorkflow
.
canListEmulators
,
false
);
});
...
...
@@ -74,5 +87,6 @@ void main() {
expect
(
xcode
.
isSimctlInstalled
,
true
);
expect
(
iosWorkflow
.
canLaunchDevices
,
true
);
expect
(
iosWorkflow
.
canListDevices
,
true
);
expect
(
iosWorkflow
.
canListEmulators
,
false
);
});
}
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