rename the platform constants
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index c4df79e..17fbb5d 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -48,7 +48,17 @@
final String modelID;
final String deviceCodeName;
- bool get isLocalEmulator => false;
+ bool _isLocalEmulator;
+
+ bool get isLocalEmulator {
+ if (_isLocalEmulator == null) {
+ // sample values: x86, armeabi-v7a
+ String value = runCheckedSync(adbCommandForDevice(['shell', 'getprop', 'ro.product.cpu.abi']));
+ _isLocalEmulator = value == 'x86';
+ }
+
+ return _isLocalEmulator;
+ }
_AdbLogReader _logReader;
_AndroidDevicePortForwarder _portForwarder;
@@ -59,8 +69,7 @@
bool _isValidAdbVersion(String adbVersion) {
// Sample output: 'Android Debug Bridge version 1.0.31'
- Match versionFields =
- new RegExp(r'(\d+)\.(\d+)\.(\d+)').firstMatch(adbVersion);
+ Match versionFields = new RegExp(r'(\d+)\.(\d+)\.(\d+)').firstMatch(adbVersion);
if (versionFields != null) {
int majorVersion = int.parse(versionFields[1]);
int minorVersion = int.parse(versionFields[2]);
@@ -275,8 +284,9 @@
return runCommandAndStreamOutput(command).then((int exitCode) => exitCode == 0);
}
+ // TODO(devoncarew): Return android_arm or android_x64 based on [isLocalEmulator].
@override
- TargetPlatform get platform => TargetPlatform.android;
+ TargetPlatform get platform => TargetPlatform.android_arm;
void clearLogs() {
runSync(adbCommandForDevice(<String>['logcat', '-c']));
@@ -584,7 +594,7 @@
return ports;
}
- Future<int> forward(int devicePort, {int hostPort: null}) async {
+ Future<int> forward(int devicePort, { int hostPort }) async {
if ((hostPort == null) || (hostPort == 0)) {
// Auto select host port.
hostPort = await findAvailablePort();
diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart
index 01f0929..b5a5bac 100644
--- a/packages/flutter_tools/lib/src/application_package.dart
+++ b/packages/flutter_tools/lib/src/application_package.dart
@@ -115,13 +115,13 @@
ApplicationPackage getPackageForPlatform(TargetPlatform platform) {
switch (platform) {
- case TargetPlatform.android:
+ case TargetPlatform.android_arm:
return android;
- case TargetPlatform.iOS:
- case TargetPlatform.iOSSimulator:
+ case TargetPlatform.ios_arm:
+ case TargetPlatform.ios_x64:
return iOS;
- case TargetPlatform.mac:
- case TargetPlatform.linux:
+ case TargetPlatform.darwin_x64:
+ case TargetPlatform.linux_x64:
return null;
}
}
@@ -132,7 +132,7 @@
for (BuildConfiguration config in configs) {
switch (config.targetPlatform) {
- case TargetPlatform.android:
+ case TargetPlatform.android_arm:
assert(android == null);
android = AndroidApk.getCustomApk();
// Fall back to the prebuilt or engine-provided apk if we can't build
@@ -145,18 +145,18 @@
android = new AndroidApk(localPath: localPath);
} else {
Artifact artifact = ArtifactStore.getArtifact(
- type: ArtifactType.shell, targetPlatform: TargetPlatform.android);
+ type: ArtifactType.shell, targetPlatform: TargetPlatform.android_arm);
android = new AndroidApk(localPath: await ArtifactStore.getPath(artifact));
}
break;
- case TargetPlatform.iOS:
- case TargetPlatform.iOSSimulator:
+ case TargetPlatform.ios_arm:
+ case TargetPlatform.ios_x64:
iOS ??= new IOSApp.fromBuildConfiguration(config);
break;
- case TargetPlatform.mac:
- case TargetPlatform.linux:
+ case TargetPlatform.darwin_x64:
+ case TargetPlatform.linux_x64:
break;
}
}
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart
index 8fe1586..b1bab87 100644
--- a/packages/flutter_tools/lib/src/artifacts.dart
+++ b/packages/flutter_tools/lib/src/artifacts.dart
@@ -23,15 +23,15 @@
String _getNameForTargetPlatform(TargetPlatform platform) {
switch (platform) {
- case TargetPlatform.android:
+ case TargetPlatform.android_arm:
return 'android-arm';
- case TargetPlatform.iOS:
+ case TargetPlatform.ios_arm:
return 'ios-arm';
- case TargetPlatform.iOSSimulator:
+ case TargetPlatform.ios_x64:
return 'ios-x64';
- case TargetPlatform.mac:
+ case TargetPlatform.darwin_x64:
return 'darwin-x64';
- case TargetPlatform.linux:
+ case TargetPlatform.linux_x64:
return 'linux-x64';
}
}
@@ -77,13 +77,13 @@
name: 'Sky Shell',
fileName: 'SkyShell.apk',
type: ArtifactType.shell,
- targetPlatform: TargetPlatform.android
+ targetPlatform: TargetPlatform.android_arm
),
const Artifact._(
name: 'Sky Shell',
fileName: 'sky_shell',
type: ArtifactType.shell,
- targetPlatform: TargetPlatform.linux
+ targetPlatform: TargetPlatform.linux_x64
),
const Artifact._(
name: 'Sky Snapshot',
@@ -101,37 +101,37 @@
name: 'Flutter for Mojo',
fileName: 'flutter.mojo',
type: ArtifactType.mojo,
- targetPlatform: TargetPlatform.android
+ targetPlatform: TargetPlatform.android_arm
),
const Artifact._(
name: 'Flutter for Mojo',
fileName: 'flutter.mojo',
type: ArtifactType.mojo,
- targetPlatform: TargetPlatform.linux
+ targetPlatform: TargetPlatform.linux_x64
),
const Artifact._(
name: 'Compiled Java code',
fileName: 'classes.dex.jar',
type: ArtifactType.androidClassesJar,
- targetPlatform: TargetPlatform.android
+ targetPlatform: TargetPlatform.android_arm
),
const Artifact._(
name: 'ICU data table',
fileName: 'icudtl.dat',
type: ArtifactType.androidIcuData,
- targetPlatform: TargetPlatform.android
+ targetPlatform: TargetPlatform.android_arm
),
const Artifact._(
name: 'Key Store',
fileName: 'chromium-debug.keystore',
type: ArtifactType.androidKeystore,
- targetPlatform: TargetPlatform.android
+ targetPlatform: TargetPlatform.android_arm
),
const Artifact._(
name: 'Compiled C++ code',
fileName: 'libsky_shell.so',
type: ArtifactType.androidLibSkyShell,
- targetPlatform: TargetPlatform.android
+ targetPlatform: TargetPlatform.android_arm
),
];
diff --git a/packages/flutter_tools/lib/src/base/process.dart b/packages/flutter_tools/lib/src/base/process.dart
index 89ae5a3..46eff71 100644
--- a/packages/flutter_tools/lib/src/base/process.dart
+++ b/packages/flutter_tools/lib/src/base/process.dart
@@ -132,7 +132,7 @@
}
if (results.stdout.trim().isNotEmpty)
printTrace(results.stdout.trim());
- return results.stdout;
+ return results.stdout.trim();
}
class ProcessExit implements Exception {
diff --git a/packages/flutter_tools/lib/src/build_configuration.dart b/packages/flutter_tools/lib/src/build_configuration.dart
index 0dc165f..25c73a5 100644
--- a/packages/flutter_tools/lib/src/build_configuration.dart
+++ b/packages/flutter_tools/lib/src/build_configuration.dart
@@ -20,11 +20,11 @@
}
enum TargetPlatform {
- android,
- iOS,
- iOSSimulator,
- mac,
- linux,
+ android_arm,
+ ios_arm,
+ ios_x64,
+ darwin_x64,
+ linux_x64
}
HostPlatform getCurrentHostPlatform() {
@@ -38,18 +38,17 @@
TargetPlatform getCurrentHostPlatformAsTarget() {
if (Platform.isMacOS)
- return TargetPlatform.mac;
+ return TargetPlatform.darwin_x64;
if (Platform.isLinux)
- return TargetPlatform.linux;
+ return TargetPlatform.linux_x64;
printError('Unsupported host platform, defaulting to Linux');
- return TargetPlatform.linux;
+ return TargetPlatform.linux_x64;
}
class BuildConfiguration {
BuildConfiguration.prebuilt({
this.hostPlatform,
this.targetPlatform,
- this.deviceId,
this.testable: false
}) : type = BuildType.prebuilt, buildDir = null;
@@ -59,7 +58,6 @@
this.targetPlatform,
String enginePath,
String buildPath,
- this.deviceId,
this.testable: false
}) : buildDir = path.normalize(path.join(enginePath, buildPath)) {
assert(type == BuildType.debug || type == BuildType.release);
@@ -69,6 +67,5 @@
final HostPlatform hostPlatform;
final TargetPlatform targetPlatform;
final String buildDir;
- final String deviceId;
final bool testable;
}
diff --git a/packages/flutter_tools/lib/src/commands/apk.dart b/packages/flutter_tools/lib/src/commands/apk.dart
index bfcdde2..43114e8 100644
--- a/packages/flutter_tools/lib/src/commands/apk.dart
+++ b/packages/flutter_tools/lib/src/commands/apk.dart
@@ -226,7 +226,7 @@
];
Iterable<Future<String>> pathFutures = artifactTypes.map(
(ArtifactType type) => ArtifactStore.getPath(ArtifactStore.getArtifact(
- type: type, targetPlatform: TargetPlatform.android)));
+ type: type, targetPlatform: TargetPlatform.android_arm)));
artifactPaths = await Future.wait(pathFutures);
}
@@ -392,7 +392,7 @@
}
BuildConfiguration config = configs.firstWhere(
- (BuildConfiguration bc) => bc.targetPlatform == TargetPlatform.android
+ (BuildConfiguration bc) => bc.targetPlatform == TargetPlatform.android_arm
);
_ApkComponents components = await _findApkComponents(config, enginePath, manifest, resources);
if (components == null) {
diff --git a/packages/flutter_tools/lib/src/commands/run_mojo.dart b/packages/flutter_tools/lib/src/commands/run_mojo.dart
index aa0b437..b3d759b 100644
--- a/packages/flutter_tools/lib/src/commands/run_mojo.dart
+++ b/packages/flutter_tools/lib/src/commands/run_mojo.dart
@@ -71,7 +71,7 @@
BuildConfiguration _getCurrentHostConfig() {
BuildConfiguration result;
TargetPlatform target = argResults['android'] ?
- TargetPlatform.android : getCurrentHostPlatformAsTarget();
+ TargetPlatform.android_arm : getCurrentHostPlatformAsTarget();
for (BuildConfiguration config in buildConfigurations) {
if (config.targetPlatform == target) {
result = config;
@@ -93,7 +93,7 @@
String flutterPath;
if (config == null || config.type == BuildType.prebuilt) {
- TargetPlatform targetPlatform = argResults['android'] ? TargetPlatform.android : TargetPlatform.linux;
+ TargetPlatform targetPlatform = argResults['android'] ? TargetPlatform.android_arm : TargetPlatform.linux_x64;
Artifact artifact = ArtifactStore.getArtifact(type: ArtifactType.mojo, targetPlatform: targetPlatform);
flutterPath = _makePathAbsolute(await ArtifactStore.getPath(artifact));
} else {
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index 746ea60..c50cece 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -47,9 +47,9 @@
return await ArtifactStore.getPath(artifact);
} else {
switch (config.targetPlatform) {
- case TargetPlatform.linux:
+ case TargetPlatform.linux_x64:
return path.join(config.buildDir, 'sky_shell');
- case TargetPlatform.mac:
+ case TargetPlatform.darwin_x64:
return path.join(config.buildDir, 'SkyShell.app', 'Contents', 'MacOS', 'SkyShell');
default:
throw new Exception('Unsupported platform.');
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index 2783296..2408073 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -224,7 +224,7 @@
}
@override
- TargetPlatform get platform => TargetPlatform.iOS;
+ TargetPlatform get platform => TargetPlatform.ios_arm;
DeviceLogReader get logReader {
if (_logReader == null)
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index 5475d59..da2c88e 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -536,7 +536,7 @@
}
@override
- TargetPlatform get platform => TargetPlatform.iOSSimulator;
+ TargetPlatform get platform => TargetPlatform.ios_x64;
DeviceLogReader get logReader {
if (_logReader == null)
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index afe50e0..5351d1c 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -80,7 +80,7 @@
devices = devices.where((Device device) => device.isSupported()).toList();
if (androidOnly)
- devices = devices.where((Device device) => device.platform == TargetPlatform.android).toList();
+ devices = devices.where((Device device) => device.platform == TargetPlatform.android_arm).toList();
if (devices.isEmpty) {
printStatus('No supported devices connected.');
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
index 82ca1c3..b89c9ec 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
@@ -269,14 +269,13 @@
if (enginePath == null) {
configs.add(new BuildConfiguration.prebuilt(
hostPlatform: hostPlatform,
- targetPlatform: TargetPlatform.android,
- deviceId: globalResults['device-id']
+ targetPlatform: TargetPlatform.android_arm
));
if (hostPlatform == HostPlatform.linux) {
configs.add(new BuildConfiguration.prebuilt(
hostPlatform: HostPlatform.linux,
- targetPlatform: TargetPlatform.linux,
+ targetPlatform: TargetPlatform.linux_x64,
testable: true
));
}
@@ -284,14 +283,12 @@
if (hostPlatform == HostPlatform.mac) {
configs.add(new BuildConfiguration.prebuilt(
hostPlatform: HostPlatform.mac,
- targetPlatform: TargetPlatform.iOS,
- deviceId: globalResults['device-id']
+ targetPlatform: TargetPlatform.ios_arm
));
configs.add(new BuildConfiguration.prebuilt(
hostPlatform: HostPlatform.mac,
- targetPlatform: TargetPlatform.iOSSimulator,
- deviceId: globalResults['device-id']
+ targetPlatform: TargetPlatform.ios_x64
));
}
} else {
@@ -305,10 +302,9 @@
configs.add(new BuildConfiguration.local(
type: BuildType.debug,
hostPlatform: hostPlatform,
- targetPlatform: TargetPlatform.android,
+ targetPlatform: TargetPlatform.android_arm,
enginePath: enginePath,
- buildPath: globalResults['android-debug-build-path'],
- deviceId: globalResults['device-id']
+ buildPath: globalResults['android-debug-build-path']
));
configs.add(new BuildConfiguration.local(
@@ -324,19 +320,17 @@
configs.add(new BuildConfiguration.local(
type: BuildType.debug,
hostPlatform: hostPlatform,
- targetPlatform: TargetPlatform.iOS,
+ targetPlatform: TargetPlatform.ios_arm,
enginePath: enginePath,
- buildPath: globalResults['ios-debug-build-path'],
- deviceId: globalResults['device-id']
+ buildPath: globalResults['ios-debug-build-path']
));
configs.add(new BuildConfiguration.local(
type: BuildType.debug,
hostPlatform: hostPlatform,
- targetPlatform: TargetPlatform.iOSSimulator,
+ targetPlatform: TargetPlatform.ios_x64,
enginePath: enginePath,
- buildPath: globalResults['ios-sim-debug-build-path'],
- deviceId: globalResults['device-id']
+ buildPath: globalResults['ios-sim-debug-build-path']
));
}
}
@@ -345,10 +339,9 @@
configs.add(new BuildConfiguration.local(
type: BuildType.release,
hostPlatform: hostPlatform,
- targetPlatform: TargetPlatform.android,
+ targetPlatform: TargetPlatform.android_arm,
enginePath: enginePath,
- buildPath: globalResults['android-release-build-path'],
- deviceId: globalResults['device-id']
+ buildPath: globalResults['android-release-build-path']
));
configs.add(new BuildConfiguration.local(
@@ -364,19 +357,17 @@
configs.add(new BuildConfiguration.local(
type: BuildType.release,
hostPlatform: hostPlatform,
- targetPlatform: TargetPlatform.iOS,
+ targetPlatform: TargetPlatform.ios_arm,
enginePath: enginePath,
- buildPath: globalResults['ios-release-build-path'],
- deviceId: globalResults['device-id']
+ buildPath: globalResults['ios-release-build-path']
));
configs.add(new BuildConfiguration.local(
type: BuildType.release,
hostPlatform: hostPlatform,
- targetPlatform: TargetPlatform.iOSSimulator,
+ targetPlatform: TargetPlatform.ios_x64,
enginePath: enginePath,
- buildPath: globalResults['ios-sim-release-build-path'],
- deviceId: globalResults['device-id']
+ buildPath: globalResults['ios-sim-release-build-path']
));
}
}