allow any android sdk version

This commit is contained in:
Devon Carew
2016-02-13 12:00:41 -08:00
parent 5a167615d3
commit dcf0b7bae6
25 changed files with 426 additions and 220 deletions

View File

@@ -16,6 +16,14 @@ AppContext get context {
class AppContext {
Map<Type, dynamic> _instances = <Type, dynamic>{};
bool isSet(Type type) {
if (_instances.containsKey(type))
return true;
AppContext parent = _calcParent(Zone.current);
return parent != null ? parent.isSet(type) : false;
}
dynamic getVariable(Type type) {
if (_instances.containsKey(type))
return _instances[type];

View File

@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../android/android_sdk.dart';
import '../device.dart';
import 'context.dart';
import 'logger.dart';
DeviceManager get deviceManager => context[DeviceManager];
Logger get logger => context[Logger];
AndroidSdk get androidSdk => context[AndroidSdk];
/// Display an error level message to the user. Commands should use this if they
/// fail in some way.

View File

@@ -18,12 +18,26 @@ abstract class OperatingSystemUtils {
/// Make the given file executable. This may be a no-op on some platforms.
ProcessResult makeExecutable(File file);
/// Return the path (with symlinks resolved) to the given executable, or `null`
/// if `which` was not able to locate the binary.
File which(String execName);
}
class _PosixUtils implements OperatingSystemUtils {
ProcessResult makeExecutable(File file) {
return Process.runSync('chmod', ['u+x', file.path]);
}
/// Return the path (with symlinks resolved) to the given executable, or `null`
/// if `which` was not able to locate the binary.
File which(String execName) {
ProcessResult result = Process.runSync('which', <String>[execName]);
if (result.exitCode != 0)
return null;
String path = result.stdout.trim().split('\n').first.trim();
return new File(new File(path).resolveSymbolicLinksSync());
}
}
class _WindowsUtils implements OperatingSystemUtils {
@@ -31,6 +45,10 @@ class _WindowsUtils implements OperatingSystemUtils {
ProcessResult makeExecutable(File file) {
return new ProcessResult(0, 0, null, null);
}
File which(String execName) {
throw new UnimplementedError('_WindowsUtils.which');
}
}
Future<int> findAvailablePort() async {