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