gecko-dev/taskcluster/scripts/misc/wrench-android-build.sh
Jamie Nicol ffd7f50dee Bug 1581628 - Update wrench jobs to work with NDK r20. r=jrmuizel
To support NDK r20, wrench needs to be built with a more recent, upstream
(though still unpublished) version of cargo-apk. This has some consequences
which have been adjusted for:
 * Gradle is no longer required to build wrench.
 * The output apk file paths have changed.
 * The apks are now signed automatically.
 * The default activity name has changed.
 * Android permissions must be explicitly requested.
 * We must ensure winit is built with a matching version of android_glue.

Differential Revision: https://phabricator.services.mozilla.com/D47129

--HG--
extra : moz-landing-system : lando
2019-09-27 13:50:43 +00:00

30 lines
976 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 ANDROID_HOME="${MOZ_FETCHES_DIR}/android-sdk-linux"
export NDK_HOME="${MOZ_FETCHES_DIR}/android-ndk"
# `cargo apk build` fails whilst attempting to sign the output apk,
# unless the `.android` directory exists.
# See https://github.com/rust-windowing/android-rs-glue/issues/252
mkdir /builds/worker/.android
if [ "$MODE" == "debug" ]; then
../cargo-apk/bin/cargo-apk build --frozen --verbose
elif [ "$MODE" == "release" ]; then
../cargo-apk/bin/cargo-apk build --frozen --verbose --release
else
echo "Unknown mode '${MODE}'; must be 'debug' or 'release'"
exit 1
fi
popd