From 7af235e02655350d7eb65db25f007badd8765c06 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Sat, 12 Dec 2015 18:02:53 +0501 Subject: [PATCH] servo: Merge #8891 - Android build system improvements (from mbrubeck:mach-install); r=larsbergstrom 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/ Source-Repo: https://github.com/servo/servo Source-Revision: a1fb12616a29d2190baadd20d7763af1d9c02260 --- servo/python/servo/post_build_commands.py | 28 +++++++++++++++++++---- servo/support/android/.gitignore | 3 --- servo/support/android/apk/.gitignore | 6 +++++ 3 files changed, 30 insertions(+), 7 deletions(-) delete mode 100644 servo/support/android/.gitignore create mode 100644 servo/support/android/apk/.gitignore diff --git a/servo/python/servo/post_build_commands.py b/servo/python/servo/post_build_commands.py index 4d69e976e376..682fae4da25c 100644 --- a/servo/python/servo/post_build_commands.py +++ b/servo/python/servo/post_build_commands.py @@ -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()) diff --git a/servo/support/android/.gitignore b/servo/support/android/.gitignore deleted file mode 100644 index 1071c3d9fe40..000000000000 --- a/servo/support/android/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -openssl-1.0.1k/ -openssl-1.0.1k.tar.gz - diff --git a/servo/support/android/apk/.gitignore b/servo/support/android/apk/.gitignore new file mode 100644 index 000000000000..4d87ae843a86 --- /dev/null +++ b/servo/support/android/apk/.gitignore @@ -0,0 +1,6 @@ +/assets/ +/bin/ +/gen/ +/libs/ +/local.properties +/proguard-project.txt