diff options
author | Mukilan Thiyagarajan <mukilan@igalia.com> | 2024-01-22 18:30:15 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-22 13:00:15 +0000 |
commit | d7de206dbd459e8c8bf121f73755d12569c6cc55 (patch) | |
tree | 34af7250352bd0b5c00aa56bfac6b086d30713a4 /python/servo/bootstrap_commands.py | |
parent | 8e6bdb69b1b5110ac7fce5801d8ee3e9fd7c6354 (diff) | |
download | servo-d7de206dbd459e8c8bf121f73755d12569c6cc55.tar.gz servo-d7de206dbd459e8c8bf121f73755d12569c6cc55.zip |
Preliminary Android build support (#31086)
* Android build
* Fixes
* More fixes
- Still failing in the linking step
* More work on getting linking working
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* android: use mozjs with ndk r25c. loads servo.org
more android build fixes.
* fix ./mach run for android and make it follow logs
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* add experimental logic for compositor pause/resume
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* pass DPI from android to simpleservo
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* ci: add android workflow
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* switch to ANDROID_SDK_ROOT and ANDROID_NDK_ROOT vars
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* upgrade gradle to 4.10.1
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* upgrade to gradle 5.1.1
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* upgrade to gradle 8 and agp 8
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* make compositing work again with external present
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* android: improve mach support for non-NixOS and CI
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* fix sampler compilation bug introduced in #30490
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* ci: add android build to main workflow
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* gradle: set MinSdk = targetSdk = 30
NDK requires we compile against the minSdk API level
which is 30 in our case.
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* add instructions for android in README.md
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* apk: move servosurface to servoview
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* apk: uncomment the mediasession callbacks on MainActivity
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* apk: fix crash on MainAtivity.onDestroy
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* apk: drop VR, arm 5 and unused code
This commit drops:
* support for google, oculusvr
* support for arm5 architecture
and also removes
* fakeld scripts
* unused java code
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* cleanup shell.nix
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* android: add FIXMEs for gstreamer code
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* apk: remove commented code and debug logs
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* cleanup ServoView.java
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* mach: comment call to download gstreamer deps for android
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* disable bluetooth for jniapi as blurdroid is broken
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* fixup! README.md
* fixup! remove change in Cargo.toml
* fixup! move shell variables together
* fixup! cleanup jniapi/Cargo.toml comments
* delete commented gstreamer related android code
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* remove unused config variable in servbuild
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* android: more cleanup
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* force no_static_freetype only for android
* use actions to manage sdk, ndk and java
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* rename embedder event names to be more clear.
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* link to startup crash issue
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* fix lint issues
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* upgrade env_logger to 0.10 with duplicate exception
libservo and android_logger can use env_logger 0.10
but quickcheck is still stuck on 0.8 and has not seen
any activity in the last 2 years. This commit adds
a duplicate exception until the quickcheck dependency
can be upgraded (or replaced)
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* android: fix comments
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* disable jemalloc on android
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* fixup! replace linux with android in cfg
---------
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'python/servo/bootstrap_commands.py')
-rw-r--r-- | python/servo/bootstrap_commands.py | 147 |
1 files changed, 1 insertions, 146 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 1c7afc957d8..33d3b20aa2f 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -12,7 +12,6 @@ import glob import json import os import os.path as path -import platform import re import subprocess import sys @@ -30,7 +29,7 @@ from mach.decorators import ( import servo.platform from servo.command_base import CommandBase, cd, check_call -from servo.util import delete, download_bytes, download_file, extract, check_hash +from servo.util import delete, download_bytes @CommandProvider @@ -66,150 +65,6 @@ class MachCommands(CommandBase): return 1 return 0 - @Command('bootstrap-android', - description='Install the Android SDK and NDK.', - category='bootstrap') - @CommandArgument('--build', - action='store_true', - help='Install Android-specific dependencies for building') - @CommandArgument('--emulator-x86', - action='store_true', - help='Install Android x86 emulator and system image') - @CommandArgument('--accept-all-licences', - action='store_true', - help='For non-interactive use') - def bootstrap_android(self, build=False, emulator_x86=False, accept_all_licences=False): - if not (build or emulator_x86): - print("Must specify `--build` or `--emulator-x86` or both.") - - ndk = "android-ndk-r15c-{system}-{arch}" - tools = "sdk-tools-{system}-4333796" - - emulator_platform = "android-28" - emulator_image = "system-images;%s;google_apis;x86" % emulator_platform - - known_sha1 = { - # https://dl.google.com/android/repository/repository2-1.xml - "sdk-tools-darwin-4333796.zip": "ed85ea7b59bc3483ce0af4c198523ba044e083ad", - "sdk-tools-linux-4333796.zip": "8c7c28554a32318461802c1291d76fccfafde054", - "sdk-tools-windows-4333796.zip": "aa298b5346ee0d63940d13609fe6bec621384510", - - # https://developer.android.com/ndk/downloads/older_releases - "android-ndk-r15c-windows-x86.zip": "f2e47121feb73ec34ced5e947cbf1adc6b56246e", - "android-ndk-r15c-windows-x86_64.zip": "970bb2496de0eada74674bb1b06d79165f725696", - "android-ndk-r15c-darwin-x86_64.zip": "ea4b5d76475db84745aa8828000d009625fc1f98", - "android-ndk-r15c-linux-x86_64.zip": "0bf02d4e8b85fd770fd7b9b2cdec57f9441f27a2", - } - - toolchains = path.join(self.context.topdir, "android-toolchains") - if not path.isdir(toolchains): - os.makedirs(toolchains) - - def download(target_dir, name, flatten=False): - final = path.join(toolchains, target_dir) - if path.isdir(final): - return - - base_url = "https://dl.google.com/android/repository/" - filename = name + ".zip" - url = base_url + filename - archive = path.join(toolchains, filename) - - if not path.isfile(archive): - download_file(filename, url, archive) - check_hash(archive, known_sha1[filename], "sha1") - print("Extracting " + filename) - remove = True # Set to False to avoid repeated downloads while debugging this script - if flatten: - extracted = final + "_" - extract(archive, extracted, remove=remove) - contents = os.listdir(extracted) - assert len(contents) == 1 - os.rename(path.join(extracted, contents[0]), final) - os.rmdir(extracted) - else: - extract(archive, final, remove=remove) - - system = platform.system().lower() - machine = platform.machine().lower() - arch = {"i386": "x86"}.get(machine, machine) - if build: - download("ndk", ndk.format(system=system, arch=arch), flatten=True) - download("sdk", tools.format(system=system)) - - components = [] - if emulator_x86: - components += [ - "platform-tools", - "emulator", - "platforms;" + emulator_platform, - emulator_image, - ] - if build: - components += [ - "platform-tools", - "platforms;android-18", - ] - - sdkmanager = [path.join(toolchains, "sdk", "tools", "bin", "sdkmanager")] + components - if accept_all_licences: - yes = subprocess.Popen(["yes"], stdout=subprocess.PIPE) - process = subprocess.Popen( - sdkmanager, stdin=yes.stdout, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - ) - # Reduce progress bar spam by removing duplicate lines. - # Printing the same line again with \r is a no-op in a real terminal, - # but each line is shown individually in Taskcluster's log viewer. - previous_line = None - line = b"" - while 1: - # Read one byte at a time because in Python: - # * readline() blocks until "\n", which doesn't come before the prompt - # * read() blocks until EOF, which doesn't come before the prompt - # * read(n) keeps reading until it gets n bytes or EOF, - # but we don't know reliably how many bytes to read until the prompt - byte = process.stdout.read(1) - if len(byte) == 0: - print(line) - break - line += byte - if byte == b'\n' or byte == b'\r': - if line != previous_line: - print(line.decode("utf-8", "replace"), end="") - sys.stdout.flush() - previous_line = line - line = b"" - exit_code = process.wait() - yes.terminate() - if exit_code: - return exit_code - else: - subprocess.check_call(sdkmanager) - - if emulator_x86: - avd_path = path.join(toolchains, "avd", "servo-x86") - process = subprocess.Popen(stdin=subprocess.PIPE, stdout=subprocess.PIPE, args=[ - path.join(toolchains, "sdk", "tools", "bin", "avdmanager"), - "create", "avd", - "--path", avd_path, - "--name", "servo-x86", - "--package", emulator_image, - "--force", - ]) - output = b"" - while 1: - # Read one byte at a time, see comment above. - byte = process.stdout.read(1) - if len(byte) == 0: - break - output += byte - # There seems to be no way to disable this prompt: - if output.endswith(b"Do you wish to create a custom hardware profile? [no]"): - process.stdin.write("no\n") - assert process.wait() == 0 - with open(path.join(avd_path, "config.ini"), "a") as f: - f.write("disk.dataPartition.size=2G\n") - @Command('update-hsts-preload', description='Download the HSTS preload list', category='bootstrap') |