forked from firebase/quickstart-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·45 lines (36 loc) · 1.1 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# Exit on error
set -e
# List of all samples
samples=( admob analytics app-indexing auth config crash database dynamiclinks invites messaging storage )
# Limit memory usage
OPTS='-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
# Work off travis
if [[ -v TRAVIS_PULL_REQUEST ]]; then
echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
else
echo "TRAVIS_PULL_REQUEST: unset, setting to false"
TRAVIS_PULL_REQUEST=false
fi
for sample in "${samples[@]}"
do
echo "Building ${sample}"
# Go to sample directory
cd $sample
# Copy mock google-services file if necessary
if [ ! -f ./app/google-services.json ]; then
echo "Using mock google-services.json"
cp ../mock-google-services.json ./app/google-services.json
fi
# Build
if [ $TRAVIS_PULL_REQUEST = false ] ; then
# For a merged commit, build all configurations.
GRADLE_OPTS=$OPTS ./gradlew clean build
else
# On a pull request, just build debug which is much faster and catches
# obvious errors.
GRADLE_OPTS=$OPTS ./gradlew clean :app:assembleDebug
fi
# Back to parent directory.
cd -
done