Commit 63f941bc authored by Devon Carew's avatar Devon Carew

Merge pull request #2087 from devoncarew/remove_sim_package_store

remove iosSimulator field from ApplicationPackageStore
parents 896246ad 3463d89c
...@@ -88,36 +88,32 @@ class IOSApp extends ApplicationPackage { ...@@ -88,36 +88,32 @@ class IOSApp extends ApplicationPackage {
}) : super(localPath: iosProjectDir, id: iosProjectBundleId); }) : super(localPath: iosProjectDir, id: iosProjectBundleId);
factory IOSApp.fromBuildConfiguration(BuildConfiguration config) { factory IOSApp.fromBuildConfiguration(BuildConfiguration config) {
if (getCurrentHostPlatform() != HostPlatform.mac) { if (getCurrentHostPlatform() != HostPlatform.mac)
return null; return null;
}
String plistPath = path.join("ios", "Info.plist"); String plistPath = path.join("ios", "Info.plist");
String id = plistValueForKey(plistPath, kCFBundleIdentifierKey); String value = getValueFromFile(plistPath, kCFBundleIdentifierKey);
if (id == "") { if (value == null)
return null; return null;
}
String projectDir = path.join("ios", ".generated"); String projectDir = path.join("ios", ".generated");
return new IOSApp(iosProjectDir: projectDir, iosProjectBundleId: id); return new IOSApp(iosProjectDir: projectDir, iosProjectBundleId: value);
} }
} }
class ApplicationPackageStore { class ApplicationPackageStore {
final AndroidApk android; final AndroidApk android;
final IOSApp iOS; final IOSApp iOS;
final IOSApp iOSSimulator;
ApplicationPackageStore({ this.android, this.iOS, this.iOSSimulator }); ApplicationPackageStore({ this.android, this.iOS });
ApplicationPackage getPackageForPlatform(TargetPlatform platform) { ApplicationPackage getPackageForPlatform(TargetPlatform platform) {
switch (platform) { switch (platform) {
case TargetPlatform.android: case TargetPlatform.android:
return android; return android;
case TargetPlatform.iOS: case TargetPlatform.iOS:
return iOS;
case TargetPlatform.iOSSimulator: case TargetPlatform.iOSSimulator:
return iOSSimulator; return iOS;
case TargetPlatform.mac: case TargetPlatform.mac:
case TargetPlatform.linux: case TargetPlatform.linux:
return null; return null;
...@@ -127,7 +123,6 @@ class ApplicationPackageStore { ...@@ -127,7 +123,6 @@ class ApplicationPackageStore {
static Future<ApplicationPackageStore> forConfigs(List<BuildConfiguration> configs) async { static Future<ApplicationPackageStore> forConfigs(List<BuildConfiguration> configs) async {
AndroidApk android; AndroidApk android;
IOSApp iOS; IOSApp iOS;
IOSApp iOSSimulator;
for (BuildConfiguration config in configs) { for (BuildConfiguration config in configs) {
switch (config.targetPlatform) { switch (config.targetPlatform) {
...@@ -150,21 +145,17 @@ class ApplicationPackageStore { ...@@ -150,21 +145,17 @@ class ApplicationPackageStore {
break; break;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.iOSSimulator:
assert(iOS == null); assert(iOS == null);
iOS = new IOSApp.fromBuildConfiguration(config); iOS = new IOSApp.fromBuildConfiguration(config);
break; break;
case TargetPlatform.iOSSimulator:
assert(iOSSimulator == null);
iOSSimulator = new IOSApp.fromBuildConfiguration(config);
break;
case TargetPlatform.mac: case TargetPlatform.mac:
case TargetPlatform.linux: case TargetPlatform.linux:
break; break;
} }
} }
return new ApplicationPackageStore(android: android, iOS: iOS, iOSSimulator: iOSSimulator); return new ApplicationPackageStore(android: android, iOS: iOS);
} }
} }
...@@ -27,11 +27,11 @@ class DevicesCommand extends FlutterCommand { ...@@ -27,11 +27,11 @@ class DevicesCommand extends FlutterCommand {
if (devices.isEmpty) { if (devices.isEmpty) {
printStatus('No connected devices.'); printStatus('No connected devices.');
} else { } else {
printStatus('${devices.length} connected ${pluralize('device', devices.length)}:'); printStatus('${devices.length} connected ${pluralize('device', devices.length)}:\n');
for (Device device in devices) { for (Device device in devices) {
String supportIndicator = device.isSupported() ? '' : '- unsupported'; String supportIndicator = device.isSupported() ? '' : ' - unsupported';
printStatus('${device.name} (${device.id}) $supportIndicator'); printStatus('${device.name} (${device.id})$supportIndicator');
} }
} }
......
...@@ -170,6 +170,7 @@ Future<int> startApp( ...@@ -170,6 +170,7 @@ Future<int> startApp(
if (install) { if (install) {
printTrace('Running install command.'); printTrace('Running install command.');
// TODO(devoncarew): This fails for ios devices - we haven't built yet.
await installApp(devices, applicationPackages); await installApp(devices, applicationPackages);
} }
......
...@@ -59,9 +59,8 @@ class XCode { ...@@ -59,9 +59,8 @@ class XCode {
bool _xcodeVersionSatisfactory; bool _xcodeVersionSatisfactory;
bool get xcodeVersionSatisfactory { bool get xcodeVersionSatisfactory {
if (_xcodeVersionSatisfactory != null) { if (_xcodeVersionSatisfactory != null)
return _xcodeVersionSatisfactory; return _xcodeVersionSatisfactory;
}
try { try {
String output = runSync(<String>['xcodebuild', '-version']); String output = runSync(<String>['xcodebuild', '-version']);
......
...@@ -8,7 +8,7 @@ import '../base/process.dart'; ...@@ -8,7 +8,7 @@ import '../base/process.dart';
const String kCFBundleIdentifierKey = "CFBundleIdentifier"; const String kCFBundleIdentifierKey = "CFBundleIdentifier";
String plistValueForKey(String plistFilePath, String plistKey) { String getValueFromFile(String plistFilePath, String key) {
// TODO(chinmaygarde): For now, we only need to read from plist files on a // TODO(chinmaygarde): For now, we only need to read from plist files on a
// mac host. If this changes, we will need our own Dart plist reader. // mac host. If this changes, we will need our own Dart plist reader.
...@@ -18,12 +18,14 @@ String plistValueForKey(String plistFilePath, String plistKey) { ...@@ -18,12 +18,14 @@ String plistValueForKey(String plistFilePath, String plistKey) {
String normalizedPlistPath = path.withoutExtension(path.absolute(plistFilePath)); String normalizedPlistPath = path.withoutExtension(path.absolute(plistFilePath));
try { try {
return runCheckedSync([ String value = runCheckedSync(<String>[
'/usr/bin/defaults', '/usr/bin/defaults',
'read', 'read',
normalizedPlistPath, normalizedPlistPath,
plistKey]).trim(); key
]).trim();
return value.isEmpty ? null : value;
} catch (error) { } catch (error) {
return ""; return null;
} }
} }
...@@ -15,10 +15,11 @@ import 'package:mockito/mockito.dart'; ...@@ -15,10 +15,11 @@ import 'package:mockito/mockito.dart';
class MockApplicationPackageStore extends ApplicationPackageStore { class MockApplicationPackageStore extends ApplicationPackageStore {
MockApplicationPackageStore() : super( MockApplicationPackageStore() : super(
android: new AndroidApk(localPath: '/mock/path/to/android/SkyShell.apk'), android: new AndroidApk(localPath: '/mock/path/to/android/SkyShell.apk'),
iOS: new IOSApp(iosProjectDir: '/mock/path/to/iOS/SkyShell.app', iOS: new IOSApp(
iosProjectBundleId: 'io.flutter.ios.mock'), iosProjectDir: '/mock/path/to/iOS/SkyShell.app',
iOSSimulator: new IOSApp(iosProjectDir: '/mock/path/to/iOSSimulator/SkyShell.app', iosProjectBundleId: 'io.flutter.ios.mock'
iosProjectBundleId: 'io.flutter.ios.mock')); )
);
} }
class MockCompiler extends Mock implements Compiler { class MockCompiler extends Mock implements Compiler {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment