Merge pull request #205 from Hixie/minedigger
Many code improvements to Mine Digger.
diff --git a/packages/flutter/README.md b/packages/flutter/README.md
index a70daae..fddf171 100644
--- a/packages/flutter/README.md
+++ b/packages/flutter/README.md
@@ -3,7 +3,9 @@
Sky apps are written in Dart. To get started, we need to set up Dart SDK:
- - Install the [Dart SDK](https://www.dartlang.org/downloads/).
+ - Install the [Dart SDK](https://www.dartlang.org/downloads/):
+ - Mac: `brew tap dart-lang/dart && brew install dart`
+ - Linux: See [https://www.dartlang.org/downloads/linux.html](https://www.dartlang.org/downloads/linux.html)
- Ensure that `$DART_SDK` is set to the path of your Dart SDK and that the
`dart` and `pub` executables are on your `$PATH`.
@@ -44,20 +46,20 @@
string and centers it on the screen using a `Center` widget. To learn more about
the widget system, please see the [widgets tutorial](lib/widgets/README.md).
-Setup your Android device
+Setting up your Android device
-------------------------
Currently Sky requires an Android device running the Lollipop (or newer) version
of the Android operating system.
- - Install the `adb` tool from the [Android SDK](https://developer.android.com/sdk/installing/index.html)
- and ensure that `adb` (inside `platform-tools` in the Android SDK) is in your
- `$PATH`.
+ - Install the `adb` tool from the [Android SDK](https://developer.android.com/sdk/installing/index.html?pkg=tools):
+ - Mac: `brew install android-platform-tools`
+ - Linux: `sudo apt-get install android-tools-adb`
- Enable developer mode on your device by visiting `Settings > About phone`
and tapping the `Build number` field five times.
- - Enable `USB debugging` in `Settings > Developer options`.
+ - Enable `Android debugging` in `Settings > Developer options`.
- Using a USB cable, plug your phone into your computer. If prompted on your
device, authorize your computer to access your device.
diff --git a/packages/flutter/example/raw/mutating-dom.dart b/packages/flutter/example/raw/mutating-dom.dart
index 0d27a3f..6de893c 100644
--- a/packages/flutter/example/raw/mutating-dom.dart
+++ b/packages/flutter/example/raw/mutating-dom.dart
@@ -48,9 +48,12 @@
node = root;
} else if (node != root && other != null && pickThis(0.1)) {
report("insertBefore()");
- node.insertBefore([other]);
+ try {
+ node.insertBefore([other]);
+ } catch (_) {
+ }
break;
- } else if (pickThis(0.001)) {
+ } else if (node != root && pickThis(0.001)) {
report("remove()");
node.remove();
} else if (node is sky.Element) {
@@ -148,7 +151,7 @@
break;
}
} else {
- assert(node is sky.Text); //
+ assert(node is sky.Text);
final sky.Text text = node;
if (pickThis(0.1)) {
report("appending a new text node (ASCII)");
diff --git a/packages/flutter/lib/sky_tool b/packages/flutter/lib/sky_tool
index e57159c..8152b8a 100755
--- a/packages/flutter/lib/sky_tool
+++ b/packages/flutter/lib/sky_tool
@@ -23,6 +23,7 @@
OBSERVATORY_PORT = 8181
APK_NAME = 'SkyDemo.apk'
ANDROID_PACKAGE = "org.domokit.sky.demo"
+ANDROID_COMPONENT = '%s/%s.SkyDemoActivity' % (ANDROID_PACKAGE, ANDROID_PACKAGE)
# FIXME: This assumes adb is in $PATH, we could look for ANDROID_HOME, etc?
ADB_PATH = 'adb'
# FIXME: Do we need to look in $DART_SDK?
@@ -111,7 +112,7 @@
def _url_for_path(port, root, path):
relative_path = os.path.relpath(path, root)
- return 'sky://localhost:%s/%s' % (port, relative_path)
+ return 'http://localhost:%s/%s' % (port, relative_path)
class StartSky(object):
@@ -193,13 +194,14 @@
pids['remote_sky_server_port'] = sky_server_port
# The load happens on the remote device, use the remote port.
- sky_url = _url_for_path(pids['remote_sky_server_port'], sky_server_root,
+ url = _url_for_path(pids['remote_sky_server_port'], sky_server_root,
main_dart)
subprocess.check_call([ADB_PATH, 'shell',
'am', 'start',
'-a', 'android.intent.action.VIEW',
- '-d', sky_url])
+ '-d', url,
+ ANDROID_COMPONENT])
class StopSky(object):
diff --git a/packages/flutter/lib/widgets/widget.dart b/packages/flutter/lib/widgets/widget.dart
index 6f96239..cc9e396 100644
--- a/packages/flutter/lib/widgets/widget.dart
+++ b/packages/flutter/lib/widgets/widget.dart
@@ -585,7 +585,7 @@
return super.syncChild(node, oldNode, slot);
}
- void setState(Function fn()) {
+ void setState(void fn()) {
assert(!_disqualifiedFromEverAppearingAgain);
fn();
scheduleBuild();
diff --git a/packages/flutter/pubspec.yaml b/packages/flutter/pubspec.yaml
index 7ef9c6b..4efba0c 100644
--- a/packages/flutter/pubspec.yaml
+++ b/packages/flutter/pubspec.yaml
@@ -11,4 +11,4 @@
sdk: '>=1.8.0 <2.0.0'
homepage: https://github.com/domokit/mojo/tree/master/sky
name: sky
-version: 0.0.20
+version: 0.0.21