1#!/bin/bash
2
3set -ex
4
5readonly AGP_VERSION_INPUT=$1
6readonly ANDROID_GRADLE_PROJECTS=(
7    "java/dagger/example/gradle/android/simple"
8    "javatests/artifacts/dagger-android/simple"
9    "javatests/artifacts/hilt-android/simple"
10    "javatests/artifacts/hilt-android/simpleKotlin"
11)
12for project in "${ANDROID_GRADLE_PROJECTS[@]}"; do
13    echo "Running gradle tests for $project with AGP $AGP_VERSION_INPUT"
14    AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project buildDebug --no-daemon --stacktrace
15    AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project testDebug --no-daemon --stacktrace
16done
17
18# Run gradle tests in a project with configuration cache enabled
19# TODO(danysantiago): Once AGP 4.2.0 is stable, remove these project and enable
20# config cache in the other test projects.
21readonly CONFIG_CACHE_PROJECT="javatests/artifacts/hilt-android/gradleConfigCache"
22./$CONFIG_CACHE_PROJECT/gradlew -p $CONFIG_CACHE_PROJECT assembleDebug --no-daemon --stacktrace --configuration-cache
23