Android:Coin: do gradle build in provisioning to cache downloadables

If Gradle is not present in the system, it's downloaded from the URL
from the Gradle wrapper. Also, the same for AGP when an Android
project build is done. Currently, that's done on every integration,
and that can be unreliable due to networking flakiness. With this
patch, a Gradle build is done once during provisioning where the
downloads of Gradle and AGP dependencies are downloaded.

Fixes: QTQAINFRA-6166
Fixes: QTQAINFRA-4726
Fixes: QTBUG-117203
Fixes: QTBUG-114699
Change-Id: Ic9fd8aeea3379ca1d45ffeb4523a52e2846fcabb
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
This commit is contained in:
Assam Boudjelthia
2024-03-01 16:34:26 +02:00
parent 6941e50a6d
commit 39517ef0d0
11 changed files with 171 additions and 1 deletions

View File

@@ -188,6 +188,23 @@ echo "no" | ./avdmanager create avd -n automotive_emulator_x86_64_api_29 -c 2048
# To be used by the VMs to start the emulator for tests
emulator_script_filename="android_emulator_launcher.sh"
cp "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/${emulator_script_filename}" "${HOME}"
scripts_dir_name="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
cp "${scripts_dir_name}/${emulator_script_filename}" "${HOME}"
ANDROID_EMULATOR_RUNNER="${HOME}/${emulator_script_filename}"
SetEnvVar "ANDROID_EMULATOR_RUNNER" "$ANDROID_EMULATOR_RUNNER"
# Gradle Caching
cp -r "${scripts_dir_name}/android/gradle_project" /tmp/gradle_project
cd /tmp/gradle_project
# Get Gradle files from qtbase
qtbaseGradleUrl="https://code.qt.io/cgit/qt/qtbase.git/plain/src/3rdparty/gradle"
commit_sha="0d91cc866f2799d56911bcdadabebb137eafcea8"
curl "$qtbaseGradleUrl"/gradle.properties\?h\=$commit_sha > gradle.properties
curl "$qtbaseGradleUrl"/gradlew\?h\=$commit_sha > gradlew
curl "$qtbaseGradleUrl"/gradlew.bat\?h\=$commit_sha > gradlew.bat
mkdir -p gradle/wrapper
curl "$qtbaseGradleUrl"/gradle/wrapper/gradle-wrapper.jar\?h\=$commit_sha > gradle/wrapper/gradle-wrapper.jar
curl "$qtbaseGradleUrl"/gradle/wrapper/gradle-wrapper.properties\?h\=$commit_sha > gradle/wrapper/gradle-wrapper.properties
# Run Gradle
chmod +x gradlew
ANDROID_SDK_ROOT="$sdkTargetFolder" sh gradlew build