diff options
author | Matt Brubeck <mbrubeck@limpet.net> | 2015-12-08 11:13:08 -0800 |
---|---|---|
committer | Matt Brubeck <mbrubeck@limpet.net> | 2015-12-12 04:58:33 -0800 |
commit | 53871321a3b22f14e31868405a9f98b31b529acc (patch) | |
tree | e4b676c79365cb3985335c6f2983b741e84ef6d2 /python/servo/post_build_commands.py | |
parent | 2a00eb6c08409e174c09d96e23f07d7c41b58b7e (diff) | |
download | servo-53871321a3b22f14e31868405a9f98b31b529acc.tar.gz servo-53871321a3b22f14e31868405a9f98b31b529acc.zip |
Add mach install command (Android-only for now)
Diffstat (limited to 'python/servo/post_build_commands.py')
-rw-r--r-- | python/servo/post_build_commands.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index ee57ebf73dd..682fae4da25 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -215,3 +215,26 @@ class PostBuildCommands(CommandBase): except subprocess.CalledProcessError as e: print("Packaging Android exited with return value %d" % e.returncode) return e.returncode + + @Command('install', + description='Install Servo (currently, Android only)', + category='post-build') + @CommandArgument('--release', '-r', action='store_true', + help='Package the release build') + @CommandArgument('--dev', '-d', action='store_true', + help='Package the dev build') + def install(self, release=False, dev=False): + binary_path = self.get_binary_path(release, dev, android=True) + if not path.exists(binary_path): + # TODO: Run the build command automatically? + print("Servo build not found. Please run `./mach build` to compile Servo.") + return 1 + + apk_path = binary_path + ".apk" + if not path.exists(apk_path): + result = Registrar.dispatch("package", context=self.context, release=release, dev=dev) + if result is not 0: + return result + + print(["adb", "install", "-r", apk_path]) + return subprocess.call(["adb", "install", "-r", apk_path], env=self.build_env()) |