Remove BuildConfigurations (#3879)

Artifacts from local engine builds will be found based on the --local-engine flag
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index 62b63cb..8086024 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -10,7 +10,7 @@
 import '../application_package.dart';
 import '../base/os.dart';
 import '../base/process.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../device.dart';
 import '../flx.dart' as flx;
 import '../globals.dart';
diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart
index f4154eb..624ed13 100644
--- a/packages/flutter_tools/lib/src/application_package.dart
+++ b/packages/flutter_tools/lib/src/application_package.dart
@@ -7,7 +7,7 @@
 import 'package:path/path.dart' as path;
 import 'package:xml/xml.dart' as xml;
 
-import 'build_configuration.dart';
+import 'build_info.dart';
 import 'ios/plist_utils.dart';
 
 abstract class ApplicationPackage {
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart
index 7d7819f..6d484d6 100644
--- a/packages/flutter_tools/lib/src/artifacts.dart
+++ b/packages/flutter_tools/lib/src/artifacts.dart
@@ -6,7 +6,7 @@
 
 import 'package:path/path.dart' as path;
 
-import 'build_configuration.dart';
+import 'build_info.dart';
 import 'globals.dart';
 
 enum ArtifactType {
diff --git a/packages/flutter_tools/lib/src/build_configuration.dart b/packages/flutter_tools/lib/src/build_info.dart
similarity index 64%
rename from packages/flutter_tools/lib/src/build_configuration.dart
rename to packages/flutter_tools/lib/src/build_info.dart
index 3615ae2..3224a61 100644
--- a/packages/flutter_tools/lib/src/build_configuration.dart
+++ b/packages/flutter_tools/lib/src/build_info.dart
@@ -4,8 +4,6 @@
 
 import 'dart:io';
 
-import 'package:path/path.dart' as path;
-
 import 'base/utils.dart';
 import 'globals.dart';
 
@@ -81,37 +79,3 @@
 
   return HostPlatform.linux_x64;
 }
-
-TargetPlatform getCurrentHostPlatformAsTarget() {
-  if (Platform.isMacOS)
-    return TargetPlatform.darwin_x64;
-  if (Platform.isLinux)
-    return TargetPlatform.linux_x64;
-  printError('Unsupported host platform, defaulting to Linux');
-  return TargetPlatform.linux_x64;
-}
-
-class BuildConfiguration {
-  BuildConfiguration.prebuilt({
-    this.hostPlatform,
-    this.targetPlatform,
-    this.testable: false
-  }) : type = BuildType.prebuilt, buildDir = null;
-
-  BuildConfiguration.local({
-    this.type,
-    this.hostPlatform,
-    this.targetPlatform,
-    String enginePath,
-    String buildPath,
-    this.testable: false
-  }) : buildDir = path.normalize(path.join(enginePath, buildPath)) {
-    assert(type == BuildType.debug || type == BuildType.release);
-  }
-
-  final BuildType type;
-  final HostPlatform hostPlatform;
-  final TargetPlatform targetPlatform;
-  final String buildDir;
-  final bool testable;
-}
diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart
index 6c74e77..c286e65 100644
--- a/packages/flutter_tools/lib/src/commands/analyze.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze.dart
@@ -12,7 +12,6 @@
 
 import '../artifacts.dart';
 import '../base/utils.dart';
-import '../build_configuration.dart';
 import '../dart/analysis.dart';
 import '../dart/sdk.dart';
 import '../globals.dart';
@@ -181,10 +180,9 @@
     Map<String, String> packages = dependencies.asPackageMap();
 
     // override the sky_engine and sky_services packages if the user is using a local build
-    String buildDir = buildConfigurations.firstWhere((BuildConfiguration config) => config.testable, orElse: () => null)?.buildDir;
-    if (buildDir != null) {
-      packages['sky_engine'] = path.join(buildDir, 'gen/dart-pkg/sky_engine/lib');
-      packages['sky_services'] = path.join(buildDir, 'gen/dart-pkg/sky_services/lib');
+    if (tools.engineBuildPath != null) {
+      packages['sky_engine'] = path.join(tools.engineBuildPath, 'gen/dart-pkg/sky_engine/lib');
+      packages['sky_services'] = path.join(tools.engineBuildPath, 'gen/dart-pkg/sky_services/lib');
     }
 
     if (argResults['preamble']) {
diff --git a/packages/flutter_tools/lib/src/commands/build_aot.dart b/packages/flutter_tools/lib/src/commands/build_aot.dart
index df010a3..e267b10 100644
--- a/packages/flutter_tools/lib/src/commands/build_aot.dart
+++ b/packages/flutter_tools/lib/src/commands/build_aot.dart
@@ -8,7 +8,7 @@
 import 'package:path/path.dart' as path;
 
 import '../base/process.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../globals.dart';
 import '../runner/flutter_command.dart';
 import 'run.dart';
@@ -132,7 +132,7 @@
     '--no-sim-use-hardfp',
   ];
 
-  if (!(tools.engineRelease || buildMode == BuildMode.release)) {
+  if (buildMode != BuildMode.release) {
     genSnapshotCmd.addAll(<String>[
       '--no-checked',
       '--conditional_directives',
diff --git a/packages/flutter_tools/lib/src/commands/build_apk.dart b/packages/flutter_tools/lib/src/commands/build_apk.dart
index 92e92f0..132f2b2 100644
--- a/packages/flutter_tools/lib/src/commands/build_apk.dart
+++ b/packages/flutter_tools/lib/src/commands/build_apk.dart
@@ -12,7 +12,7 @@
 import '../base/os.dart';
 import '../base/process.dart';
 import '../base/utils.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../flx.dart' as flx;
 import '../globals.dart';
 import '../runner/flutter_command.dart';
diff --git a/packages/flutter_tools/lib/src/commands/build_ios.dart b/packages/flutter_tools/lib/src/commands/build_ios.dart
index a606b1d..df1fe21 100644
--- a/packages/flutter_tools/lib/src/commands/build_ios.dart
+++ b/packages/flutter_tools/lib/src/commands/build_ios.dart
@@ -5,7 +5,7 @@
 import 'dart:async';
 
 import '../application_package.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../globals.dart';
 import '../ios/mac.dart';
 import '../runner/flutter_command.dart';
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart
index c333cec..c54ba53 100644
--- a/packages/flutter_tools/lib/src/commands/daemon.dart
+++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -10,7 +10,7 @@
 import '../application_package.dart';
 import '../base/context.dart';
 import '../base/logger.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../device.dart';
 import '../globals.dart';
 import '../ios/devices.dart';
diff --git a/packages/flutter_tools/lib/src/commands/drive.dart b/packages/flutter_tools/lib/src/commands/drive.dart
index 4614af3..37745ac 100644
--- a/packages/flutter_tools/lib/src/commands/drive.dart
+++ b/packages/flutter_tools/lib/src/commands/drive.dart
@@ -13,7 +13,7 @@
 import '../base/file_system.dart';
 import '../base/common.dart';
 import '../base/os.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../device.dart';
 import '../globals.dart';
 import '../ios/simulators.dart' show SimControl, IOSSimulatorUtils;
diff --git a/packages/flutter_tools/lib/src/commands/listen.dart b/packages/flutter_tools/lib/src/commands/listen.dart
index a578b50..d58e633 100644
--- a/packages/flutter_tools/lib/src/commands/listen.dart
+++ b/packages/flutter_tools/lib/src/commands/listen.dart
@@ -8,7 +8,7 @@
 import '../base/os.dart';
 import '../base/process.dart';
 import '../device.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../globals.dart';
 import 'run.dart';
 
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index a23aa3e..a1fe71b 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -11,7 +11,7 @@
 import '../application_package.dart';
 import '../base/common.dart';
 import '../base/logger.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../device.dart';
 import '../globals.dart';
 import '../runner/flutter_command.dart';
diff --git a/packages/flutter_tools/lib/src/commands/run_mojo.dart b/packages/flutter_tools/lib/src/commands/run_mojo.dart
index b9fb227..b3cc0bb 100644
--- a/packages/flutter_tools/lib/src/commands/run_mojo.dart
+++ b/packages/flutter_tools/lib/src/commands/run_mojo.dart
@@ -7,9 +7,8 @@
 
 import 'package:path/path.dart' as path;
 
-import '../artifacts.dart';
 import '../base/process.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../flx.dart' as flx;
 import '../globals.dart';
 import '../runner/flutter_command.dart';
@@ -73,19 +72,6 @@
     return _makePathAbsolute(path.join(argResults['mojo-path'], 'out', mojoBuildType, 'mojo_shell'));
   }
 
-  BuildConfiguration _getCurrentHostConfig() {
-    BuildConfiguration result;
-    TargetPlatform target = argResults['android'] ?
-      TargetPlatform.android_arm : getCurrentHostPlatformAsTarget();
-    for (BuildConfiguration config in buildConfigurations) {
-      if (config.targetPlatform == target) {
-        result = config;
-        break;
-      }
-    }
-    return result;
-  }
-
   Future<List<String>> _getShellConfig(String targetApp) async {
     List<String> args = <String>[];
 
@@ -93,17 +79,8 @@
     final String command = useDevtools ? _getDevtoolsPath() : _getMojoShellPath();
     args.add(command);
 
-    BuildConfiguration config = _getCurrentHostConfig();
-
-    String flutterPath;
-    if (config == null || config.type == BuildType.prebuilt) {
-      TargetPlatform targetPlatform = argResults['android'] ? TargetPlatform.android_arm : TargetPlatform.linux_x64;
-      Artifact artifact = ArtifactStore.getArtifact(type: ArtifactType.mojo, targetPlatform: targetPlatform);
-      flutterPath = _makePathAbsolute(ArtifactStore.getPath(artifact));
-    } else {
-      String localPath = path.join(config.buildDir, 'flutter.mojo');
-      flutterPath = _makePathAbsolute(localPath);
-    }
+    TargetPlatform targetPlatform = argResults['android'] ? TargetPlatform.android_arm : TargetPlatform.linux_x64;
+    String flutterPath = path.join(tools.getEngineArtifactsDirectory(targetPlatform, BuildMode.debug).path, 'flutter.mojo');
 
     if (argResults['android'])
       args.add('--android');
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index e9d6fff..35035ec 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -8,11 +8,10 @@
 import 'package:path/path.dart' as path;
 import 'package:test/src/executable.dart' as executable; // ignore: implementation_imports
 
-import '../artifacts.dart';
-import '../build_configuration.dart';
 import '../globals.dart';
 import '../runner/flutter_command.dart';
 import '../test/flutter_platform.dart' as loader;
+import '../toolchain.dart';
 
 class TestCommand extends FlutterCommand {
   TestCommand() {
@@ -41,23 +40,6 @@
     return true;
   };
 
-  Future<String> _getShellPath(BuildConfiguration config) async {
-    if (config.type == BuildType.prebuilt) {
-      Artifact artifact = ArtifactStore.getArtifact(
-        type: ArtifactType.shell, targetPlatform: config.targetPlatform);
-      return ArtifactStore.getPath(artifact);
-    } else {
-      switch (config.targetPlatform) {
-        case TargetPlatform.linux_x64:
-          return path.join(config.buildDir, 'sky_shell');
-        case TargetPlatform.darwin_x64:
-          return path.join(config.buildDir, 'SkyShell.app', 'Contents', 'MacOS', 'SkyShell');
-        default:
-          throw new Exception('Unsupported platform.');
-      }
-    }
-  }
-
   Iterable<String> _findTests(Directory directory) {
     return directory.listSync(recursive: true, followLinks: false)
                     .where((FileSystemEntity entity) => entity.path.endsWith('_test.dart') &&
@@ -102,27 +84,13 @@
     testArgs.insert(0, '--');
     if (Platform.environment['TERM'] == 'dumb')
       testArgs.insert(0, '--no-color');
-    List<BuildConfiguration> configs = buildConfigurations;
-    bool foundOne = false;
+
     loader.installHook();
-    for (BuildConfiguration config in configs) {
-      if (!config.testable)
-        continue;
-      foundOne = true;
-      loader.shellPath = path.absolute(await _getShellPath(config));
-      if (!FileSystemEntity.isFileSync(loader.shellPath)) {
-          printError('Cannot find Flutter shell at ${loader.shellPath}');
-        return 1;
-      }
-      await _runTests(testArgs, testDir);
-      if (exitCode != 0)
-        return exitCode;
-    }
-    if (!foundOne) {
-      printError('At least one of --engine-debug or --engine-release must be set, to specify the local build products to test.');
+    loader.shellPath = tools.getHostToolPath(HostTool.SkyShell);
+    if (!FileSystemEntity.isFileSync(loader.shellPath)) {
+        printError('Cannot find Flutter shell at ${loader.shellPath}');
       return 1;
     }
-
-    return 0;
+    return await _runTests(testArgs, testDir);
   }
 }
diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart
index 2ab2a1e..ce443ca 100644
--- a/packages/flutter_tools/lib/src/device.dart
+++ b/packages/flutter_tools/lib/src/device.dart
@@ -14,7 +14,7 @@
 import 'base/common.dart';
 import 'base/os.dart';
 import 'base/utils.dart';
-import 'build_configuration.dart';
+import 'build_info.dart';
 import 'globals.dart';
 import 'ios/devices.dart';
 import 'ios/simulators.dart';
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index d64fe0e..3fa0609 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -11,7 +11,7 @@
 import '../application_package.dart';
 import '../base/os.dart';
 import '../base/process.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../device.dart';
 import '../globals.dart';
 import 'mac.dart';
diff --git a/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart b/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
index e8d68b1..71a2eda 100644
--- a/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
+++ b/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
@@ -9,7 +9,7 @@
 
 import '../artifacts.dart';
 import '../base/process.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../globals.dart';
 import '../runner/flutter_command_runner.dart';
 
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index 3f289cc..2494cc9 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -11,7 +11,7 @@
 import '../application_package.dart';
 import '../base/context.dart';
 import '../base/process.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../device.dart';
 import '../flx.dart' as flx;
 import '../globals.dart';
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index 68f86de..0bb2226 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -8,7 +8,7 @@
 import 'package:args/command_runner.dart';
 
 import '../application_package.dart';
-import '../build_configuration.dart';
+import '../build_info.dart';
 import '../dart/pub.dart';
 import '../device.dart';
 import '../flx.dart' as flx;
@@ -43,8 +43,6 @@
 
   bool get shouldRunPub => _usesPubOption && argResults['pub'];
 
-  List<BuildConfiguration> get buildConfigurations => runner.buildConfigurations;
-
   void usesTargetOption() {
     argParser.addOption('target',
       abbr: 't',
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 5850069..a606342 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
@@ -14,7 +14,6 @@
 import '../base/context.dart';
 import '../base/logger.dart';
 import '../base/process.dart';
-import '../build_configuration.dart';
 import '../globals.dart';
 import '../package_map.dart';
 import '../toolchain.dart';
@@ -61,20 +60,7 @@
     if (verboseHelp)
       argParser.addSeparator('Local build selection options (not normally required):');
 
-    argParser.addFlag('engine-debug',
-        negatable: false,
-        hide: !verboseHelp,
-        help:
-            'Set this if you are building Flutter locally and want to use the debug build products.\n'
-            'Defaults to true if --engine-src-path is specified and --engine-release is not, otherwise false.');
-    argParser.addFlag('engine-release',
-        negatable: false,
-        hide: !verboseHelp,
-        help:
-            'Set this if you are building Flutter locally and want to use the release build products.\n'
-            'The --engine-release option is not compatible with the listen command on iOS devices and simulators.');
-
-    argParser.addOption('engine-src-path',
+    argParser.addOption('local-engine-src-path',
         hide: !verboseHelp,
         help:
             'Path to your engine src directory, if you are building Flutter locally.\n'
@@ -87,59 +73,7 @@
         help:
             'Name of a build output within the engine out directory, if you are building Flutter locally.\n'
             'Use this to select a specific version of the engine if you have built multiple engine targets.\n'
-            'This path is relative to --engine-src-path/out.');
-
-    argParser.addOption('host-debug-build-path',
-        hide: !verboseHelp,
-        help:
-            'Path to your host Debug out directory (i.e. the one that runs on your workstation, not a device),\n'
-            'if you are building Flutter locally.\n'
-            'This path is relative to --engine-src-path. Not normally required.',
-        defaultsTo: 'out/host_debug_unopt/');
-    argParser.addOption('host-release-build-path',
-        hide: !verboseHelp,
-        help:
-            'Path to your host Release out directory (i.e. the one that runs on your workstation, not a device),\n'
-            'if you are building Flutter locally.\n'
-            'This path is relative to --engine-src-path. Not normally required.',
-        defaultsTo: 'out/host_debug/');
-
-    argParser.addOption('android-debug-build-path',
-        hide: !verboseHelp,
-        help:
-            'Path to your Android Debug out directory, if you are building Flutter locally.\n'
-            'This path is relative to --engine-src-path. Not normally required.',
-        defaultsTo: 'out/android_debug_unopt/');
-    argParser.addOption('android-release-build-path',
-        hide: !verboseHelp,
-        help:
-            'Path to your Android Release out directory, if you are building Flutter locally.\n'
-            'This path is relative to --engine-src-path. Not normally required.',
-        defaultsTo: 'out/android_debug/');
-    argParser.addOption('ios-debug-build-path',
-        hide: !verboseHelp,
-        help:
-            'Path to your iOS Debug out directory, if you are building Flutter locally.\n'
-            'This path is relative to --engine-src-path. Not normally required.',
-        defaultsTo: 'out/ios_Debug/');
-    argParser.addOption('ios-release-build-path',
-        hide: !verboseHelp,
-        help:
-            'Path to your iOS Release out directory, if you are building Flutter locally.\n'
-            'This path is relative to --engine-src-path. Not normally required.',
-        defaultsTo: 'out/ios_Release/');
-    argParser.addOption('ios-sim-debug-build-path',
-        hide: !verboseHelp,
-        help:
-            'Path to your iOS Simulator Debug out directory, if you are building Flutter locally.\n'
-            'This path is relative to --engine-src-path. Not normally required.',
-        defaultsTo: 'out/ios_sim_Debug/');
-    argParser.addOption('ios-sim-release-build-path',
-        hide: !verboseHelp,
-        help:
-            'Path to your iOS Simulator Release out directory, if you are building Flutter locally.\n'
-            'This path is relative to --engine-src-path. Not normally required.',
-        defaultsTo: 'out/ios_sim_Release/');
+            'This path is relative to --local-engine-src-path/out.');
   }
 
   @override
@@ -147,22 +81,6 @@
     return 'Run "flutter -h -v" for verbose help output, including less commonly used options.';
   }
 
-  List<BuildConfiguration> get buildConfigurations {
-    if (_buildConfigurations == null)
-      _buildConfigurations = _createBuildConfigurations(_globalResults);
-    return _buildConfigurations;
-  }
-  List<BuildConfiguration> _buildConfigurations;
-
-  String get enginePath {
-    assert(ArtifactStore.flutterRoot != null);
-    _enginePath ??= _findEnginePath(_globalResults);
-    return _enginePath;
-  }
-  String _enginePath;
-
-  ArgResults _globalResults;
-
   static String get _defaultFlutterRoot {
     if (Platform.environment.containsKey(kFlutterRootEnvironmentVariableName))
       return Platform.environment[kFlutterRootEnvironmentVariableName];
@@ -203,8 +121,6 @@
 
   @override
   Future<int> runCommand(ArgResults globalResults) {
-    _globalResults = globalResults;
-
     // Check for verbose.
     if (globalResults['verbose'])
       context[Logger] = new VerboseLogger();
@@ -226,14 +142,10 @@
     deviceManager.specifiedDeviceId = globalResults['device-id'];
 
     // Set up the tooling configuration.
+    String enginePath = _findEnginePath(globalResults);
     if (enginePath != null) {
       ToolConfiguration.instance.engineSrcPath = enginePath;
       ToolConfiguration.instance.engineBuildPath = _findEngineBuildPath(globalResults, enginePath);
-
-      if (globalResults.wasParsed('engine-release'))
-        ToolConfiguration.instance.engineRelease = globalResults['engine-release'];
-      if (globalResults.wasParsed('engine-debug'))
-        ToolConfiguration.instance.engineRelease = !globalResults['engine-debug'];
     }
 
     // The Android SDK could already have been set by tests.
@@ -261,11 +173,9 @@
   }
 
   String _findEnginePath(ArgResults globalResults) {
-    String engineSourcePath = globalResults['engine-src-path'] ?? Platform.environment[kFlutterEngineEnvironmentVariableName];
-    bool isDebug = globalResults['engine-debug'];
-    bool isRelease = globalResults['engine-release'];
+    String engineSourcePath = globalResults['local-engine-src-path'] ?? Platform.environment[kFlutterEngineEnvironmentVariableName];
 
-    if (engineSourcePath == null && (isDebug || isRelease)) {
+    if (engineSourcePath == null && globalResults['local-engine'] != null) {
       try {
         Uri engineUri = PackageMap.instance.map[kFlutterEnginePackageName];
         engineSourcePath = path.dirname(path.dirname(path.dirname(path.dirname(engineUri.path))));
@@ -281,7 +191,7 @@
         printError('Unable to detect local Flutter engine build directory.\n'
             'Either specify a dependency_override for the $kFlutterEnginePackageName package in your pubspec.yaml and\n'
             'ensure --package-root is set if necessary, or set the \$$kFlutterEngineEnvironmentVariableName environment variable, or\n'
-            'use --engine-src-path to specify the path to the root of your flutter/engine repository.');
+            'use --local-engine-src-path to specify the path to the root of your flutter/engine repository.');
         throw new ProcessExit(2);
       }
     }
@@ -301,19 +211,8 @@
     if (globalResults['local-engine'] != null) {
       localEngine = globalResults['local-engine'];
     } else {
-      // This is a temporary hack to find an engine build in the same way that we found the toolchain.
-      // TODO(jsimmons): delete this and make --local-engine mandatory when BuildConfigurations are removed.
-      for (BuildConfiguration config in buildConfigurations) {
-        if (FileSystemEntity.isDirectorySync(config.buildDir)) {
-          localEngine = path.basename(config.buildDir);
-          break;
-        }
-      }
-
-      if (localEngine == null) {
-        printError('You must specify --local-engine if you are using a locally built engine.');
-        throw new ProcessExit(2);
-      }
+      printError('You must specify --local-engine if you are using a locally built engine.');
+      throw new ProcessExit(2);
     }
 
     String engineBuildPath = path.join(enginePath, 'out', localEngine);
@@ -325,124 +224,6 @@
     return engineBuildPath;
   }
 
-  List<BuildConfiguration> _createBuildConfigurations(ArgResults globalResults) {
-    bool isDebug = globalResults['engine-debug'];
-    bool isRelease = globalResults['engine-release'];
-    HostPlatform hostPlatform = getCurrentHostPlatform();
-    TargetPlatform hostPlatformAsTarget = getCurrentHostPlatformAsTarget();
-
-    List<BuildConfiguration> configs = <BuildConfiguration>[];
-
-    if (enginePath == null) {
-      configs.add(new BuildConfiguration.prebuilt(
-        hostPlatform: hostPlatform,
-        targetPlatform: TargetPlatform.android_arm
-      ));
-
-      configs.add(new BuildConfiguration.prebuilt(
-        hostPlatform: hostPlatform,
-        targetPlatform: TargetPlatform.android_x64
-      ));
-
-      if (hostPlatform == HostPlatform.linux_x64) {
-        configs.add(new BuildConfiguration.prebuilt(
-          hostPlatform: HostPlatform.linux_x64,
-          targetPlatform: TargetPlatform.linux_x64,
-          testable: true
-        ));
-      }
-
-      if (hostPlatform == HostPlatform.darwin_x64) {
-        configs.add(new BuildConfiguration.prebuilt(
-          hostPlatform: HostPlatform.darwin_x64,
-          targetPlatform: TargetPlatform.ios
-        ));
-      }
-    } else {
-      if (!FileSystemEntity.isDirectorySync(enginePath))
-        printError('$enginePath is not a valid directory');
-
-      if (!isDebug && !isRelease)
-        isDebug = true;
-
-      if (isDebug) {
-        configs.add(new BuildConfiguration.local(
-          type: BuildType.debug,
-          hostPlatform: hostPlatform,
-          targetPlatform: TargetPlatform.android_arm,
-          enginePath: enginePath,
-          buildPath: globalResults['android-debug-build-path']
-        ));
-
-        configs.add(new BuildConfiguration.local(
-          type: BuildType.debug,
-          hostPlatform: hostPlatform,
-          targetPlatform: hostPlatformAsTarget,
-          enginePath: enginePath,
-          buildPath: globalResults['host-debug-build-path'],
-          testable: true
-        ));
-
-        if (Platform.isMacOS) {
-          configs.add(new BuildConfiguration.local(
-            type: BuildType.debug,
-            hostPlatform: hostPlatform,
-            targetPlatform: TargetPlatform.ios,
-            enginePath: enginePath,
-            buildPath: globalResults['ios-debug-build-path']
-          ));
-
-          configs.add(new BuildConfiguration.local(
-            type: BuildType.debug,
-            hostPlatform: hostPlatform,
-            targetPlatform: TargetPlatform.ios,
-            enginePath: enginePath,
-            buildPath: globalResults['ios-sim-debug-build-path']
-          ));
-        }
-      }
-
-      if (isRelease) {
-        configs.add(new BuildConfiguration.local(
-          type: BuildType.release,
-          hostPlatform: hostPlatform,
-          targetPlatform: TargetPlatform.android_arm,
-          enginePath: enginePath,
-          buildPath: globalResults['android-release-build-path']
-        ));
-
-        configs.add(new BuildConfiguration.local(
-          type: BuildType.release,
-          hostPlatform: hostPlatform,
-          targetPlatform: hostPlatformAsTarget,
-          enginePath: enginePath,
-          buildPath: globalResults['host-release-build-path'],
-          testable: true
-        ));
-
-        if (Platform.isMacOS) {
-          configs.add(new BuildConfiguration.local(
-            type: BuildType.release,
-            hostPlatform: hostPlatform,
-            targetPlatform: TargetPlatform.ios,
-            enginePath: enginePath,
-            buildPath: globalResults['ios-release-build-path']
-          ));
-
-          configs.add(new BuildConfiguration.local(
-            type: BuildType.release,
-            hostPlatform: hostPlatform,
-            targetPlatform: TargetPlatform.ios,
-            enginePath: enginePath,
-            buildPath: globalResults['ios-sim-release-build-path']
-          ));
-        }
-      }
-    }
-
-    return configs;
-  }
-
   static void initFlutterRoot() {
     if (ArtifactStore.flutterRoot == null)
       ArtifactStore.flutterRoot = _defaultFlutterRoot;
diff --git a/packages/flutter_tools/lib/src/toolchain.dart b/packages/flutter_tools/lib/src/toolchain.dart
index 28847640..61539e6 100644
--- a/packages/flutter_tools/lib/src/toolchain.dart
+++ b/packages/flutter_tools/lib/src/toolchain.dart
@@ -7,14 +7,20 @@
 import 'package:path/path.dart' as path;
 
 import 'base/context.dart';
-import 'build_configuration.dart';
+import 'build_info.dart';
 import 'cache.dart';
 import 'globals.dart';
 
 enum HostTool {
   SkySnapshot,
+  SkyShell,
 }
 
+const Map<HostTool, String> _kHostToolFileName = const <HostTool, String>{
+  HostTool.SkySnapshot: 'sky_snapshot',
+  HostTool.SkyShell: 'sky_shell',
+};
+
 /// A ToolConfiguration can return the tools directory for the current host platform
 /// and the engine artifact directory for a given target platform. It is configurable
 /// via command-line arguments in order to support local engine builds.
@@ -38,9 +44,6 @@
   /// Path to a local engine build acting as a source for artifacts (--local-engine).
   String engineBuildPath;
 
-  /// The engine mode to use (only relevent when [engineSrcPath] is set).
-  bool engineRelease;
-
   bool get isLocalEngine => engineSrcPath != null;
 
   /// Return the directory that contains engine artifacts for the given targets.
@@ -53,46 +56,8 @@
   }
 
   Directory _getEngineArtifactsDirectory(TargetPlatform platform, BuildMode mode) {
-    if (engineSrcPath != null) {
-      List<String> buildDir = <String>[];
-
-      switch (platform) {
-        case TargetPlatform.android_arm:
-        case TargetPlatform.android_x64:
-        case TargetPlatform.android_x86:
-          buildDir.add('android');
-          break;
-
-        // TODO(devoncarew): We will need an ios vs ios_x86 target (for ios vs. ios_sim).
-        case TargetPlatform.ios:
-          buildDir.add('ios');
-          break;
-
-        // These targets don't have engine artifacts.
-        case TargetPlatform.darwin_x64:
-        case TargetPlatform.linux_x64:
-          buildDir.add('host');
-          break;
-      }
-
-      buildDir.add(getModeName(mode));
-
-      if (!engineRelease)
-        buildDir.add('unopt');
-
-      // Add a suffix for the target architecture.
-      switch (platform) {
-        case TargetPlatform.android_x64:
-          buildDir.add('x64');
-          break;
-        case TargetPlatform.android_x86:
-          buildDir.add('x86');
-          break;
-        default:
-          break;
-      }
-
-      return new Directory(path.join(engineSrcPath, 'out', buildDir.join('_')));
+    if (engineBuildPath != null) {
+      return new Directory(engineBuildPath);
     } else {
       String suffix = mode != BuildMode.debug ? '-${getModeName(mode)}' : '';
 
@@ -104,15 +69,25 @@
   }
 
   String getHostToolPath(HostTool tool) {
-    if (tool != HostTool.SkySnapshot)
-      throw new Exception('Unexpected host tool: $tool');
-
-    if (isLocalEngine) {
-      return path.join(engineBuildPath, 'clang_x64', 'sky_snapshot');
-    } else {
+    if (engineBuildPath == null) {
       return path.join(_cache.getArtifactDirectory('engine').path,
                        getNameForHostPlatform(getCurrentHostPlatform()),
-                       'sky_snapshot');
+                       _kHostToolFileName[tool]);
     }
+
+    if (tool == HostTool.SkySnapshot) {
+      String clangPath = path.join(engineBuildPath, 'clang_x64', 'sky_snapshot');
+      if (FileSystemEntity.isFileSync(clangPath))
+        return clangPath;
+      return path.join(engineBuildPath, 'sky_snapshot');
+    } else if (tool == HostTool.SkyShell) {
+      if (getCurrentHostPlatform() == HostPlatform.linux_x64) {
+        return path.join(engineBuildPath, 'sky_shell');
+      } else if (getCurrentHostPlatform() == HostPlatform.darwin_x64) {
+        return path.join(engineBuildPath, 'SkyShell.app', 'Contents', 'MacOS', 'SkyShell');
+      }
+    }
+
+    throw 'Unexpected host tool: $tool';
   }
 }
diff --git a/packages/flutter_tools/test/src/mocks.dart b/packages/flutter_tools/test/src/mocks.dart
index a8de5a1..eba11c2 100644
--- a/packages/flutter_tools/test/src/mocks.dart
+++ b/packages/flutter_tools/test/src/mocks.dart
@@ -6,7 +6,7 @@
 
 import 'package:flutter_tools/src/android/android_device.dart';
 import 'package:flutter_tools/src/application_package.dart';
-import 'package:flutter_tools/src/build_configuration.dart';
+import 'package:flutter_tools/src/build_info.dart';
 import 'package:flutter_tools/src/device.dart';
 import 'package:flutter_tools/src/ios/devices.dart';
 import 'package:flutter_tools/src/ios/simulators.dart';
diff --git a/packages/flutter_tools/test/toolchain_test.dart b/packages/flutter_tools/test/toolchain_test.dart
index 42bc209..dd5b153 100644
--- a/packages/flutter_tools/test/toolchain_test.dart
+++ b/packages/flutter_tools/test/toolchain_test.dart
@@ -4,7 +4,7 @@
 
 import 'dart:io';
 
-import 'package:flutter_tools/src/build_configuration.dart';
+import 'package:flutter_tools/src/build_info.dart';
 import 'package:flutter_tools/src/cache.dart';
 import 'package:flutter_tools/src/toolchain.dart';
 import 'package:test/test.dart';
@@ -41,7 +41,7 @@
     testUsingContext('using enginePath', () {
       ToolConfiguration toolConfig = new ToolConfiguration();
       toolConfig.engineSrcPath = 'engine';
-      toolConfig.engineRelease = true;
+      toolConfig.engineBuildPath = 'engine/out/android_debug';
 
       expect(
         toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildMode.debug).path,