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
194c88b9
Commit
194c88b9
authored
Mar 15, 2016
by
Yegor
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2702 from yjbanov/better-device-name
[ios] improve test device naming
parents
44533012
225686b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
7 deletions
+35
-7
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+35
-7
No files found.
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
194c88b9
...
...
@@ -22,7 +22,7 @@ import 'mac.dart';
const
String
_xcrunPath
=
'/usr/bin/xcrun'
;
/// Test device created by Flutter when no other device is available.
const
String
_kFlutterTestDevice
=
'flutter.test.device
'
;
const
String
_kFlutterTestDevice
Suffix
=
'(Flutter)
'
;
class
IOSSimulators
extends
PollingDeviceDiscovery
{
IOSSimulators
()
:
super
(
'IOSSimulators'
);
...
...
@@ -97,7 +97,7 @@ class SimControl {
}
SimDevice
_createTestDevice
()
{
S
tring
deviceType
=
_findSuitableDeviceType
();
S
imDeviceType
deviceType
=
_findSuitableDeviceType
();
if
(
deviceType
==
null
)
{
return
null
;
}
...
...
@@ -109,18 +109,19 @@ class SimControl {
// Delete any old test devices
getDevices
()
.
where
((
SimDevice
d
)
=>
d
.
name
==
_kFlutterTestDevice
)
.
where
((
SimDevice
d
)
=>
d
.
name
.
endsWith
(
_kFlutterTestDeviceSuffix
)
)
.
forEach
(
_deleteDevice
);
// Create new device
List
<
String
>
args
=
[
_xcrunPath
,
'simctl'
,
'create'
,
_kFlutterTestDevice
,
deviceType
,
runtime
];
String
deviceName
=
'
${deviceType.name}
$_kFlutterTestDeviceSuffix
'
;
List
<
String
>
args
=
[
_xcrunPath
,
'simctl'
,
'create'
,
deviceName
,
deviceType
.
identifier
,
runtime
];
printTrace
(
args
.
join
(
' '
));
runCheckedSync
(
args
);
return
getDevices
().
firstWhere
((
SimDevice
d
)
=>
d
.
name
==
_kFlutterTestDevic
e
);
return
getDevices
().
firstWhere
((
SimDevice
d
)
=>
d
.
name
==
deviceNam
e
);
}
S
tring
_findSuitableDeviceType
()
{
S
imDeviceType
_findSuitableDeviceType
()
{
List
<
Map
<
String
,
dynamic
>>
allTypes
=
_list
(
SimControlListSection
.
devicetypes
);
List
<
Map
<
String
,
dynamic
>>
usableTypes
=
allTypes
.
where
((
Map
<
String
,
dynamic
>
info
)
=>
info
[
'name'
].
startsWith
(
'iPhone'
))
...
...
@@ -136,7 +137,10 @@ class SimControl {
);
}
return
usableTypes
.
first
[
'identifier'
];
return
new
SimDeviceType
(
usableTypes
.
first
[
'name'
],
usableTypes
.
first
[
'identifier'
]
);
}
String
_findSuitableRuntime
()
{
...
...
@@ -300,6 +304,30 @@ class SimControlListSection {
static
const
SimControlListSection
pairs
=
const
SimControlListSection
.
_
(
'pairs'
);
}
/// A simulated device type.
///
/// Simulated device types can be listed using the command
/// `xcrun simctl list devicetypes`.
class
SimDeviceType
{
SimDeviceType
(
this
.
name
,
this
.
identifier
);
/// The name of the device type.
///
/// Examples:
///
/// "iPhone 6s"
/// "iPhone 6 Plus"
final
String
name
;
/// The identifier of the device type.
///
/// Examples:
///
/// "com.apple.CoreSimulator.SimDeviceType.iPhone-6s"
/// "com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus"
final
String
identifier
;
}
class
SimDevice
{
SimDevice
(
this
.
category
,
this
.
data
);
...
...
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