Index: samples/android/tools/build.py |
diff --git a/samples/android/tools/build.py b/samples/android/tools/build.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..c7ded1b922cb7bf25c210b94d5250fcaed91a619 |
--- /dev/null |
+++ b/samples/android/tools/build.py |
@@ -0,0 +1,37 @@ |
+#!/usr/bin/env python |
+# |
+# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
+# for details. All rights reserved. Use of this source code is governed by a |
+# BSD-style license that can be found in the LICENSE file. |
+# |
+ |
+"""Build, install, and launch a sample Android application that uses Dart.""" |
+ |
+import os |
+import platform |
+import subprocess |
+import sys |
+ |
+SCRIPT_DIR = os.path.dirname(sys.argv[0]) |
+PROJECT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) |
+DART_ROOT = os.path.realpath(os.path.join(PROJECT_DIR, '../..')) |
+THIRD_PARTY_ROOT = os.path.join(DART_ROOT, 'third_party') |
+ADB = os.path.join(THIRD_PARTY_ROOT, 'android_tools/sdk/platform-tools/adb') |
+ |
+def Main(): |
+ if platform.system() != "Linux": |
+ sys.stderr.write("Android Dart support currently only builds on Linux.\n") |
+ return -1 |
+ os.chdir(DART_ROOT) |
+ subprocess.check_call( |
+ ["tools/build.py", "--os=android", "-m", "release", "samples"]) |
+ os.chdir(PROJECT_DIR) |
+ subprocess.check_call( |
+ [ADB, "install", "-r", "bin/DartActivity-debug.apk"]) |
+ subprocess.check_call( |
+ [ADB, "shell", "am", "start", "-n", |
+ "org.dartlang.example.dart/org.dartlang.example.dart.DartActivity"]) |
+ return 0 |
+ |
+if __name__ == '__main__': |
+ sys.exit(Main()) |