OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. |
| 6 # |
| 7 |
| 8 """Build, install, and launch a sample Android application that uses Dart.""" |
| 9 |
| 10 import os |
| 11 import platform |
| 12 import subprocess |
| 13 import sys |
| 14 |
| 15 SCRIPT_DIR = os.path.dirname(sys.argv[0]) |
| 16 PROJECT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) |
| 17 DART_ROOT = os.path.realpath(os.path.join(PROJECT_DIR, '../..')) |
| 18 THIRD_PARTY_ROOT = os.path.join(DART_ROOT, 'third_party') |
| 19 ADB = os.path.join(THIRD_PARTY_ROOT, 'android_tools/sdk/platform-tools/adb') |
| 20 |
| 21 def Main(): |
| 22 if platform.system() != "Linux": |
| 23 sys.stderr.write("Android Dart support currently only builds on Linux.\n") |
| 24 return -1 |
| 25 os.chdir(DART_ROOT) |
| 26 subprocess.check_call( |
| 27 ["tools/build.py", "--os=android", "-m", "release", "samples"]) |
| 28 os.chdir(PROJECT_DIR) |
| 29 subprocess.check_call( |
| 30 [ADB, "install", "-r", "bin/DartActivity-debug.apk"]) |
| 31 subprocess.check_call( |
| 32 [ADB, "shell", "am", "start", "-n", |
| 33 "org.dartlang.example.dart/org.dartlang.example.dart.DartActivity"]) |
| 34 return 0 |
| 35 |
| 36 if __name__ == '__main__': |
| 37 sys.exit(Main()) |
OLD | NEW |