Auto merge of #8891 - mbrubeck:mach-install, r=larsbergstrom

Android build system improvements

This PR adds a `mach install` command (a convenient way to run `adb install`), and does some minor code cleanup.

It also fixes parallelism in the OpenSSL build.  For [complicated reasons][1], a sub-Make will not inherit `-j` options from its parent process unless it is invoked directly from another Makefile.  This means we should run make from openssl.makefile rather than openssl.sh.

r? @larsbergstrom

[1]: http://make.mad-scientist.net/papers/jobserver-implementation/

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8891)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-12-12 18:31:53 +05:30
commit a1fb12616a
3 changed files with 30 additions and 7 deletions

View file

@ -194,10 +194,7 @@ class PostBuildCommands(CommandBase):
help='Package the release build')
@CommandArgument('--dev', '-d', action='store_true',
help='Package the dev build')
@CommandArgument(
'params', nargs='...',
help="Command-line arguments to be passed through to Servo")
def package(self, params, release=False, dev=False, debug=False, debugger=None):
def package(self, release=False, dev=False, debug=False, debugger=None):
env = self.build_env()
binary_path = self.get_binary_path(release, dev, android=True)
@ -218,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())