diff --git a/amethyst/build.gradle.kts b/amethyst/build.gradle.kts index 730f044c4e..63cf319a46 100644 --- a/amethyst/build.gradle.kts +++ b/amethyst/build.gradle.kts @@ -353,15 +353,20 @@ kotlin { // daemon. This no-op shared build service with maxParallelUsages = 1 tells the // scheduler to run this module's Kotlin compile tasks one at a time; other // projects' tasks (JVM tests, lint analysis, packaging) still run in parallel. +// +// CI-only: the OOM needs a cache-cold compile of several variants at once, +// which local builds (incremental, usually one variant) don't produce. abstract class AmethystKotlinCompileLimiter : BuildService -val kotlinCompileLimiter = - gradle.sharedServices.registerIfAbsent("amethystKotlinCompileLimiter", AmethystKotlinCompileLimiter::class) { - maxParallelUsages.set(1) - } +if (System.getenv("CI") != null) { + val kotlinCompileLimiter = + gradle.sharedServices.registerIfAbsent("amethystKotlinCompileLimiter", AmethystKotlinCompileLimiter::class) { + maxParallelUsages.set(1) + } -tasks.withType().configureEach { - usesService(kotlinCompileLimiter) + tasks.withType().configureEach { + usesService(kotlinCompileLimiter) + } } composeCompiler {