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
e98b7f4c
Commit
e98b7f4c
authored
Jan 14, 2016
by
Chinmay Garde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make picking of either an iOS or Android device from a configuration follow a common code path
parent
53ea6194
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
14 deletions
+26
-14
device.dart
packages/flutter_tools/lib/src/device.dart
+26
-14
No files found.
packages/flutter_tools/lib/src/device.dart
View file @
e98b7f4c
...
...
@@ -997,6 +997,30 @@ class DeviceStore {
this
.
iOSSimulator
});
static
Device
_deviceForConfig
(
BuildConfiguration
config
,
List
<
Device
>
devices
)
{
Device
device
=
null
;
if
(
config
.
deviceId
!=
null
)
{
// Step 1: If a device identifier is specified, try to find a device
// matching that specific identifier
device
=
devices
.
firstWhere
(
(
Device
dev
)
=>
(
dev
.
id
==
config
.
deviceId
),
orElse:
()
=>
null
);
if
(
device
==
null
)
{
logging
.
severe
(
'Warning: Device ID
${config.deviceId}
not found'
);
}
}
else
if
(
devices
.
length
==
1
)
{
// Step 2: If no identifier is specified and there is only one connected
// device, pick that one.
device
=
devices
[
0
];
}
else
if
(
devices
.
length
>
1
)
{
// Step 3: D:
logging
.
severe
(
'Warning: Multiple devices are connected, but no device ID was specified.'
);
}
return
device
;
}
factory
DeviceStore
.
forConfigs
(
List
<
BuildConfiguration
>
configs
)
{
AndroidDevice
android
;
IOSDevice
iOS
;
...
...
@@ -1006,23 +1030,11 @@ class DeviceStore {
switch
(
config
.
targetPlatform
)
{
case
TargetPlatform
.
android
:
assert
(
android
==
null
);
List
<
AndroidDevice
>
androidDevices
=
AndroidDevice
.
getAttachedDevices
();
if
(
config
.
deviceId
!=
null
)
{
android
=
androidDevices
.
firstWhere
(
(
AndroidDevice
dev
)
=>
(
dev
.
id
==
config
.
deviceId
),
orElse:
()
=>
null
);
if
(
android
==
null
)
{
print
(
'Warning: Device ID
${config.deviceId}
not found'
);
}
}
else
if
(
androidDevices
.
length
==
1
)
{
android
=
androidDevices
[
0
];
}
else
if
(
androidDevices
.
length
>
1
)
{
print
(
'Warning: Multiple Android devices are connected, but no device ID was specified.'
);
}
android
=
_deviceForConfig
(
config
,
AndroidDevice
.
getAttachedDevices
());
break
;
case
TargetPlatform
.
iOS
:
assert
(
iOS
==
null
);
iOS
=
new
IOSDevice
(
);
iOS
=
_deviceForConfig
(
config
,
IOSDevice
.
getAttachedDevices
()
);
break
;
case
TargetPlatform
.
iOSSimulator
:
assert
(
iOSSimulator
==
null
);
...
...
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