aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/post_build_commands.py
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-06-06 15:19:55 -0500
committerbors-servo <lbergstrom+bors@mozilla.com>2016-06-06 15:19:55 -0500
commitbc52617d3351d64cfd1479c5088b591370529f59 (patch)
tree93d13502af5e4f8f9823c9bdab5599f0c691fc64 /python/servo/post_build_commands.py
parent21687b0f30dc6ebcfe1b1a499e978bf356f4698b (diff)
parenta1a8e08dca490d10ef10baec1ecbf9ed6d4afc59 (diff)
downloadservo-bc52617d3351d64cfd1479c5088b591370529f59.tar.gz
servo-bc52617d3351d64cfd1479c5088b591370529f59.zip
Auto merge of #11210 - edunham:mach-package, r=larsbergstrom
Start on Mach package Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: - [ ] `./mach build -d` does not report any errors - these changes don't touch anything that mach build touches> - [ ] `./mach test-tidy --faster` does not report any errors - Tidy errors on some dependencies that I think we'll need for real `package` but aren't using for android - [X] These changes address #9918 (github issue number if applicable). Either: - [ ] There are tests for these changes OR - [x] These changes do not require tests because I don't think Mach has tests yet? Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11210) <!-- Reviewable:end -->
Diffstat (limited to 'python/servo/post_build_commands.py')
-rw-r--r--python/servo/post_build_commands.py63
1 files changed, 1 insertions, 62 deletions
diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py
index 693fbfdde0c..7781689d32b 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, BuildNotFound
+from servo.command_base import CommandBase, cd, call, check_call
def read_file(filename, if_exists=False):
@@ -229,64 +229,3 @@ class PostBuildCommands(CommandBase):
import webbrowser
webbrowser.open("file://" + path.abspath(path.join(
self.get_target_dir(), "doc", "servo", "index.html")))
-
- @Command('package',
- description='Package Servo (currently, Android APK 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 package(self, release=False, dev=False, debug=False, debugger=None):
- env = self.build_env()
- binary_path = self.get_binary_path(release, dev, android=True)
-
- if dev:
- env["NDK_DEBUG"] = "1"
- env["ANT_FLAVOR"] = "debug"
- dev_flag = "-d"
- else:
- env["ANT_FLAVOR"] = "release"
- dev_flag = ""
-
- target_dir = os.path.dirname(binary_path)
- output_apk = "{}.apk".format(binary_path)
- try:
- with cd(path.join("support", "android", "build-apk")):
- subprocess.check_call(["cargo", "run", "--", dev_flag, "-o", output_apk, "-t", target_dir,
- "-r", self.get_top_dir()], env=env)
- 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):
- 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):
- 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())