diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a60f34f8d3..94ac528596 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -299,16 +299,16 @@ dependencies { testImplementation(libs.square.turbine) } -tasks { - withType { - 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().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 { diff --git a/authenticator/build.gradle.kts b/authenticator/build.gradle.kts index 280779066d..672fc27b06 100644 --- a/authenticator/build.gradle.kts +++ b/authenticator/build.gradle.kts @@ -260,10 +260,16 @@ protobuf { } } -tasks { - withType { - useJUnitPlatform() - } +tasks.withType().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) { diff --git a/authenticatorbridge/build.gradle.kts b/authenticatorbridge/build.gradle.kts index 707f21f308..2f10b8a3da 100644 --- a/authenticatorbridge/build.gradle.kts +++ b/authenticatorbridge/build.gradle.kts @@ -76,8 +76,14 @@ dependencies { testImplementation(libs.square.turbine) } -tasks { - withType { - useJUnitPlatform() - } +tasks.withType().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" } diff --git a/build.gradle.kts b/build.gradle.kts index 5e10c9871b..72dda1e76e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -179,6 +179,12 @@ fun Project.getGitStagedFiles(rootDir: File): Provider> { } } +subprojects { + tasks.withType().configureEach { + options.isFork = true + } +} + afterEvaluate { tasks.withType(Detekt::class.java).configureEach { val typeResolutionEnabled = !classpath.isEmpty diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 5d5fdd32ff..c4f19e8ac4 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -69,11 +69,14 @@ kotlin { } } -tasks { - withType { - useJUnitPlatform() - maxHeapSize = "2g" - maxParallelForks = Runtime.getRuntime().availableProcessors() - jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" - } +tasks.withType().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" } diff --git a/cxf/build.gradle.kts b/cxf/build.gradle.kts index 02b2efab75..01554521e6 100644 --- a/cxf/build.gradle.kts +++ b/cxf/build.gradle.kts @@ -64,11 +64,14 @@ dependencies { testImplementation(libs.mockk.mockk) } -tasks { - withType { - useJUnitPlatform() - maxHeapSize = "2g" - maxParallelForks = Runtime.getRuntime().availableProcessors() - jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" - } +tasks.withType().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" } diff --git a/data/build.gradle.kts b/data/build.gradle.kts index ffbe65beb6..7cf4be91a6 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -74,11 +74,14 @@ dependencies { testFixturesImplementation(libs.kotlinx.coroutines.test) } -tasks { - withType { - useJUnitPlatform() - maxHeapSize = "2g" - maxParallelForks = Runtime.getRuntime().availableProcessors() - jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" - } +tasks.withType().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" } diff --git a/gradle.properties b/gradle.properties index ba4681f190..abe6c7dfc8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/network/build.gradle.kts b/network/build.gradle.kts index a73bf3b51f..ebce1b33a0 100644 --- a/network/build.gradle.kts +++ b/network/build.gradle.kts @@ -79,11 +79,14 @@ dependencies { testFixturesImplementation(libs.square.okhttp.mockwebserver) } -tasks { - withType { - useJUnitPlatform() - maxHeapSize = "2g" - maxParallelForks = Runtime.getRuntime().availableProcessors() - jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" - } +tasks.withType().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" } diff --git a/testharness/build.gradle.kts b/testharness/build.gradle.kts index e9cbf770bd..69772be822 100644 --- a/testharness/build.gradle.kts +++ b/testharness/build.gradle.kts @@ -118,10 +118,14 @@ dependencies { testImplementation(testFixtures(project(":ui"))) } -tasks { - withType { - useJUnitPlatform() - maxHeapSize = "2g" - maxParallelForks = Runtime.getRuntime().availableProcessors() - } +tasks.withType().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" } diff --git a/ui/build.gradle.kts b/ui/build.gradle.kts index 567e19a978..c2f6f03cc9 100644 --- a/ui/build.gradle.kts +++ b/ui/build.gradle.kts @@ -114,13 +114,15 @@ kotlin { } } -tasks { - withType { - useJUnitPlatform() - maxHeapSize = "2g" - maxParallelForks = Runtime.getRuntime().availableProcessors() - @Suppress("UselessCallOnNotNull") - jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" - android.sourceSets["main"].res.srcDirs("src/test/res") - } +tasks.withType().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") }