|
| 1 | +############################################################################################### |
| 2 | +# Android Runtime build script for CI. |
| 3 | +# This file is used by the CI only and it's not meant for regular development. |
| 4 | +############################################################################################### |
| 5 | + |
| 6 | +echo "Ensure adb is in PATH" |
| 7 | +export PATH=$ANDROID_HOME/platform-tools:$PATH |
| 8 | +adb version |
| 9 | + |
| 10 | +echo "Update submodule" |
| 11 | +git submodule update --init |
| 12 | + |
| 13 | +echo "Cleanup old build and test artefacts" |
| 14 | +rm -rf dist/* |
| 15 | +rm -rf consoleLog.txt |
| 16 | +rm -rf test-app/dist/android_unit_test_results.xml |
| 17 | +rm -rf binding-generator/build/test-results/*.xml |
| 18 | +rm -rf android-static-binding-generator/project/staticbindinggenerator/build/test-results/*.xml |
| 19 | + |
| 20 | +echo "Running android static binding generator tests" |
| 21 | +cwd=$(pwd) |
| 22 | +cd android-static-binding-generator/project/staticbindinggenerator |
| 23 | +./gradlew test |
| 24 | +cd $cwd |
| 25 | + |
| 26 | +echo "Stopping running emulators if any" |
| 27 | +for KILLPID in `ps ax | grep 'emulator' | grep -v 'grep' | awk ' { print $1;}'`; do kill -9 $KILLPID; done |
| 28 | +for KILLPID in `ps ax | grep 'qemu' | grep -v 'grep' | awk ' { print $1;}'`; do kill -9 $KILLPID; done |
| 29 | +for KILLPID in `ps ax | grep 'adb' | grep -v 'grep' | awk ' { print $1;}'`; do kill -9 $KILLPID; done |
| 30 | + |
| 31 | +echo "Start emulator" |
| 32 | +$ANDROID_HOME/tools/emulator -avd Emulator-Api19-Default -wipe-data -gpu on & |
| 33 | + |
| 34 | +echo "Building Android Runtime with paramerter packageVersion: $PACKAGE_VERSION and commit: $GIT_COMMIT" |
| 35 | +./gradlew -PpackageVersion=$PACKAGE_VERSION -PgitCommitVersion=$GIT_COMMIT |
| 36 | + |
| 37 | +echo "Run Android Runtime unit tests" |
| 38 | +cp dist/tns-android-*.tgz dist/tns-android.tgz |
| 39 | +$ANDROID_HOME/platform-tools/adb devices |
| 40 | +$ANDROID_HOME/platform-tools/adb -e logcat -c |
| 41 | +$ANDROID_HOME/platform-tools/adb -e logcat > consoleLog.txt & |
| 42 | +cd test-app |
| 43 | +./gradlew runtest --rerun-tasks |
| 44 | + |
| 45 | +echo "Stopping running emulators" |
| 46 | +for KILLPID in `ps ax | grep 'emulator' | grep -v 'grep' | awk ' { print $1;}'`; do kill -9 $KILLPID; done || true |
| 47 | +for KILLPID in `ps ax | grep 'qemu' | grep -v 'grep' | awk ' { print $1;}'`; do kill -9 $KILLPID; done || true |
| 48 | +for KILLPID in `ps ax | grep 'adb' | grep -v 'grep' | awk ' { print $1;}'`; do kill -9 $KILLPID &> /dev/null; done || true |
| 49 | + |
0 commit comments