Provisioning: expand Android gradle cache project

Add an :app and :lib modules so both com.android.application
and com.android.library paths are exercised, and add a Kotlin
source + JUnit test in each module. This makes gradlew build
pull the kotlin toolchain jars (compiler-embeddable, reflect,
coroutines) that Qt Android JAR and app builds could need
later. This way we ensure all possible artifacts are made
available in the cache during provisioning and avoid or at
least reduce the chances or later downloads.

Task-number: QTBUG-132915
Change-Id: Ic518f96370ffc40f921bcb3063257f8663e41615
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Assam Boudjelthia
2026-04-25 02:02:02 +03:00
parent 35389bc1be
commit 73fa80bab8
14 changed files with 82 additions and 26 deletions

View File

@@ -10,9 +10,9 @@ source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
source "${BASH_SOURCE%/*}/../unix/SourceEnvVars.sh"
echo "Caching Gradle distribution and dependencies"
gradleCacheFileName="gradle_9.3.1_linux_cache.tar.gz"
gradleCacheFileName="gradle_9.3.1_linux_cache_v2.tar.gz"
gradleCacheUrl="http://ci-files01-hki.ci.qt.io/input/gradle/$gradleCacheFileName"
gradleCacheSha1="b054e7366552e81023c9c240d3134967233defac"
gradleCacheSha1="e88989d55f68e978442e567e4707a6093c829af6"
gradleCacheFile="/tmp/$gradleCacheFileName"
DownloadURL "$gradleCacheUrl" "$gradleCacheUrl" "$gradleCacheSha1" "$gradleCacheFile"
mkdir -p "$HOME/.gradle"

View File

@@ -10,9 +10,9 @@ source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
source "${BASH_SOURCE%/*}/../unix/SourceEnvVars.sh"
echo "Caching Gradle distribution and dependencies"
gradleCacheFileName="gradle_9.3.1_darwin_cache.tar.gz"
gradleCacheFileName="gradle_9.3.1_darwin_cache_v2.tar.gz"
gradleCacheUrl="http://ci-files01-hki.ci.qt.io/input/gradle/$gradleCacheFileName"
gradleCacheSha1="0009b1f55269461071b8650ee60427b66e265c4b"
gradleCacheSha1="d4f93be293224e3d55779cf64252337fbb26b53b"
gradleCacheFile="/tmp/$gradleCacheFileName"
DownloadURL "$gradleCacheUrl" "$gradleCacheUrl" "$gradleCacheSha1" "$gradleCacheFile"
mkdir -p "$HOME/.gradle"

View File

@@ -0,0 +1,20 @@
plugins {
alias(libs.plugins.android.application)
}
android {
namespace = 'org.qtproject.qt.gradlecache.app'
compileSdk = 36
defaultConfig {
applicationId 'org.qtproject.qt.gradlecache.app'
minSdk = 28
}
}
dependencies {
implementation libs.core
implementation libs.appcompat
implementation libs.material
testImplementation libs.junit
}

View File

@@ -0,0 +1,5 @@
package org.qtproject.qt.gradlecache.app
object Main {
fun hello(): String = "hello"
}

View File

@@ -0,0 +1,11 @@
package org.qtproject.qt.gradlecache.app
import org.junit.Assert.assertEquals
import org.junit.Test
class MainTest {
@Test
fun hello() {
assertEquals("hello", Main.hello())
}
}

View File

@@ -1,21 +1,4 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
}
android {
namespace = 'org.qtproject.qt.gradlecache'
compileSdk = 36
defaultConfig {
applicationId "org.qtproject.qt.gradle.cache"
minSdk = 28
}
}
dependencies {
implementation libs.core
implementation libs.appcompat
implementation libs.material
}

View File

@@ -1,16 +1,16 @@
[versions]
agp = "9.0.0"
kotlin = "2.1.10"
core = "1.17.0"
appcompat = "1.7.1"
material = "1.13.0"
junit = "4.13.2"
[libraries]
core = { group = "androidx.core", name = "core", version.ref = "core" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

View File

@@ -0,0 +1,17 @@
plugins {
alias(libs.plugins.android.library)
}
android {
namespace = 'org.qtproject.qt.gradlecache.lib'
compileSdk = 36
defaultConfig {
minSdk = 28
}
}
dependencies {
implementation libs.core
testImplementation libs.junit
}

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>

View File

@@ -0,0 +1,5 @@
package org.qtproject.qt.gradlecache.lib
object Lib {
fun hello(): String = "hello"
}

View File

@@ -0,0 +1,11 @@
package org.qtproject.qt.gradlecache.lib
import org.junit.Assert.assertEquals
import org.junit.Test
class LibTest {
@Test
fun hello() {
assertEquals("hello", Lib.hello())
}
}

View File

@@ -14,3 +14,4 @@ dependencyResolutionManagement {
}
rootProject.name = 'gradlecache'
include ':app', ':lib'

View File

@@ -4,10 +4,10 @@
. "$PSScriptRoot\helpers.ps1"
Write-Host "Caching Gradle distribution and dependencies"
$gradleCacheFileName = "gradle_9.3.1_windows_cache.zip"
$gradleCacheFileName = "gradle_9.3.1_windows_cache_v2.zip"
$gradleCacheCachedUrl = "\\ci-files01-hki.ci.qt.io\provisioning\gradle\$gradleCacheFileName"
$gradleCacheOfficialUrl = $gradleCacheCachedUrl
$gradleCacheChecksum = "b657ea2b3e25f0bef7f7831a34080cd2af659f48"
$gradleCacheChecksum = "fcd653a1f4f30da9074a7aa7cfcad9219ed57d96"
$gradleCacheZip = "C:\Windows\Temp\$gradleCacheFileName"
Download $gradleCacheOfficialUrl $gradleCacheCachedUrl $gradleCacheZip
Verify-Checksum $gradleCacheZip $gradleCacheChecksum