File size: 2,990 Bytes
89995d3 | 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | // Image build only (Dockerfile): resolves the unit-test and instrumented-test classpaths of :app (foss debug), with a
// set of widely used test libraries added when WARM_TEST_LIBRARIES=1, so that their artifacts are in the Gradle cache.
// Versions follow what the app already resolves (coroutines 1.9.0, lifecycle 2.10.0, Kotlin 2.3.10, Compose UI 1.9.2)
// or are the libraries' current stable releases. Robolectric's own Android runtime downloads use the same mirror.
def unitLibraries = [
'junit:junit:4.13.2',
'org.jetbrains.kotlin:kotlin-test-junit:2.3.10',
'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0',
'org.robolectric:robolectric:4.16',
'androidx.compose.ui:ui-test-junit4:1.9.2',
'androidx.compose.ui:ui-test-manifest:1.9.2',
'androidx.test:core:1.6.1',
'androidx.test:core-ktx:1.6.1',
'androidx.test.ext:junit:1.2.1',
'androidx.test.ext:junit-ktx:1.2.1',
'androidx.arch.core:core-testing:2.2.0',
'androidx.lifecycle:lifecycle-runtime-testing:2.10.0',
'io.mockk:mockk:1.14.2',
'app.cash.turbine:turbine:1.2.0',
'com.google.truth:truth:1.4.4',
]
def instrumentedLibraries = [
'junit:junit:4.13.2',
'androidx.test:runner:1.6.2',
'androidx.test:rules:1.6.1',
'androidx.test:core-ktx:1.6.1',
'androidx.test.ext:junit-ktx:1.2.1',
'androidx.test.espresso:espresso-core:3.6.1',
'androidx.compose.ui:ui-test-junit4:1.9.2',
'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0',
'io.mockk:mockk-android:1.14.2',
'app.cash.turbine:turbine:1.2.0',
'com.google.truth:truth:1.4.4',
]
allprojects { p ->
p.afterEvaluate {
if (p.path != ':app') return
p.tasks.withType(Test).configureEach { systemProperty 'robolectric.dependency.repo.url', 'https://maven.aliyun.com/repository/central' }
if (System.getenv('WARM_TEST_LIBRARIES') == '1') {
unitLibraries.each { p.dependencies.add('testImplementation', it) }
instrumentedLibraries.each { p.dependencies.add('androidTestImplementation', it) }
}
p.tasks.register('benchWarmTestClasspaths') {
doLast {
['fossDebugUnitTestCompileClasspath', 'fossDebugUnitTestRuntimeClasspath',
'fossDebugAndroidTestCompileClasspath', 'fossDebugAndroidTestRuntimeClasspath'].each { name ->
def c = p.configurations.findByName(name)
if (c == null) {
println "warm: ${name} missing"
return
}
def files = c.incoming.artifactView { lenient(true) }.files.files
def failed = c.incoming.resolutionResult.allDependencies.findAll {
it instanceof org.gradle.api.artifacts.result.UnresolvedDependencyResult
}
println "warm: ${name} ${files.size()} files, unresolved ${failed*.requested}"
}
}
}
}
}
|