diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-08-19 12:25:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-19 12:25:43 -0400 |
commit | a084997afee23bb541e89a807905ff1c815a649e (patch) | |
tree | 5963a27cda769665fd9c044050e35e1f46e6edd4 | |
parent | 8fd06759dc3bb9b551720043292ee5911bf35541 (diff) | |
parent | 88a3021c9d9319868cfe28b4485c4ed21fd8ca70 (diff) | |
download | servo-a084997afee23bb541e89a807905ff1c815a649e.tar.gz servo-a084997afee23bb541e89a807905ff1c815a649e.zip |
Auto merge of #24003 - asajeffrey:magicleap-mach-install, r=Manishearth
Add --magicleap option to mach install
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22866
- [x] These changes do not require tests because we don't test installing on devices
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- 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="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24003)
<!-- Reviewable:end -->
-rw-r--r-- | python/servo/package_commands.py | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py index e8505d2d30d..3e14876e29a 100644 --- a/python/servo/package_commands.py +++ b/python/servo/package_commands.py @@ -487,6 +487,10 @@ class PackageCommands(CommandBase): @CommandArgument('--android', action='store_true', help='Install on Android') + @CommandArgument('--magicleap', + default=None, + action='store_true', + help='Install on Magic Leap') @CommandArgument('--emulator', action='store_true', help='For Android, install to the only emulated device') @@ -496,29 +500,44 @@ class PackageCommands(CommandBase): @CommandArgument('--target', '-t', default=None, help='Install the given target platform') - def install(self, release=False, dev=False, android=False, emulator=False, usb=False, target=None): - env = self.build_env() + def install(self, release=False, dev=False, android=False, magicleap=False, emulator=False, usb=False, target=None): if target and android: print("Please specify either --target or --android.") sys.exit(1) if not android: android = self.handle_android_target(target) + if target and magicleap: + print("Please specify either --target or --magicleap.") + sys.exit(1) + if magicleap: + target = "aarch64-linux-android" + env = self.build_env(target=target) try: - binary_path = self.get_binary_path(release, dev, android=android) + binary_path = self.get_binary_path(release, dev, android=android, magicleap=magicleap) except BuildNotFound: print("Servo build not found. Building servo...") result = Registrar.dispatch( - "build", context=self.context, release=release, dev=dev, android=android + "build", context=self.context, release=release, dev=dev, android=android, magicleap=magicleap, ) if result: return result try: - binary_path = self.get_binary_path(release, dev, android=android) + binary_path = self.get_binary_path(release, dev, android=android, magicleap=magicleap) except BuildNotFound: print("Rebuilding Servo did not solve the missing build problem.") return 1 - if android: + if magicleap: + if not env.get("MAGICLEAP_SDK"): + raise Exception("Magic Leap installs need the MAGICLEAP_SDK environment variable") + mldb = path.join(env.get("MAGICLEAP_SDK"), "tools", "mldb", "mldb") + pkg_path = path.join(path.dirname(binary_path), "Servo.mpk") + exec_command = [ + mldb, + "install", "-u", + pkg_path, + ] + elif android: pkg_path = self.get_apk_path(release) exec_command = [self.android_adb_path(env)] if emulator and usb: @@ -534,8 +553,9 @@ class PackageCommands(CommandBase): exec_command = ["msiexec", "/i", pkg_path] if not path.exists(pkg_path): + print("Servo package not found. Packaging servo...") result = Registrar.dispatch( - "package", context=self.context, release=release, dev=dev, android=android + "package", context=self.context, release=release, dev=dev, android=android, magicleap=magicleap, ) if result != 0: return result |