blob: 85fd076c4d6ede96dd63a4a78df63e9943c19c77 [file] [log] [blame]
// Copyright 2013 The Flutter 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 'package:args/command_runner.dart';
import 'package:simulators/simulator_manager.dart';
import 'browser_lock.dart';
import 'utils.dart';
class CreateSimulatorCommand extends Command<bool> with ArgUtils<bool> {
String get name => 'create_simulator';
String get description => 'Creates mobile simulators.';
FutureOr<bool> run() async {
final IosSimulatorManager iosSimulatorManager = IosSimulatorManager();
try {
final SafariIosLock lock = browserLock.safariIosLock;
final IosSimulator simulator = await iosSimulatorManager.createSimulator(
print('INFO: Simulator created ${simulator.toString()}');
} catch (e) {
throw Exception('Error creating requested simulator. You can use Xcode '
'to install more versions: XCode > Preferences > Components.'
' Exception: $e');
return true;