2016-09-02 11:52:03 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# CD into build dir if possible - allows building from any directory
|
|
|
|
script_path='.'
|
|
|
|
if `readlink -f $0 &>/dev/null`; then
|
|
|
|
script_path=`readlink -f $0 2>/dev/null`
|
|
|
|
fi
|
|
|
|
script_dir=`dirname $script_path`
|
|
|
|
cd $script_dir
|
|
|
|
|
2017-05-09 09:43:14 +01:00
|
|
|
# Ensure gradelw exists before starting
|
|
|
|
if [[ ! -f gradlew ]]; then
|
|
|
|
echo 'gradlew file not found! Check that you are in the right directory.'
|
2016-09-02 11:52:03 +01:00
|
|
|
exit 9
|
|
|
|
fi
|
|
|
|
|
2017-05-09 09:43:14 +01:00
|
|
|
# Copy base class library from wlauto dist
|
|
|
|
libs_dir=app/libs
|
|
|
|
base_classes=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', '*.aar')"`
|
|
|
|
mkdir -p $libs_dir
|
|
|
|
cp $base_classes $libs_dir
|
2016-09-02 11:52:03 +01:00
|
|
|
|
|
|
|
# Build and return appropriate exit code if failed
|
2017-05-09 09:43:14 +01:00
|
|
|
# gradle build
|
|
|
|
./gradlew clean :app:assembleDebug
|
2016-09-02 11:52:03 +01:00
|
|
|
exit_code=$?
|
|
|
|
if [[ $exit_code -ne 0 ]]; then
|
2017-05-09 09:43:14 +01:00
|
|
|
echo "ERROR: 'gradle build' exited with code $exit_code"
|
2016-09-02 11:52:03 +01:00
|
|
|
exit $exit_code
|
|
|
|
fi
|
|
|
|
|
2017-05-09 09:43:14 +01:00
|
|
|
# If successful move APK file to workload folder (overwrite previous)
|
|
|
|
package=com.arm.wlauto.uiauto.skype
|
2016-09-02 11:52:03 +01:00
|
|
|
rm -f ../$package
|
2017-05-09 09:43:14 +01:00
|
|
|
if [[ -f app/build/apk/$package.apk ]]; then
|
2017-06-05 14:30:49 +01:00
|
|
|
cp app/build/apk/$package.apk ../$package.apk
|
2016-09-02 11:52:03 +01:00
|
|
|
else
|
2017-05-09 09:43:14 +01:00
|
|
|
echo 'ERROR: UiAutomator apk could not be found!'
|
2016-09-02 11:52:03 +01:00
|
|
|
exit 9
|
|
|
|
fi
|