From f459a6f6b5236a9cf451ac30b91cb6783a0f47b4 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Wed, 16 Aug 2023 17:19:54 +0200 Subject: [PATCH] [K/N] Configure runtime tests compilation parallelism --- .../jetbrains/kotlin/bitcode/CompileToBitcodePlugin.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/bitcode/CompileToBitcodePlugin.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/bitcode/CompileToBitcodePlugin.kt index 5c971899a1b..9f02e9229e5 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/bitcode/CompileToBitcodePlugin.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/bitcode/CompileToBitcodePlugin.kt @@ -490,9 +490,13 @@ open class CompileToBitcodeExtension @Inject constructor(val project: Project) : maxParallelUsages.set(1) } - // TODO: remove when tests compilation does not consume so much memory. private val compileTestsSemaphore = project.gradle.sharedServices.registerIfAbsent("compileTestsSemaphore", CompileTestsSemaphore::class.java) { - maxParallelUsages.set(5) + // TODO: Make the default always null when tests compilation stops consuming so much memory. + val defaultParallelism = if (project.kotlinBuildProperties.isTeamcityBuild) 2 else null + val parallelism = project.kotlinBuildProperties.getOrNull("kotlin.native.runtimeTestsCompilationParallelism")?.toString()?.toInt() ?: defaultParallelism + parallelism?.let { + maxParallelUsages.set(it) + } } private val modules: NamedDomainObjectContainer = project.objects.polymorphicDomainObjectContainer(Module::class.java).apply {