From ec799b30b4119f381d9a7ea8ae82fa8e6fd63039 Mon Sep 17 00:00:00 2001 From: Sergii Pechenizkyi Date: Sat, 16 Mar 2019 01:21:52 +0100 Subject: [PATCH] Extract create avd step --- .travis.yml | 2 +- android-emulator/Dockerfile | 7 ------- android-emulator/check-image.sh | 1 + android-emulator/create-avd.sh | 7 +++++++ 4 files changed, 9 insertions(+), 8 deletions(-) create mode 100755 android-emulator/create-avd.sh diff --git a/.travis.yml b/.travis.yml index d442aa6..2febdf6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,4 +27,4 @@ before_install: script: - docker build --build-arg EMULATOR_API_LEVEL --build-arg EMULATOR_VARIANT --build-arg EMULATOR_ARCH -t android-emulator-$EMULATOR_API_LEVEL android-emulator/ - - docker run -it --rm --env EMULATOR_API_LEVEL --volume=$(pwd)/android-emulator:/opt/workspace --entrypoint /opt/workspace/check-image.sh android-emulator-$EMULATOR_API_LEVEL + - docker run -it --rm --env EMULATOR_API_LEVEL --env EMULATOR_VARIANT --env EMULATOR_ARCH --volume=$(pwd)/android-emulator:/opt/workspace --entrypoint /opt/workspace/check-image.sh android-emulator-$EMULATOR_API_LEVEL diff --git a/android-emulator/Dockerfile b/android-emulator/Dockerfile index 7ddaab4..77098d7 100644 --- a/android-emulator/Dockerfile +++ b/android-emulator/Dockerfile @@ -53,12 +53,5 @@ RUN yes 'y' | sdkmanager --licenses >/dev/null \ "system-images;android-${EMULATOR_API_LEVEL};${EMULATOR_VARIANT};${EMULATOR_ARCH}" \ "tools" >/dev/null -# Create AVD -RUN yes 'n' | avdmanager --silent create avd \ - --name android-emulator-${EMULATOR_API_LEVEL} \ - --device "4in WVGA (Nexus S)" \ - --package "system-images;android-${EMULATOR_API_LEVEL};${EMULATOR_VARIANT};${EMULATOR_ARCH}" \ - --sdcard 64M - # GO to workspace WORKDIR /opt/workspace diff --git a/android-emulator/check-image.sh b/android-emulator/check-image.sh index b17ac0b..5ec3dda 100755 --- a/android-emulator/check-image.sh +++ b/android-emulator/check-image.sh @@ -2,6 +2,7 @@ java -Xmx32m -version sdkmanager --list +./create-avd.sh avdmanager list avd emulator-check accel hyper-v cpu-info window-mgr desktop-env ./start-emulator.sh & diff --git a/android-emulator/create-avd.sh b/android-emulator/create-avd.sh new file mode 100755 index 0000000..1e25c33 --- /dev/null +++ b/android-emulator/create-avd.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +yes 'n' | avdmanager --silent create avd \ + --name android-emulator-${EMULATOR_API_LEVEL} \ + --device "4in WVGA (Nexus S)" \ + --package "system-images;android-${EMULATOR_API_LEVEL};${EMULATOR_VARIANT};${EMULATOR_ARCH}" \ + --sdcard 64M