2016-01-11 17:42:26 +00:00
|
|
|
#!/bin/bash
|
2016-01-26 23:16:33 +00:00
|
|
|
|
|
|
|
set -o pipefail
|
|
|
|
set -e
|
|
|
|
|
|
|
|
PATH="/opt/android-sdk-linux/platform-tools:$PATH"
|
|
|
|
|
2016-12-20 19:01:45 +00:00
|
|
|
if [ -n "$REALM_BUILD_ANDROID" ]; then
|
|
|
|
echo "Realm is already installed" # by inoking test.sh previously for example
|
|
|
|
|
|
|
|
else
|
|
|
|
# Inform the prepublish script to build Android modules.
|
|
|
|
REALM_BUILD_ANDROID=1 npm install realm realm-tests
|
|
|
|
fi
|
|
|
|
|
2016-01-26 23:16:33 +00:00
|
|
|
|
2016-03-03 23:09:23 +00:00
|
|
|
cp ../../src/object-store/tests/query.json node_modules/realm-tests/query-tests.json
|
2016-01-26 23:16:33 +00:00
|
|
|
|
2016-12-20 19:01:45 +00:00
|
|
|
echo "Uninstalling old apk"
|
2016-11-24 13:29:19 +00:00
|
|
|
adb uninstall io.realm.react.testapp || true
|
|
|
|
|
2016-02-03 19:00:21 +00:00
|
|
|
echo "Reversing port for physical device"
|
2016-01-26 23:16:33 +00:00
|
|
|
adb reverse tcp:8081 tcp:8081
|
2016-02-22 00:57:05 +00:00
|
|
|
|
2017-02-02 01:41:27 +00:00
|
|
|
echo "Reversing port for Realm Object Server"
|
|
|
|
adb reverse tcp:9080 tcp:9080
|
|
|
|
|
2016-12-20 19:01:45 +00:00
|
|
|
echo "Building Release APK"
|
|
|
|
pushd android && ./gradlew assembleRelease
|
2016-02-22 00:57:05 +00:00
|
|
|
|
2016-12-20 19:01:45 +00:00
|
|
|
echo "Installing APK"
|
|
|
|
adb install app/build/outputs/apk/app-release.apk
|
2016-11-24 13:29:19 +00:00
|
|
|
|
|
|
|
echo "Starting the Main Activity"
|
|
|
|
adb shell am start -n io.realm.react.testapp/.MainActivity
|
2016-12-20 19:01:45 +00:00
|
|
|
|
|
|
|
popd
|