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
e69f6562
Commit
e69f6562
authored
Mar 03, 2016
by
Yegor Jbanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ios] use xcrun to launch simulator instead of hardcoded path
parent
df73b481
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
27 deletions
+25
-27
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+25
-27
No files found.
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
e69f6562
...
...
@@ -21,9 +21,6 @@ import 'mac.dart';
const
String
_xcrunPath
=
'/usr/bin/xcrun'
;
const
String
_simulatorPath
=
'/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator'
;
class
IOSSimulators
extends
PollingDeviceDiscovery
{
IOSSimulators
()
:
super
(
'IOSSimulators'
);
...
...
@@ -56,33 +53,34 @@ class SimControl {
if
(
_isAnyConnected
())
return
true
;
if
(
deviceId
==
null
)
{
runDetached
([
_simulatorPath
]);
Future
<
bool
>
checkConnection
([
int
attempts
=
20
])
async
{
if
(
attempts
==
0
)
{
printStatus
(
'Timed out waiting for iOS Simulator to boot.'
);
return
false
;
}
if
(!
_isAnyConnected
())
{
printStatus
(
'Waiting for iOS Simulator to boot...'
);
return
await
new
Future
.
delayed
(
new
Duration
(
milliseconds:
500
),
()
=>
checkConnection
(
attempts
-
1
)
);
}
return
true
;
}
return
await
checkConnection
();
}
else
{
try
{
runCheckedSync
([
_xcrunPath
,
'simctl'
,
'boot'
,
deviceId
]);
return
true
;
}
catch
(
e
)
{
printError
(
'Unable to boot iOS Simulator
$deviceId
: '
,
e
);
return
false
;
if
(
deviceId
==
null
)
deviceId
=
'iPhone 6 (9.2)'
;
// `xcrun instruments` requires a template (-t). @yjbanov has no idea what
// "template" is but the built-in 'Blank' seems to work.
List
<
String
>
args
=
[
_xcrunPath
,
'instruments'
,
'-w'
,
deviceId
,
'-t'
,
'Blank'
];
printTrace
(
args
.
join
(
' '
));
runDetached
(
args
);
printStatus
(
'Waiting for iOS Simulator to boot...'
);
bool
connected
=
false
;
int
attempted
=
0
;
while
(!
connected
&&
attempted
<
20
)
{
connected
=
await
_isAnyConnected
();
if
(!
connected
)
{
printStatus
(
'Still waiting for iOS Simulator to boot...'
);
await
new
Future
.
delayed
(
new
Duration
(
seconds:
1
));
}
attempted
++;
}
return
false
;
if
(
connected
)
{
printStatus
(
'Connected to iOS Simulator.'
);
return
true
;
}
else
{
printStatus
(
'Timed out waiting for iOS Simulator to boot.'
);
return
false
;
}
}
/// Returns a list of all available devices, both potential and connected.
...
...
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