summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-04-22 13:51:44 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-04-22 14:07:05 -0700
commit55118e5bd724c62b50cdf7e8158e3bdef446534f (patch)
tree999467dac608ce16abd0dfec5c8a1be037bbff3e /android
parent10087877457eda8017cc17fa25a4fbd5815e96cc (diff)
downloadqtlocation-mapboxgl-55118e5bd724c62b50cdf7e8158e3bdef446534f.tar.gz
Revert "build on trusty"
This reverts commit decc493ec8c30d66bcdf3aa19f58972eb045b5dc. Conflicts: .mason
Diffstat (limited to 'android')
-rwxr-xr-xandroid/scripts/build-debug.sh8
-rwxr-xr-xandroid/scripts/build-release.sh8
-rwxr-xr-xandroid/scripts/common.sh40
-rwxr-xr-xandroid/scripts/run-build.sh85
4 files changed, 141 insertions, 0 deletions
diff --git a/android/scripts/build-debug.sh b/android/scripts/build-debug.sh
new file mode 100755
index 0000000000..450820a118
--- /dev/null
+++ b/android/scripts/build-debug.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+export BUILDTYPE=Debug
+
+./android/scripts/common.sh $1
diff --git a/android/scripts/build-release.sh b/android/scripts/build-release.sh
new file mode 100755
index 0000000000..73c7fab81a
--- /dev/null
+++ b/android/scripts/build-release.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+export BUILDTYPE=Release
+
+./android/scripts/common.sh $1
diff --git a/android/scripts/common.sh b/android/scripts/common.sh
new file mode 100755
index 0000000000..0d610909bc
--- /dev/null
+++ b/android/scripts/common.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+NAME=$1
+
+case `uname -s` in
+ 'Darwin') export JOBS=`sysctl -n hw.ncpu` ;;
+ 'Linux') export JOBS=`nproc` ;;
+ *) export JOBS=1 ;;
+esac
+
+
+export CC=clang CXX=clang++
+export MASON_PLATFORM=android
+
+mkdir -p ./android/java/MapboxGLAndroidSDKTestApp/src/main/res/raw/
+echo "${MAPBOX_ACCESS_TOKEN}" >> ./android/java/MapboxGLAndroidSDKTestApp/src/main/res/raw/token.txt
+
+make android -j$JOBS BUILDTYPE=$BUILDTYPE JOBS=$JOBS
+
+S3_PREFIX=s3://mapbox/mapbox-gl-native/android/build/${NAME}
+APK_OUTPUTS=./android/java/MapboxGLAndroidSDKTestApp/build/outputs/apk
+
+# Upload the shared object.
+aws s3 cp \
+ ./build/android-${ANDROID_ABI}/${BUILDTYPE}/lib.target/libmapbox-gl.so \
+ ${S3_PREFIX}/libmapbox-gl.so
+
+# Upload either the debug or the release build
+if [ ${BUILDTYPE} == "Debug" ] ; then
+ aws s3 cp \
+ ${APK_OUTPUTS}/MapboxGLAndroidSDKTestApp-debug.apk \
+ ${S3_PREFIX}/MapboxGLAndroidSDKTestApp-debug.apk
+elif [ ${BUILDTYPE} == "Release" ] ; then
+ aws s3 cp \
+ ${APK_OUTPUTS}/MapboxGLAndroidSDKTestApp-release-unsigned.apk \
+ ${S3_PREFIX}/MapboxGLAndroidSDKTestApp-release-unsigned.apk
+fi
diff --git a/android/scripts/run-build.sh b/android/scripts/run-build.sh
new file mode 100755
index 0000000000..9fa15a02bf
--- /dev/null
+++ b/android/scripts/run-build.sh
@@ -0,0 +1,85 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+cwd=$(pwd)
+
+region="us-east-1"
+region_ami="ami-022e0c6a"
+sleep=10
+instance_name="android-gl-build-$TRAVIS_REPO_SLUG-$TRAVIS_JOB_NUMBER"
+echo $ami_name
+
+NAME=$TRAVIS_JOB_ID
+
+user_data="#!/bin/bash
+ cd /android
+ git clone git://github.com/mapbox/mapbox-gl-native.git
+
+ pushd mapbox-gl-native
+ if [[ $TRAVIS_PULL_REQUEST == 'false' ]]; then
+ git checkout $TRAVIS_COMMIT
+ else
+ git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge:
+ git checkout FETCH_HEAD
+ fi
+ git submodule update --init --recursive
+
+ export ANDROID_NDK_PATH=/android/android-ndk-r10d
+ export JAVA_HOME=/android/jdk1.7.0_71
+ export ANDROID_HOME=/android/android-sdk-linux
+ export PATH=\$PATH:/android/jdk1.7.0_71/bin
+ export MAPBOX_ACCESS_TOKEN=$MAPBOX_ACCESS_TOKEN
+ export TESTMUNK_KEY=$TESTMUNK_KEY
+ export TESTMUNK=$TESTMUNK
+ export MASON_ANDROID_ABI=$MASON_ANDROID_ABI
+ export ANDROID_ABI=$MASON_ANDROID_ABI
+
+ if ./android/scripts/build-$CONFIG.sh $NAME &>../build.log; then
+ echo 'ANDROID BUILD PASSED'
+ else
+ echo 'ANDROID BUILD FAILED'
+ fi
+ popd
+
+ aws s3 cp --region us-east-1 build.log s3://mapbox/mapbox-gl-native/android/build/${NAME}/build-log.txt
+ shutdown -P now"
+
+id=$(aws ec2 run-instances \
+ --region $region \
+ --image-id $region_ami \
+ --count 1 \
+ --instance-type m3.large \
+ --iam-instance-profile Arn="$ANDROID_BUILD_INSTANCE_PROFILE" \
+ --instance-initiated-shutdown-behavior terminate \
+ --user-data "$user_data" | jq -r '.Instances[0].InstanceId')
+
+echo "Instance: $region $id"
+
+sleep 10
+
+result=$(aws ec2 create-tags --region $region --resources $id --tags "Key=Name,Value=$instance_name")
+
+instance_status_terminated=$(aws ec2 describe-instances --region $region --instance-id $id | jq -r '.Reservations[0].Instances[0].State.Name')
+
+until [ "$instance_status_terminated" = "terminated" ]; do
+ instance_status_terminated=$(aws ec2 describe-instances --region $region --instance-id $id | jq -r '.Reservations[0].Instances[0].State.Name')
+ echo "Instance terminating status $region $id: $instance_status_terminated"
+ sleep $sleep
+done
+
+echo "Build finished"
+
+output=$(aws ec2 get-console-output --region $region --instance-id $id | jq -r '.Output')
+
+aws s3 cp --region $region s3://mapbox/mapbox-gl-native/android/build/${NAME}/build-log.txt build.log
+cat build.log
+
+if [[ $output == *"ANDROID BUILD PASSED"* ]]; then
+ echo "ANDROID BUILD PASSED"
+ exit 0
+else
+ echo "ANDROID BUILD FAILED"
+ exit 1
+fi