Optimize build times (#6418)

This commit is contained in:
David Perez 2026-01-27 13:01:20 -06:00 committed by GitHub
parent 66316e4bd2
commit 954571ff4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 105 additions and 61 deletions

View File

@ -299,16 +299,16 @@ dependencies {
testImplementation(libs.square.turbine)
}
tasks {
withType<Test> {
useJUnitPlatform()
maxHeapSize = "2g"
maxParallelForks = Runtime.getRuntime().availableProcessors()
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
@Suppress("MagicNumber")
forkEvery = 100
maxHeapSize = "2g"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
}
afterEvaluate {

View File

@ -260,10 +260,16 @@ protobuf {
}
}
tasks {
withType<Test> {
useJUnitPlatform()
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
@Suppress("MagicNumber")
forkEvery = 100
maxHeapSize = "2g"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
}
private fun renameFile(path: String, newName: String) {

View File

@ -76,8 +76,14 @@ dependencies {
testImplementation(libs.square.turbine)
}
tasks {
withType<Test> {
useJUnitPlatform()
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
@Suppress("MagicNumber")
forkEvery = 100
maxHeapSize = "2g"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
}

View File

@ -179,6 +179,12 @@ fun Project.getGitStagedFiles(rootDir: File): Provider<List<File>> {
}
}
subprojects {
tasks.withType<JavaCompile>().configureEach {
options.isFork = true
}
}
afterEvaluate {
tasks.withType(Detekt::class.java).configureEach {
val typeResolutionEnabled = !classpath.isEmpty

View File

@ -69,11 +69,14 @@ kotlin {
}
}
tasks {
withType<Test> {
useJUnitPlatform()
maxHeapSize = "2g"
maxParallelForks = Runtime.getRuntime().availableProcessors()
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
@Suppress("MagicNumber")
forkEvery = 100
maxHeapSize = "2g"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
}

View File

@ -64,11 +64,14 @@ dependencies {
testImplementation(libs.mockk.mockk)
}
tasks {
withType<Test> {
useJUnitPlatform()
maxHeapSize = "2g"
maxParallelForks = Runtime.getRuntime().availableProcessors()
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
@Suppress("MagicNumber")
forkEvery = 100
maxHeapSize = "2g"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
}

View File

@ -74,11 +74,14 @@ dependencies {
testFixturesImplementation(libs.kotlinx.coroutines.test)
}
tasks {
withType<Test> {
useJUnitPlatform()
maxHeapSize = "2g"
maxParallelForks = Runtime.getRuntime().availableProcessors()
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
@Suppress("MagicNumber")
forkEvery = 100
maxHeapSize = "2g"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
}

View File

@ -5,5 +5,13 @@ kotlin.code.style=official
kotlin.compilerArgs=-Xjspecify-annotations=strict, -Xtype-enhancement-improvements-strict-mode
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC -Dfile.encoding=UTF-8
org.gradle.parallel=true
# Disable build features that are enabled by default and we do not need
# developer.android.com/reference/tools/gradle-api/7.4/com/android/build/api/dsl/BuildFeatures
android.defaults.buildfeatures.renderscript=false
android.defaults.buildfeatures.resvalues=false
android.defaults.buildfeatures.shaders=false

View File

@ -79,11 +79,14 @@ dependencies {
testFixturesImplementation(libs.square.okhttp.mockwebserver)
}
tasks {
withType<Test> {
useJUnitPlatform()
maxHeapSize = "2g"
maxParallelForks = Runtime.getRuntime().availableProcessors()
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
@Suppress("MagicNumber")
forkEvery = 100
maxHeapSize = "2g"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
}

View File

@ -118,10 +118,14 @@ dependencies {
testImplementation(testFixtures(project(":ui")))
}
tasks {
withType<Test> {
useJUnitPlatform()
maxHeapSize = "2g"
maxParallelForks = Runtime.getRuntime().availableProcessors()
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
@Suppress("MagicNumber")
forkEvery = 100
maxHeapSize = "2g"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
}

View File

@ -114,13 +114,15 @@ kotlin {
}
}
tasks {
withType<Test> {
useJUnitPlatform()
maxHeapSize = "2g"
maxParallelForks = Runtime.getRuntime().availableProcessors()
@Suppress("UselessCallOnNotNull")
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC"
android.sourceSets["main"].res.srcDirs("src/test/res")
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
@Suppress("MagicNumber")
forkEvery = 100
maxHeapSize = "2g"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" +
// Explicitly setting the user Country and Language because tests assume en-US
"-Duser.country=US" +
"-Duser.language=en"
android.sourceSets["main"].res.srcDirs("src/test/res")
}