fune/taskcluster/scripts/misc/wrench-android-build.sh
Jamie Nicol 7792217d05 Bug 1615148 - Fix wrench on android. r=jrmuizel
This uses a patched version of glutin 0.28 which builds successfully
on Android. It has the caveat that the application is now responsible
to ensure we only create a GL context when the application has been
resumed and the window is valid. This patch does so by spinning an
event loop on startup until we receive a Resume event. This is a bit
of a hack, and will break if the app is minimised, but it is good
enough for wrench's use case.

Cargo-apk no longer supports specifying a separate target_sdk_version
and android_version, meaning we must use a target_sdk_version of
31. This means we no longer have permission to read from "/sdcard", so
wrench and its scripts have been updated to use the application's
"external data dir".

Finally, when running on CI we use a patched version of cargo-apk
which allows building with SDK version 31 and NDK r21d. We should be
able to switch to the upstream git version once we update to NDK r23.

Differential Revision: https://phabricator.services.mozilla.com/D144418
2022-04-27 15:31:56 +00:00

26 lines
828 B
Bash
Executable file

#!/bin/bash
set -x -e -v
MODE=${1?"First argument must be debug|release"}
pushd "${MOZ_FETCHES_DIR}"
mv wrench-deps/{vendor,.cargo,cargo-apk} ${GECKO_PATH}/gfx/wr
popd
pushd "${GECKO_PATH}/gfx/wr/wrench"
# These things come from the toolchain dependencies of the job that invokes
# this script (webrender-wrench-android-build).
export PATH="${PATH}:${MOZ_FETCHES_DIR}/rustc/bin"
export PATH="${PATH}:${JAVA_HOME}/bin"
export ANDROID_SDK_ROOT="${MOZ_FETCHES_DIR}/android-sdk-linux"
export ANDROID_NDK_ROOT="${MOZ_FETCHES_DIR}/android-ndk"
if [ "$MODE" == "debug" ]; then
../cargo-apk/bin/cargo-apk apk build --frozen --verbose
elif [ "$MODE" == "release" ]; then
../cargo-apk/bin/cargo-apk apk build --frozen --verbose --release
else
echo "Unknown mode '${MODE}'; must be 'debug' or 'release'"
exit 1
fi
popd