0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-19 19:42:17 +02:00
Anki-Android/tools/android-wait-for-emulator.sh
Joshua Ford 5c6d293ebf CI: Use emulator acceleration
To take advantage of some of the new nested virtualization capabilities
of some of the images in Travis, you must be using the newest LTS
release of Ubuntu, 18.04 Bionic Beaver.

However, the Travis image of Bionic does not include support for JDK 8,
which we need to utilize the Android SDK manager. To circumvent this
issue, we change from the "android" language type to "generic", and take
care of both the JDK and the Android SDK ourselves.

As such, this commit makes the following changes:
* Switch `dist` from `trusty` to `bionic`
* Switch `language` from `android` to `generic`
* Enable the use of `sudo`
* Install libpulse0 for emulator audio
* Set up KVM inside the allocated Travis image
* Use Gravis repository to download and install Java
* Version android-wait-for-emulator in our repo
* Download and install the Android SDK ourselves
* Switch to `emulator-headless` for the x86 emulators

Since we're free to switch Java versions as we please, we can finally
support JDK 11 by switching to it after starting our emulator.
2019-11-01 12:01:22 -05:00

27 lines
707 B
Bash
Executable File

#!/bin/bash
# Originally written by Ralf Kistner <ralf@embarkmobile.com>, but placed in the public domain
set +e
bootanim=""
failcounter=0
timeout_in_sec=600 # 10 minutes
until [[ "$bootanim" =~ "stopped" ]]; do
bootanim=`adb -e shell getprop init.svc.bootanim 2>&1 &`
if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline"
|| "$bootanim" =~ "running" || "$bootanim" =~ "error: no emulators found" ]]; then
let "failcounter += 1"
echo "Waiting for emulator to start"
if [[ $failcounter -gt timeout_in_sec ]]; then
echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
exit 1
fi
fi
sleep 1
done
echo "Emulator is ready"