Commit 7e8b111b authored by Adam Barth's avatar Adam Barth

Search all the build configurations for sky_snapshot

Previously, we assumed the first build configuration would have one. Now we
keep looking until we find one. Also, re-ordered the configurations so that
you'll get the Android one if you have both, which is probably what you would
expect.

Fixes #100
parent aafce51e
...@@ -195,19 +195,19 @@ class FlutterCommandRunner extends CommandRunner { ...@@ -195,19 +195,19 @@ class FlutterCommandRunner extends CommandRunner {
configs.add(new BuildConfiguration.local( configs.add(new BuildConfiguration.local(
type: BuildType.debug, type: BuildType.debug,
hostPlatform: hostPlatform, hostPlatform: hostPlatform,
targetPlatform: hostPlatformAsTarget, targetPlatform: TargetPlatform.android,
enginePath: enginePath, enginePath: enginePath,
buildPath: globalResults['host-debug-build-path'], buildPath: globalResults['android-debug-build-path'],
testable: true deviceId: globalResults['android-device-id']
)); ));
configs.add(new BuildConfiguration.local( configs.add(new BuildConfiguration.local(
type: BuildType.debug, type: BuildType.debug,
hostPlatform: hostPlatform, hostPlatform: hostPlatform,
targetPlatform: TargetPlatform.android, targetPlatform: hostPlatformAsTarget,
enginePath: enginePath, enginePath: enginePath,
buildPath: globalResults['android-debug-build-path'], buildPath: globalResults['host-debug-build-path'],
deviceId: globalResults['android-device-id'] testable: true
)); ));
if (Platform.isMacOS) { if (Platform.isMacOS) {
...@@ -233,19 +233,19 @@ class FlutterCommandRunner extends CommandRunner { ...@@ -233,19 +233,19 @@ class FlutterCommandRunner extends CommandRunner {
configs.add(new BuildConfiguration.local( configs.add(new BuildConfiguration.local(
type: BuildType.release, type: BuildType.release,
hostPlatform: hostPlatform, hostPlatform: hostPlatform,
targetPlatform: hostPlatformAsTarget, targetPlatform: TargetPlatform.android,
enginePath: enginePath, enginePath: enginePath,
buildPath: globalResults['host-release-build-path'], buildPath: globalResults['android-release-build-path'],
testable: true deviceId: globalResults['android-device-id']
)); ));
configs.add(new BuildConfiguration.local( configs.add(new BuildConfiguration.local(
type: BuildType.release, type: BuildType.release,
hostPlatform: hostPlatform, hostPlatform: hostPlatform,
targetPlatform: TargetPlatform.android, targetPlatform: hostPlatformAsTarget,
enginePath: enginePath, enginePath: enginePath,
buildPath: globalResults['android-release-build-path'], buildPath: globalResults['host-release-build-path'],
deviceId: globalResults['android-device-id'] testable: true
)); ));
if (Platform.isMacOS) { if (Platform.isMacOS) {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
...@@ -29,8 +30,12 @@ class Compiler { ...@@ -29,8 +30,12 @@ class Compiler {
} }
Future<String> _getCompilerPath(BuildConfiguration config) async { Future<String> _getCompilerPath(BuildConfiguration config) async {
if (config.type != BuildType.prebuilt) if (config.type != BuildType.prebuilt) {
return path.join(config.buildDir, 'clang_x64', 'sky_snapshot'); String compilerPath = path.join(config.buildDir, 'clang_x64', 'sky_snapshot');
if (FileSystemEntity.isFileSync(compilerPath))
return compilerPath;
return null;
}
Artifact artifact = ArtifactStore.getArtifact( Artifact artifact = ArtifactStore.getArtifact(
type: ArtifactType.snapshot, hostPlatform: config.hostPlatform); type: ArtifactType.snapshot, hostPlatform: config.hostPlatform);
return await ArtifactStore.getPath(artifact); return await ArtifactStore.getPath(artifact);
...@@ -42,8 +47,11 @@ class Toolchain { ...@@ -42,8 +47,11 @@ class Toolchain {
final Compiler compiler; final Compiler compiler;
static Future<Toolchain> forConfigs(List<BuildConfiguration> configs) async { static Future<Toolchain> forConfigs(List<BuildConfiguration> configs) async {
// TODO(abarth): Shouldn't we consider all the configs? for (BuildConfiguration config in configs) {
String compilerPath = await _getCompilerPath(configs.first); String compilerPath = await _getCompilerPath(config);
return new Toolchain(compiler: new Compiler(compilerPath)); if (compilerPath != null)
return new Toolchain(compiler: new Compiler(compilerPath));
}
return null;
} }
} }
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