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
c0b2e783
Commit
c0b2e783
authored
Apr 18, 2018
by
Danny Tuppeny
Committed by
Danny Tuppeny
May 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for iOS Simulator in `flutter emulators`
parent
799678f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
emulator.dart
packages/flutter_tools/lib/src/emulator.dart
+2
-0
ios_emulators.dart
packages/flutter_tools/lib/src/ios/ios_emulators.dart
+76
-0
No files found.
packages/flutter_tools/lib/src/emulator.dart
View file @
c0b2e783
...
...
@@ -8,6 +8,7 @@ import 'dart:math' as math;
import
'android/android_emulator.dart'
;
import
'base/context.dart'
;
import
'globals.dart'
;
import
'ios/ios_emulators.dart'
;
EmulatorManager
get
emulatorManager
=>
context
[
EmulatorManager
];
...
...
@@ -18,6 +19,7 @@ class EmulatorManager {
EmulatorManager
()
{
// Register the known discoverers.
_emulatorDiscoverers
.
add
(
new
AndroidEmulators
());
_emulatorDiscoverers
.
add
(
new
IOSEmulators
());
}
final
List
<
EmulatorDiscovery
>
_emulatorDiscoverers
=
<
EmulatorDiscovery
>[];
...
...
packages/flutter_tools/lib/src/ios/ios_emulators.dart
0 → 100644
View file @
c0b2e783
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../emulator.dart'
;
import
'../globals.dart'
;
import
'ios_workflow.dart'
;
// TODO: Is there a better name for this? We already have IOSSimulator classes
// that represent *running* simulators, but this is about "unlaunched images"...
class
IOSEmulators
extends
EmulatorDiscovery
{
@override
bool
get
supportsPlatform
=>
platform
.
isMacOS
;
@override
bool
get
canListAnything
=>
iosWorkflow
.
canListEmulators
;
@override
Future
<
List
<
Emulator
>>
get
emulators
async
=>
getEmulators
();
}
class
IOSEmulator
extends
Emulator
{
IOSEmulator
(
String
id
)
:
super
(
id
,
true
);
@override
String
get
name
=>
'iOS Simulator'
;
@override
String
get
manufacturer
=>
'Apple'
;
@override
String
get
label
=>
''
;
@override
Future
<
bool
>
launch
()
async
{
final
Status
status
=
logger
.
startProgress
(
'Launching
$id
...'
);
final
RunResult
launchResult
=
await
runAsync
(<
String
>[
'open'
,
'-a'
,
getSimulatorPath
()]);
status
.
stop
();
if
(
launchResult
.
exitCode
!=
0
)
{
printError
(
'Error: iOS simulator failed to launch with exit code
${launchResult.exitCode}
'
);
printError
(
'
$launchResult
'
);
return
false
;
}
return
true
;
}
}
/// Return the list of iOS Simulators (there can only be zero or one).
List
<
IOSEmulator
>
getEmulators
()
{
final
String
simulatorPath
=
getSimulatorPath
();
if
(
simulatorPath
==
null
)
{
return
<
IOSEmulator
>[];
}
return
<
IOSEmulator
>[
new
IOSEmulator
(
'apple_ios_simulator'
)];
}
String
getSimulatorPath
(
)
{
final
List
<
String
>
searchPaths
=
<
String
>[
// TODO: Could this be anywhere else?
'/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app'
,
];
return
searchPaths
.
where
((
String
p
)
=>
p
!=
null
).
firstWhere
(
(
String
p
)
=>
fs
.
directory
(
p
).
existsSync
(),
orElse:
()
=>
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