Refactor the build command so that it can be used internally

Instead of calling through `pub` to invoke build, this patch refactors the
build command so that it can be called directly.
This commit is contained in:
Adam Barth
2015-10-13 10:00:06 -07:00
parent d9af939995
commit 12f75817ce
5 changed files with 121 additions and 64 deletions

View File

@@ -7,6 +7,7 @@ import 'package:sky_tools/src/application_package.dart';
import 'package:sky_tools/src/build_configuration.dart';
import 'package:sky_tools/src/commands/flutter_command.dart';
import 'package:sky_tools/src/device.dart';
import 'package:sky_tools/src/toolchain.dart';
class MockApplicationPackageStore extends ApplicationPackageStore {
MockApplicationPackageStore() : super(
@@ -15,6 +16,15 @@ class MockApplicationPackageStore extends ApplicationPackageStore {
iOSSimulator: new IOSApp(localPath: '/mock/path/to/iOSSimulator/SkyShell.app'));
}
class MockCompiler extends Mock implements Compiler {
@override
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
class MockToolchain extends Toolchain {
MockToolchain() : super(compiler: new MockCompiler());
}
class MockAndroidDevice extends Mock implements AndroidDevice {
BuildPlatform get platform => BuildPlatform.android;
@@ -46,5 +56,6 @@ class MockDeviceStore extends DeviceStore {
void applyMocksToCommand(FlutterCommand command) {
command
..applicationPackages = new MockApplicationPackageStore()
..toolchain = new MockToolchain()
..devices = new MockDeviceStore();
}