diff options
author | Adrian Utrilla <adrianutrilla@gmail.com> | 2016-04-14 21:37:44 +0200 |
---|---|---|
committer | Adrian Utrilla <adrianutrilla@gmail.com> | 2016-04-15 19:11:48 +0200 |
commit | 739410e52d4ee70f02b2a32db27e6402ef5cbce9 (patch) | |
tree | ec4d84104af2969d97f98a4d4d16d21aa87f4d3c /python/servo/post_build_commands.py | |
parent | 415fd93a502b47c03d2eb856cbd76a99e0bf0392 (diff) | |
download | servo-739410e52d4ee70f02b2a32db27e6402ef5cbce9.tar.gz servo-739410e52d4ee70f02b2a32db27e6402ef5cbce9.zip |
mach install now builds servo if it hasn't been built before
Diffstat (limited to 'python/servo/post_build_commands.py')
-rw-r--r-- | python/servo/post_build_commands.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index c9891cd7986..7bbb8c03ed5 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -23,7 +23,7 @@ from mach.decorators import ( Command, ) -from servo.command_base import CommandBase, cd, call, check_call +from servo.command_base import CommandBase, cd, call, check_call, BuildNotFound def read_file(filename, if_exists=False): @@ -263,11 +263,20 @@ class PostBuildCommands(CommandBase): @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 + try: + binary_path = self.get_binary_path(release, dev, android=True) + except BuildNotFound: + print("Servo build not found. Building servo...") + result = Registrar.dispatch( + "build", context=self.context, release=release, dev=dev + ) + if result: + return result + try: + binary_path = self.get_binary_path(release, dev, android=True) + except BuildNotFound: + print("Rebuilding Servo did not solve the missing build problem.") + return 1 apk_path = binary_path + ".apk" if not path.exists(apk_path): |