diff --git a/packages/flutter_tools/lib/src/commands/flutter_command_runner.dart b/packages/flutter_tools/lib/src/commands/flutter_command_runner.dart index ee1760836df..ecd69a8748e 100644 --- a/packages/flutter_tools/lib/src/commands/flutter_command_runner.dart +++ b/packages/flutter_tools/lib/src/commands/flutter_command_runner.dart @@ -195,19 +195,19 @@ class FlutterCommandRunner extends CommandRunner { configs.add(new BuildConfiguration.local( type: BuildType.debug, hostPlatform: hostPlatform, - targetPlatform: hostPlatformAsTarget, + targetPlatform: TargetPlatform.android, enginePath: enginePath, - buildPath: globalResults['host-debug-build-path'], - testable: true + buildPath: globalResults['android-debug-build-path'], + deviceId: globalResults['android-device-id'] )); configs.add(new BuildConfiguration.local( type: BuildType.debug, hostPlatform: hostPlatform, - targetPlatform: TargetPlatform.android, + targetPlatform: hostPlatformAsTarget, enginePath: enginePath, - buildPath: globalResults['android-debug-build-path'], - deviceId: globalResults['android-device-id'] + buildPath: globalResults['host-debug-build-path'], + testable: true )); if (Platform.isMacOS) { @@ -233,19 +233,19 @@ class FlutterCommandRunner extends CommandRunner { configs.add(new BuildConfiguration.local( type: BuildType.release, hostPlatform: hostPlatform, - targetPlatform: hostPlatformAsTarget, + targetPlatform: TargetPlatform.android, enginePath: enginePath, - buildPath: globalResults['host-release-build-path'], - testable: true + buildPath: globalResults['android-release-build-path'], + deviceId: globalResults['android-device-id'] )); configs.add(new BuildConfiguration.local( type: BuildType.release, hostPlatform: hostPlatform, - targetPlatform: TargetPlatform.android, + targetPlatform: hostPlatformAsTarget, enginePath: enginePath, - buildPath: globalResults['android-release-build-path'], - deviceId: globalResults['android-device-id'] + buildPath: globalResults['host-release-build-path'], + testable: true )); if (Platform.isMacOS) { diff --git a/packages/flutter_tools/lib/src/toolchain.dart b/packages/flutter_tools/lib/src/toolchain.dart index 34301ec9ae3..e88ac6b82d6 100644 --- a/packages/flutter_tools/lib/src/toolchain.dart +++ b/packages/flutter_tools/lib/src/toolchain.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:async'; +import 'dart:io'; import 'package:path/path.dart' as path; @@ -29,8 +30,12 @@ class Compiler { } Future _getCompilerPath(BuildConfiguration config) async { - if (config.type != BuildType.prebuilt) - return path.join(config.buildDir, 'clang_x64', 'sky_snapshot'); + if (config.type != BuildType.prebuilt) { + String compilerPath = path.join(config.buildDir, 'clang_x64', 'sky_snapshot'); + if (FileSystemEntity.isFileSync(compilerPath)) + return compilerPath; + return null; + } Artifact artifact = ArtifactStore.getArtifact( type: ArtifactType.snapshot, hostPlatform: config.hostPlatform); return await ArtifactStore.getPath(artifact); @@ -42,8 +47,11 @@ class Toolchain { final Compiler compiler; static Future forConfigs(List configs) async { - // TODO(abarth): Shouldn't we consider all the configs? - String compilerPath = await _getCompilerPath(configs.first); - return new Toolchain(compiler: new Compiler(compilerPath)); + for (BuildConfiguration config in configs) { + String compilerPath = await _getCompilerPath(config); + if (compilerPath != null) + return new Toolchain(compiler: new Compiler(compilerPath)); + } + return null; } }