mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add --build
and --emulator-x86
to ./mach bootstrap-android
This allows not downloading dependencies that are not needed for a praticular task.
This commit is contained in:
parent
597f7c1cc6
commit
89e1878bd6
5 changed files with 41 additions and 31 deletions
|
@ -249,7 +249,7 @@ linker = "lld-link.exe"
|
||||||
|
|
||||||
#### Cross-compilation for Android
|
#### Cross-compilation for Android
|
||||||
|
|
||||||
Run `./mach bootstrap-android` to get Android-specific tools. See wiki for
|
Run `./mach bootstrap-android --build` to get Android-specific tools. See wiki for
|
||||||
[details](https://github.com/servo/servo/wiki/Building-for-Android).
|
[details](https://github.com/servo/servo/wiki/Building-for-Android).
|
||||||
|
|
||||||
## The Rust compiler
|
## The Rust compiler
|
||||||
|
|
|
@ -14,4 +14,4 @@ set -o pipefail
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
|
|
||||||
cd $(dirname ${0})/../..
|
cd $(dirname ${0})/../..
|
||||||
yes | ./mach bootstrap-android
|
yes | ./mach bootstrap-android "${@}"
|
||||||
|
|
|
@ -180,7 +180,7 @@ android:
|
||||||
- ./mach clean-nightlies --keep 3 --force
|
- ./mach clean-nightlies --keep 3 --force
|
||||||
- ./mach clean-cargo-cache --keep 3 --force
|
- ./mach clean-cargo-cache --keep 3 --force
|
||||||
- ./etc/ci/clean_build_artifacts.sh
|
- ./etc/ci/clean_build_artifacts.sh
|
||||||
- ./etc/ci/bootstrap-android-and-accept-licences.sh
|
- ./etc/ci/bootstrap-android-and-accept-licences.sh --build
|
||||||
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach build --android --dev
|
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach build --android --dev
|
||||||
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach package --android --dev
|
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach package --android --dev
|
||||||
- bash ./etc/ci/lockfile_changed.sh
|
- bash ./etc/ci/lockfile_changed.sh
|
||||||
|
@ -191,7 +191,7 @@ android-mac:
|
||||||
commands:
|
commands:
|
||||||
- ./mach clean-nightlies --keep 3 --force
|
- ./mach clean-nightlies --keep 3 --force
|
||||||
- ./mach clean-cargo-cache --keep 3 --force
|
- ./mach clean-cargo-cache --keep 3 --force
|
||||||
- ./etc/ci/bootstrap-android-and-accept-licences.sh
|
- ./etc/ci/bootstrap-android-and-accept-licences.sh --build
|
||||||
- ./mach build --android --dev
|
- ./mach build --android --dev
|
||||||
- ./mach package --android --dev
|
- ./mach package --android --dev
|
||||||
- bash ./etc/ci/lockfile_changed.sh
|
- bash ./etc/ci/lockfile_changed.sh
|
||||||
|
@ -205,7 +205,7 @@ android-x86:
|
||||||
- ./mach clean-nightlies --keep 3 --force
|
- ./mach clean-nightlies --keep 3 --force
|
||||||
- ./mach clean-cargo-cache --keep 3 --force
|
- ./mach clean-cargo-cache --keep 3 --force
|
||||||
- ./etc/ci/clean_build_artifacts.sh
|
- ./etc/ci/clean_build_artifacts.sh
|
||||||
- ./etc/ci/bootstrap-android-and-accept-licences.sh
|
- ./etc/ci/bootstrap-android-and-accept-licences.sh --build --emulator-x86
|
||||||
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach build --target i686-linux-android --release
|
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach build --target i686-linux-android --release
|
||||||
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach test-android-startup --release
|
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach test-android-startup --release
|
||||||
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach test-wpt-android --release /_mozilla/mozilla/DOMParser.html /_mozilla/mozilla/webgl/context_creation_error.html
|
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach test-wpt-android --release /_mozilla/mozilla/DOMParser.html /_mozilla/mozilla/webgl/context_creation_error.html
|
||||||
|
@ -220,7 +220,7 @@ android-nightly:
|
||||||
- ./mach clean-nightlies --keep 3 --force
|
- ./mach clean-nightlies --keep 3 --force
|
||||||
- ./mach clean-cargo-cache --keep 3 --force
|
- ./mach clean-cargo-cache --keep 3 --force
|
||||||
- ./etc/ci/clean_build_artifacts.sh
|
- ./etc/ci/clean_build_artifacts.sh
|
||||||
- ./etc/ci/bootstrap-android-and-accept-licences.sh
|
- ./etc/ci/bootstrap-android-and-accept-licences.sh --build
|
||||||
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach build --android --release
|
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach build --android --release
|
||||||
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach package --android --release --maven
|
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach package --android --release --maven
|
||||||
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach build --target=i686-linux-android --release
|
- env --unset ANDROID_NDK --unset ANDROID_SDK ./mach build --target=i686-linux-android --release
|
||||||
|
|
|
@ -87,7 +87,7 @@ def android_arm32():
|
||||||
# wget: servo-media-gstreamer’s build script
|
# wget: servo-media-gstreamer’s build script
|
||||||
.with_script("""
|
.with_script("""
|
||||||
apt-get install -y --no-install-recommends openjdk-8-jdk-headless file wget
|
apt-get install -y --no-install-recommends openjdk-8-jdk-headless file wget
|
||||||
./etc/ci/bootstrap-android-and-accept-licences.sh
|
yes | ./mach bootstrap-android --build
|
||||||
./mach build --android --release
|
./mach build --android --release
|
||||||
""")
|
""")
|
||||||
.with_artifacts(
|
.with_artifacts(
|
||||||
|
|
|
@ -79,16 +79,21 @@ class MachCommands(CommandBase):
|
||||||
@Command('bootstrap-android',
|
@Command('bootstrap-android',
|
||||||
description='Install the Android SDK and NDK.',
|
description='Install the Android SDK and NDK.',
|
||||||
category='bootstrap')
|
category='bootstrap')
|
||||||
def bootstrap_android(self):
|
@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')
|
||||||
|
def bootstrap_android(self, build=False, emulator_x86=False):
|
||||||
|
if not (build or emulator_x86):
|
||||||
|
print("Must specify `--build` or `--emulator-x86` or both.")
|
||||||
|
|
||||||
ndk = "android-ndk-r12b-{system}-{arch}"
|
ndk = "android-ndk-r12b-{system}-{arch}"
|
||||||
tools = "sdk-tools-{system}-4333796"
|
tools = "sdk-tools-{system}-4333796"
|
||||||
|
|
||||||
sdk_build_tools = "27.0.3"
|
emulator_platform = "android-28"
|
||||||
emulator_images = [
|
emulator_image = "system-images;%s;google_apis;x86" % emulator_platform
|
||||||
("servo-arm", "25", "google_apis;armeabi-v7a"),
|
|
||||||
("servo-x86", "28", "google_apis;x86"),
|
|
||||||
]
|
|
||||||
|
|
||||||
known_sha1 = {
|
known_sha1 = {
|
||||||
# https://dl.google.com/android/repository/repository2-1.xml
|
# https://dl.google.com/android/repository/repository2-1.xml
|
||||||
|
@ -135,29 +140,34 @@ class MachCommands(CommandBase):
|
||||||
system = platform.system().lower()
|
system = platform.system().lower()
|
||||||
machine = platform.machine().lower()
|
machine = platform.machine().lower()
|
||||||
arch = {"i386": "x86"}.get(machine, machine)
|
arch = {"i386": "x86"}.get(machine, machine)
|
||||||
download("ndk", ndk.format(system=system, arch=arch), flatten=True)
|
if build:
|
||||||
|
download("ndk", ndk.format(system=system, arch=arch), flatten=True)
|
||||||
download("sdk", tools.format(system=system))
|
download("sdk", tools.format(system=system))
|
||||||
|
|
||||||
subprocess.check_call([
|
components = []
|
||||||
path.join(toolchains, "sdk", "tools", "bin", "sdkmanager"),
|
if emulator_x86:
|
||||||
"platform-tools",
|
components += [
|
||||||
"build-tools;" + sdk_build_tools,
|
"platform-tools",
|
||||||
"emulator",
|
"emulator",
|
||||||
] + [
|
"platforms;" + emulator_platform,
|
||||||
arg
|
emulator_image,
|
||||||
for avd_name, api_level, system_image in emulator_images
|
|
||||||
for arg in [
|
|
||||||
"platforms;android-" + api_level,
|
|
||||||
"system-images;android-%s;%s" % (api_level, system_image),
|
|
||||||
]
|
]
|
||||||
])
|
if build:
|
||||||
for avd_name, api_level, system_image in emulator_images:
|
components += [
|
||||||
|
"platforms;android-18",
|
||||||
|
]
|
||||||
|
subprocess.check_call(
|
||||||
|
[path.join(toolchains, "sdk", "tools", "bin", "sdkmanager")] + components
|
||||||
|
)
|
||||||
|
|
||||||
|
if emulator_x86:
|
||||||
|
avd_path = path.join(toolchains, "avd", "servo-x86")
|
||||||
process = subprocess.Popen(stdin=subprocess.PIPE, stdout=subprocess.PIPE, args=[
|
process = subprocess.Popen(stdin=subprocess.PIPE, stdout=subprocess.PIPE, args=[
|
||||||
path.join(toolchains, "sdk", "tools", "bin", "avdmanager"),
|
path.join(toolchains, "sdk", "tools", "bin", "avdmanager"),
|
||||||
"create", "avd",
|
"create", "avd",
|
||||||
"--path", path.join(toolchains, "avd", avd_name),
|
"--path", avd_path,
|
||||||
"--name", avd_name,
|
"--name", "servo-x86",
|
||||||
"--package", "system-images;android-%s;%s" % (api_level, system_image),
|
"--package", emulator_image,
|
||||||
"--force",
|
"--force",
|
||||||
])
|
])
|
||||||
output = b""
|
output = b""
|
||||||
|
@ -175,7 +185,7 @@ class MachCommands(CommandBase):
|
||||||
if output.endswith(b"Do you wish to create a custom hardware profile? [no]"):
|
if output.endswith(b"Do you wish to create a custom hardware profile? [no]"):
|
||||||
process.stdin.write("no\n")
|
process.stdin.write("no\n")
|
||||||
assert process.wait() == 0
|
assert process.wait() == 0
|
||||||
with open(path.join(toolchains, "avd", avd_name, "config.ini"), "a") as f:
|
with open(path.join(avd_path, "config.ini"), "a") as f:
|
||||||
f.write("disk.dataPartition.size=2G\n")
|
f.write("disk.dataPartition.size=2G\n")
|
||||||
|
|
||||||
@Command('update-hsts-preload',
|
@Command('update-hsts-preload',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue